diff --git a/README.md b/README.md index 9e3c621..0d3b147 100644 --- a/README.md +++ b/README.md @@ -56,7 +56,7 @@ add/change "console=tty3 quiet" to /boot/cmdline.txt copy everything to /opt/freezer/ chmod a+x /opt/freezer/display.py -add to /etc/rc.local: python3 /opt/freezer/display.py +add to /etc/rc.local: 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 d5de780..e2605e4 100644 --- a/raspberry-environment/display.py +++ b/raspberry-environment/display.py @@ -132,6 +132,8 @@ if __name__ == '__main__': GPIO.output(18, GPIO.LOW) GPIO.output(23, GPIO.LOW) + g="/sys/kernel/config/usb_gadget/freezer/" + try: subprocess.run(['dd', 'if=/dev/zero', 'of=/tmp/usbdisk.img', 'bs=1M', 'count=96'], shell=False, check=True) #sfdisk @@ -146,7 +148,7 @@ if __name__ == '__main__': # http://irq5.io/2016/12/22/raspberry-pi-zero-as-multiple-usb-gadgets/ # http://isticktoit.net/?p=1383 subprocess.run(['modprobe', 'libcomposite'], shell=False, check=True) - g="/sys/kernel/config/usb_gadget/freezer/" + subprocess.run(['mkdir', g], shell=False, check=True) os_echo(g+"idVendor", "0x1d6b") # Linux Foundation @@ -158,7 +160,7 @@ if __name__ == '__main__': os_echo(g+"bDeviceSubClass", "0x02") # correct bus driver os_echo(g+"bDeviceProtocol", "0x01") # for multi function - subprocess.run(['mkdir', g+"strings/0x409"], shell=False, check=True) + subprocess.run(['mkdir', g+"strings/0x409"], shell=False, check=True) # english os_echo(g+"strings/0x409/serialnumber", "34812ee8aa112377") # random os_echo(g+"strings/0x409/manufacturer", "IUL TU Dortmund") os_echo(g+"strings/0x409/product", "Raspberry Screenshot Gadget") @@ -173,6 +175,7 @@ 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 os_echo(g+"configs/c.1/MaxPower", "250") subprocess.run(['ln', '-s', g+"functions/mass_storage.usb0", g+"configs/c.1"], shell=False, check=True) @@ -184,10 +187,14 @@ if __name__ == '__main__': 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+"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(['ls /sys/class/udc/ > '+g+'UDC'], shell=True, check=True) # RNDIS OS descriptors