Re: [Fuego] Regards: Raspberry-pi build deployment scripts

Srivatsan S <[email protected]> Mon, 23 Nov 2020 21:48:02 +0530
Newsgroups dev.linux.lists.fuego
Message-ID <CAMAk937zpA5jK4B6e+fzTS6SVo5Nb5jCksS=U_DzmXwHeisB9g@mail.gmail.com>
Tim,

Please find the RPI hardware reboot script attached. This reboot script has
been invoked from rpi_deploy_verify.sh -- after deploying the image onto
the board.

Let us know if you've any queries.

Thanks,
Srivatsan




On Fri, Oct 16, 2020 at 6:27 PM Unnati Somvanshi <
[email protected]> wrote:

> Hi Tim,
>
> As discussed at the last meeting I have attached the  RPI build deployment
> scripts, Please find the attachment and let us know if you have any
> questions regarding the same.
>
> Thanks & Regards
> Unnati
>
> This message contains confidential information and is intended only for
> the individual(s) named. If you are not the intended recipient, you are
> notified that disclosing, copying, distributing or taking any action in
> reliance on the contents of this mail and attached file/s is strictly
> prohibited. Please notify the sender immediately and delete this e-mail
> from your system. E-mail transmission cannot be guaranteed to be secured or
> error-free as information could be intercepted, corrupted, lost, destroyed,
> arrive late or incomplete, or contain viruses. The sender therefore does
> not accept liability for any errors or omissions in the contents of this
> message, which arise as a result of e-mail transmission.
> _______________________________________________
> Fuego mailing list
> [email protected]
> https://lists.linuxfoundation.org/mailman/listinfo/fuego
>

-- 






This
message contains confidential information and is intended only 
for the
individual(s) named. If you are not the intended
recipient, you are 
notified that disclosing, copying, distributing or taking any
action in 
reliance on the contents of this mail and attached file/s is strictly
prohibited. Please notify the
sender immediately and delete this e-mail 
from your system. E-mail transmission
cannot be guaranteed to be secured or 
error-free as information could be
intercepted, corrupted, lost, destroyed, 
arrive late or incomplete, or contain
viruses. The sender therefore does 
not accept liability for any errors or
omissions in the contents of this 
message, which arise as a result of e-mail
transmission.
rpireboot.py (text/x-python, 958 B)
#!/usr/bin/python

import serial
import time

print("Communicating with relay board \n")
serPort = serial.Serial('/dev/ttyUSB0', 9600, timeout=3.0)

def main():
    print(serPort)
    ping()
    print(ping)
    print("Sleeping for 3 secs \n\t")
    time.sleep(3)
    reset()
    print("Closing Serial Port")
    serPort.close()
    
#Check for the relay board by
#sending ping command
def ping():
    print("Ping the relay \n")
    serPort.write(b'\'')
    data = serPort.read()
    print("Data read is :",data)
    print('\n')

#Resetting the RPI board
def reset():
#   print("Resetting the RPI board\n")
#   print("RELAY1_OFF_COMMAND: 0x31\n" )
    OFF = [0x31]
    offdata=bytearray(OFF)
    serPort.write(offdata)
#   print("Wait for 2 secs\n")
    time.sleep(2)
#   print("RELAY1_ON_COMMAND: 0x51\n")
    ON =[0x51]
#   print("usb device turned ON successfully \n")
    ondata=bytearray(ON)
    serPort.write(ondata)

if __name__ == '__main__':
	main()