Permalink
Browse files

[OnePlus 5] Working HID

Requires that you go to command line in adb or on device and modify the setprop.  If you were to open Terminal on device it would be:

su
setprop sys.usb.config hid,adb

If you just want HID then setprop sys.usb.config hid

Signed-off-by: binkybear <binkybear@nethunter.com>
  • Loading branch information...
binkybear committed Sep 23, 2017
1 parent c853d70 commit 1d387b8a4a81eb62265ee480b49426d7eedc1136
Showing with 19 additions and 18 deletions.
  1. +17 −17 nougat/oneplus5-cm/ramdisk/init.qcom.usb.configfs.rc
  2. +2 −1 nougat/oneplus5-cm/ramdisk/init.qcom.usb.rc
@@ -37,39 +37,39 @@ on property:sys.usb.config=hid && property:sys.usb.configfs=1
rm /config/usb_gadget/g1/configs/b.1/f4
rm /config/usb_gadget/g1/configs/b.1/f5
write /config/usb_gadget/g1/idVendor 0x045E # MSFT
write /config/usb_gadget/g1/idProduct 0x001D # Natural Keyboard Pro
write /config/usb_gadget/g1/idProduct 0x00DD # Natural Keyboard Pro
symlink /config/usb_gadget/g1/functions/hid.0 /config/usb_gadget/g1/configs/b.1/f1
write /config/usb_gadget/g1/UDC ${sys.usb.controller}
setprop sys.usb.state ${sys.usb.config}

on property:sys.usb.ffs.ready=1 && on property:sys.usb.config=hid,adb && property:sys.usb.configfs=1
on property:sys.usb.config=hid,adb && property:sys.usb.configfs=1
write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "hid_adb"
rm /config/usb_gadget/g1/configs/b.1/f1
rm /config/usb_gadget/g1/configs/b.1/f2
rm /config/usb_gadget/g1/configs/b.1/f3
rm /config/usb_gadget/g1/configs/b.1/f4
rm /config/usb_gadget/g1/configs/b.1/f5
write /config/usb_gadget/g1/idVendor 0x045E # MSFT
write /config/usb_gadget/g1/idProduct 0x001D # Natural Keyboard Pro
symlink /config/usb_gadget/g1/functions/hid.0 /config/usb_gadget/g1/configs/b.1/f1
symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f2
write /config/usb_gadget/g1/idVendor 0x05C6 # Qualcom
write /config/usb_gadget/g1/idProduct 0x900A # Value: 0x9xxx for composite interface
symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f1
symlink /config/usb_gadget/g1/functions/hid.0 /config/usb_gadget/g1/configs/b.1/f2
write /config/usb_gadget/g1/UDC ${sys.usb.controller}
setprop sys.usb.state hid,adb
setprop sys.usb.state ${sys.usb.config}

on property:sys.usb.ffs.ready=1 && on property:sys.usb.config=hid,adb,mass_storage && property:sys.usb.configfs=1
on property:sys.usb.config=hid,adb,mass_storage && property:sys.usb.configfs=1
write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "hid_adb_msc"
rm /config/usb_gadget/g1/configs/b.1/f1
rm /config/usb_gadget/g1/configs/b.1/f2
rm /config/usb_gadget/g1/configs/b.1/f3
rm /config/usb_gadget/g1/configs/b.1/f4
rm /config/usb_gadget/g1/configs/b.1/f5
write /config/usb_gadget/g1/idVendor 0x045E # MSFT
write /config/usb_gadget/g1/idProduct 0x001D # Natural Keyboard Pro
symlink /config/usb_gadget/g1/functions/hid.0 /config/usb_gadget/g1/configs/b.1/f1
symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f2
write /config/usb_gadget/g1/idVendor 0x05C6 # Qualcom
write /config/usb_gadget/g1/idProduct 0x900A # Value: 0x9xxx for composite interface
symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f1
symlink /config/usb_gadget/g1/functions/hid.0 /config/usb_gadget/g1/configs/b.1/f2
symlink /config/usb_gadget/g1/functions/mass_storage.0 /config/usb_gadget/g1/configs/b.1/f3
write /config/usb_gadget/g1/UDC ${sys.usb.controller}
setprop sys.usb.state hid,adb,mass_storage
setprop sys.usb.state ${sys.usb.config}

on property:sys.usb.config=mass_storage,hid && property:sys.usb.configfs=1
write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "msc_hid"
@@ -78,12 +78,12 @@ on property:sys.usb.config=mass_storage,hid && property:sys.usb.configfs=1
rm /config/usb_gadget/g1/configs/b.1/f3
rm /config/usb_gadget/g1/configs/b.1/f4
rm /config/usb_gadget/g1/configs/b.1/f5
write /config/usb_gadget/g1/idVendor 0x05C6
write /config/usb_gadget/g1/idProduct 0x9015
write /config/usb_gadget/g1/idVendor 0x05C6 # Qualcom
write /config/usb_gadget/g1/idProduct 0x900B # Value: 0x9xxx for composite interface
symlink /config/usb_gadget/g1/functions/hid.0 /config/usb_gadget/g1/configs/b.1/f1
symlink /config/usb_gadget/g1/functions/mass_storage.0 /config/usb_gadget/g1/configs/b.1/f2
write /config/usb_gadget/g1/UDC ${sys.usb.controller}
setprop sys.usb.state mass_storage,hid
setprop sys.usb.state ${sys.usb.config}

# -- Nethunter HID END -- #

@@ -95,7 +95,7 @@ on property:sys.usb.config=mass_storage && property:sys.usb.configfs=1
rm /config/usb_gadget/g1/configs/b.1/f4
rm /config/usb_gadget/g1/configs/b.1/f5
write /config/usb_gadget/g1/idVendor 0x05C6
write /config/usb_gadget/g1/idProduct 0xF000
write /config/usb_gadget/g1/idProduct 0xF000
symlink /config/usb_gadget/g1/functions/mass_storage.0 /config/usb_gadget/g1/configs/b.1/f1
write /config/usb_gadget/g1/UDC ${sys.usb.controller}
setprop sys.usb.state ${sys.usb.config}
@@ -65,13 +65,14 @@ on boot
write /config/usb_gadget/g1/functions/hid.0/protocol "1"
write /config/usb_gadget/g1/functions/hid.0/subclass "1"
write /config/usb_gadget/g1/functions/hid.0/report_length "8"
copy /kybd-descriptor.bin /config/usb_gadget/g1/functions/hid.0/report_desc
# -- END NETHUNTER HID -- #

mkdir /config/usb_gadget/g1/configs/b.1 0770 shell shell
mkdir /config/usb_gadget/g1/configs/b.1/strings/0x409 0770 shell shell
write /config/usb_gadget/g1/os_desc/b_vendor_code 0x1
write /config/usb_gadget/g1/os_desc/qw_sign "MSFT100"
symlink /config/usb_gadget/g1/configs/b.1 /config/usb_gadget/g1/os_desc/b.1
cat /config/usb_gadget/g1/configs/b.1 /config/usb_gadget/g1/os_desc/b.1

mount functionfs adb /dev/usb-ffs/adb uid=2000,gid=2000

1 comment on commit 1d387b8

@ivaneitorOSs

This comment has been minimized.

Copy link

ivaneitorOSs commented on 1d387b8 Oct 14, 2017

Hi, first thanks. I would like to know how to make hid working. I have executed setprop sys.usb.config hid,adb in my androidsu terminal but for example duckhunter is nor working. I am doing something in the wrong way. Regards

Please sign in to comment.