tejado / android-usb-gadget

Convert your Android phone to any USB device you like! USB Gadget Tool allows you to create and activate USB device roles, like a mouse or a keyboard. 🛠🛡📱
GNU General Public License v3.0
894 stars 70 forks source link

Can it be accessed by terminal emulators like termux ? #47

Open rexackermann opened 10 months ago

rexackermann commented 10 months ago

I am sorry, if this is not the right place to ask this question.

I was using a ducky program that required the usb-gadget-test. Every time I ran the script I needed to manually turn on and off the hid toogle which can be annoying. Is it possible to do it dirrectly using a command that I can put in the script that will,

Turn on hid Run script(send keypress or whatever) Turn of hid

??

Thanks in advance.

Sucareto commented 9 months ago

Turn on hid ls /sys/class/udc > /config/usb_gadget/keyboard/UDC Turn off hid echo > /config/usb_gadget/keyboard/UDC

rexackermann commented 9 months ago

Turn on hid ls /sys/class/udc > /config/usb_gadget/keyboard/UDC Turn off hid echo > /config/usb_gadget/keyboard/UDC

Thanks a lot for the reply but it is not working. The keyboard dir itself does not exist.

Sucareto commented 9 months ago

Turn on hid ls /sys/class/udc > /config/usb_gadget/keyboard/UDC Turn off hid echo > /config/usb_gadget/keyboard/UDC

Thanks a lot for the reply but it is not working. The keyboard dir itself does not exist.

The keyboard directory is created by the android-usb-gadget,You first need to create the Mouse & Keyboard Gadget in app. If you want to complete gadget creation in termux, you can refer to the script here. By the way, I wrote a complete script here.