|
|
@ -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) |
|
|
|