From 7979e0ce4738a55414b9b2e29726a4181a790195 Mon Sep 17 00:00:00 2001 From: Hendrik Langer Date: Fri, 20 Jul 2018 15:09:39 +0200 Subject: [PATCH] change to one otg conf --- README.md | 9 ++++++--- raspberry-environment/display.py | 26 +++++++++++--------------- 2 files changed, 17 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 0d3b147..13d0aa1 100644 --- a/README.md +++ b/README.md @@ -51,12 +51,15 @@ echo "dtoverlay=dwc2" >> /boot/config.txt echo "libcomposite" >> /etc/modules -add/change "console=tty3 quiet" to /boot/cmdline.txt -(console=tty3 loglevel=3 vt.global_cursor_default=0 logo.nologo +apt purge plymouth +systemctl disable getty@tty1 + +add/change in /boot/cmdline.txt: console=tty3 consoleblank=0 loglevel=3 vt.global_cursor_default=0 +(logo.nologo to disable the raspberry) copy everything to /opt/freezer/ chmod a+x /opt/freezer/display.py -add to /etc/rc.local: nohup python3 /opt/freezer/display.py & +add to /etc/rc.local: cd /tmp && nohup python3 /opt/freezer/display.py & ### read-only root wget https://raw.githubusercontent.com/adafruit/Raspberry-Pi-Installer-Scripts/master/read-only-fs.sh diff --git a/raspberry-environment/display.py b/raspberry-environment/display.py index e2605e4..6b567d8 100644 --- a/raspberry-environment/display.py +++ b/raspberry-environment/display.py @@ -175,8 +175,10 @@ if __name__ == '__main__': os_echo(g+"functions/mass_storage.usb0/lun.0/file", "/tmp/usbdisk.img") subprocess.run(['mkdir', g+"configs/c.1"], shell=False, check=True) - #os_echo(g+"configs/c.1/bmAttributes", "0x80") # bus powered + subprocess.run(['mkdir', g+"configs/c.1/strings/0x409"], shell=False, check=True) # english + os_echo(g+"configs/c.1/bmAttributes", "0x80") # bus powered os_echo(g+"configs/c.1/MaxPower", "250") + os_echo(g+"configs/c.1/strings/0x409/configuration", "Storage configuration") subprocess.run(['ln', '-s', g+"functions/mass_storage.usb0", g+"configs/c.1"], shell=False, check=True) # config keyboard @@ -186,15 +188,9 @@ if __name__ == '__main__': os_echo(g+"functions/hid.usb0/report_length", "8") os_echo(g+"functions/hid.usb0/report_desc", "\x05\x01\x09\x06\xa1\x01\x05\x07\x19\xe0\x29\xe7\x15\x00\x25\x01\x75\x01\x95\x08\x81\x02\x95\x01\x75\x08\x81\x03\x95\x05\x75\x01\x05\x08\x19\x01\x29\x05\x91\x02\x95\x01\x75\x03\x91\x03\x95\x06\x75\x08\x15\x00\x25\x65\x05\x07\x19\x00\x29\x65\x81\x00\xc0") - subprocess.run(['mkdir', g+"configs/c.2"], shell=False, check=True) - #subprocess.run(['mkdir', g+"configs/c.2/strings/0x409"], shell=False, check=True) # english - os_echo(g+"configs/c.2/bmAttributes", "0x80") # bus powered - os_echo(g+"configs/c.2/MaxPower", "250") - #os_echo(g+"configs/c.2/strings/0x409/configuration", "Keyboard configuration") # bus powered - subprocess.run(['ln', '-s', g+"functions/hid.usb0", g+"configs/c.2"], shell=False, check=True) + subprocess.run(['ln', '-s', g+"functions/hid.usb0", g+"configs/c.1"], shell=False, check=True) - #subprocess.run(['ln', '-s', g+"configs/c.1", g+"os_desc"], shell=False, check=True) - #subprocess.run(['ln', '-s', g+"configs/c.2", g+"os_desc"], shell=False, check=True) + subprocess.run(['ln', '-s', g+"configs/c.1", g+"os_desc"], shell=False, check=True) subprocess.run(['ls /sys/class/udc/ > '+g+'UDC'], shell=True, check=True) # RNDIS OS descriptors @@ -219,7 +215,7 @@ if __name__ == '__main__': GPIO.output(18, GPIO.HIGH) GPIO.output(23, GPIO.HIGH) print('file changed') - subprocess.run(['killall', 'fim'], shell=False) + subprocess.run(['killall', 'fim'], shell=False, check=False) subprocess.run(['umount', '/mnt'], shell=False, check=False) subprocess.run(['mount', '-o', 'loop,ro', '-t', 'vfat', '/tmp/usbdisk.img', '/mnt'], shell=False, check=True) @@ -243,11 +239,11 @@ if __name__ == '__main__': subprocess.run(['umount', '/mnt'], shell=False, check=False) os_echo(g+"UDC", "") time.sleep(0.5) - subprocess.run(['rmdir', g+"configs/c.2"], shell=False, check=True) - subprocess.run(['rmdir', g+"configs/c.1"], shell=False, check=True) - subprocess.run(['rmdir', g+"functions/mass_storage.usb0"], shell=False, check=True) - subprocess.run(['rmdir', g+"strings/0x409"], shell=False, check=True) - subprocess.run(['rmdir', g], shell=False, check=True) + subprocess.run(['rmdir', g+"configs/c.1/strings/0x409"], shell=False, check=False) + subprocess.run(['rmdir', g+"configs/c.1"], shell=False, check=False) + subprocess.run(['rmdir', g+"functions/mass_storage.usb0"], shell=False, check=False) + subprocess.run(['rmdir', g+"strings/0x409"], shell=False, check=False) + subprocess.run(['rmdir', g], shell=False, check=False) subprocess.run(['modprobe', '-r', 'usb_f_mass_storage'], shell=False, check=False) subprocess.run(['modprobe', '-r', 'libcomposite'], shell=False, check=False) sys.exit(0)