Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Phone 100% reboots when writing keyboard data into /dev/hidg1 after USB unplugged #45

Open
WuDi-ZhanShen opened this issue Mar 4, 2023 · 2 comments

Comments

@WuDi-ZhanShen
Copy link

I have successfully made an APP to change my Android to a USB Keyoard by writing data into /dev/hidg1 after using GSB Gadget Tool ----add function --- Keyboard !! That's really cool. The only question is why my Android 100% reboots automaticly when i unplug the USB from my computer and then write a keyboard data to /dev/hidg1.

And i want adding new USB function "GamePad" into USB Gadget Tool !! Thanks a lot !!

@tejado
Copy link
Owner

tejado commented Mar 5, 2023

Can you try to add a new gadget and NOT a new function to an existing gadget? Depending on the phone vendor, there might be some incompatibilities.
What phone and OS (stock or custom rom, Android Version, Kernel version) are you using?

Adding GamePad should be really simple. We just need to have the respective descriptor for the GamePad you want.

@WuDi-ZhanShen
Copy link
Author

I tried adding a new gadget 'Keyboard&Mouse' , and there's two new higds appeared in /dev/hidg2 and /dev/hidg3. However I can't writing data into these two hidgs. When i try to write, there will be an IOException Error Message:

Error!

write failed: errno 108 (Cannot send after transport endpoint shutdown)

I'm confused because after that I change to the ordinally gadget and add a Keyboard function and writing data into /dev/hidg1, and there is no Error Message and USB keyboard works well.

My phone is Redmi Note 11T Pro, Android 12

KERNEL_VERSION=5.10.66
CONFIG_PCI_ENDPOINT_CONFIGFS=NOT_SET
CONFIG_USB_CONFIGFS=y
CONFIG_USB_CONFIGFS_UEVENT=y
CONFIG_USB_CONFIGFS_SERIAL=y
CONFIG_USB_CONFIGFS_ACM=y
CONFIG_USB_CONFIGFS_OBEX=NOT_SET
CONFIG_USB_CONFIGFS_NCM=y
CONFIG_USB_CONFIGFS_ECM=y
CONFIG_USB_CONFIGFS_ECM_SUBSET=NOT_SET
CONFIG_USB_CONFIGFS_RNDIS=y
CONFIG_USB_CONFIGFS_EEM=y
CONFIG_USB_CONFIGFS_MASS_STORAGE=y
CONFIG_USB_CONFIGFS_F_LB_SS=NOT_SET
CONFIG_USB_CONFIGFS_F_FS=y
CONFIG_USB_CONFIGFS_F_ACC=y
CONFIG_USB_CONFIGFS_F_AUDIO_SRC=y
CONFIG_USB_CONFIGFS_F_UAC1=NOT_SET
CONFIG_USB_CONFIGFS_F_UAC1_LEGACY=NOT_SET
CONFIG_USB_CONFIGFS_F_UAC2=y
CONFIG_USB_CONFIGFS_F_MIDI=y
CONFIG_USB_CONFIGFS_F_HID=y
CONFIG_USB_CONFIGFS_F_UVC=y
CONFIG_USB_CONFIGFS_F_PRINTER=NOT_SET
CONFIG_IIO_CONFIGFS=NOT_SET
CONFIG_CONFIGFS_FS=y

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants