Closed ChrisGCode closed 6 years ago
No, it's not possible - I've made it this way to make things simpler for users. To disable it - remove lines
if (hid_enabled) android_enable_function(dev, conf, "hid");
from https://github.com/pelya/android-keyboard-gadget/blob/master/kernel-3.4.patch#L119
Then you will have to execute this command to enable HID, from the root shell:
echo 0 > /sys/class/android_usb/android0/enable echo mtp,adb,hid > /sys/class/android_usb/android0/functions echo 1 > /sys/class/android_usb/android0/enable
On Mon, Sep 22, 2014 at 7:44 PM, ChrisGCode notifications@github.com wrote:
Is it possible to deactivate HID? It think it should be possible to activate/deactivate it like mtp, mass_store, ...
— Reply to this email directly or view it on GitHub https://github.com/pelya/android-keyboard-gadget/issues/9.
Hi,
I applied the patch for kernel 3.4. Now I found directory "/sys/class/android_usb/android0/f_hid" in my phone, but NO "/dev/hidg0" or "/dev/hidg1".
$ cat /sys/class/android_usb/android0/functions mpt,adb
I need to modify "init.usb.rc" to enable HID-Gadget mode? How I can debug if the proper init funcion is executed?
If you modified the patch, you need to enable HID mode by hand. Until then, there will be no /dev/hidg0 and hidg1. Execute following commands in the root shell:
echo 0 > /sys/class/android_usb/android0/enable
echo mtp,adb,hid > /sys/class/android_usb/android0/functions
echo 1 > /sys/class/android_usb/android0/enable
You habe to do that each time you plug a cable to USB post, because Android system will override HID mode with just 'mtp,adb'. On Jan 28, 2015 12:04 PM, "lars18th" notifications@github.com wrote:
Hi,
I applied the patch for kernel 3.4. Now I found directory "/sys/class/android_usb/android0/f_hid" in my phone, but NO "/dev/hidg0" or "/dev/hidg1".
$ cat /sys/class/android_usb/android0/functions mpt,adb
I need to modify "init.usb.rc" to enable HID-Gadget mode? How I can debug if the proper init funcion is executed?
— Reply to this email directly or view it on GitHub https://github.com/pelya/android-keyboard-gadget/issues/9#issuecomment-71809073 .
Hi Pelya,
Yes, the patch is using the "hid_enabled" check. See code here: https://github.com/Al3XKOoL/tinno82_S5501/commit/d6ff89b081fbd61ed3ce542f1c886d9180439433#diff-d3d3db76db0b001fddee1bdcfc972c17R1855
But when I execute this script as root:
echo 0 > /sys/class/android_usb/android0/enable echo mtp,adb,hid > /sys/class/android_usb/android0/functions echo 1 > /sys/class/android_usb/android0/enable
Then the ADB disconnects, no MPT, and no HID devices. When I unplug and I replug device, then Windows identifies it as "Unknown Device". No hardware ID. But, If I change from MTP to PTP, then this restores the USB functions.
Where you think is the trouble?
Stop fucking sending me those emails On Jan 28, 2015 3:04 AM, "lars18th" notifications@github.com wrote:
Hi,
I applied the patch for kernel 3.4. Now I found directory "/sys/class/android_usb/android0/f_hid" in my phone, but NO "/dev/hidg0" or "/dev/hidg1".
$ cat /sys/class/android_usb/android0/functions mpt,adb
I need to modify "init.usb.rc" to enable HID-Gadget mode? How I can debug if the proper init funcion is executed?
— Reply to this email directly or view it on GitHub https://github.com/pelya/android-keyboard-gadget/issues/9#issuecomment-71809073 .
@alandewayne you are watching this repository, that's why you are getting all these emails - https://github.com/pelya/android-keyboard-gadget/watchers Press 'unwatch' button at this webpage to stop receiving them. On Jan 28, 2015 5:12 PM, "alandewayne" notifications@github.com wrote:
Stop fucking sending me those emails On Jan 28, 2015 3:04 AM, "lars18th" notifications@github.com wrote:
Hi,
I applied the patch for kernel 3.4. Now I found directory "/sys/class/android_usb/android0/f_hid" in my phone, but NO "/dev/hidg0" or "/dev/hidg1".
$ cat /sys/class/android_usb/android0/functions mpt,adb
I need to modify "init.usb.rc" to enable HID-Gadget mode? How I can debug if the proper init funcion is executed?
— Reply to this email directly or view it on GitHub < https://github.com/pelya/android-keyboard-gadget/issues/9#issuecomment-71809073>
.
— Reply to this email directly or view it on GitHub https://github.com/pelya/android-keyboard-gadget/issues/9#issuecomment-71850349 .
@lars18th replace lines
if (hid_enabled) android_enable_function(dev, "hid");
with just
android_enable_function(dev, "hid");
Then it will always be enabled. I've removed that 'hid_enabled' check some time ago from all my patches, but the old version of the patch still flies around the net.
Hi Pelya,
With current version of the kernel (without the line "if (hid_enabled)") the HID-Gadget patch is working: I can send keystrokes using the tool hid-gadget-test.
However, I have found a problem with the current patch. I comment the problem:
$ echo 0 > /sys/class/android_usb/android0/enable $ echo hid > /sys/class/android_usb/android0/functions $ echo 1 > /sys/class/android_usb/android0/enable
And when I execute the last line the Android device freezes. Only with a hard-reboot (remove battery) I can restore it.
You know where is the problem? Thank you for your time!
No, I never tried to use it this way. Looks like you'll need to add printk() to each function, and trace where it freezes. Or you can try to debug it - http://stackoverflow.com/questions/17477258/how-to-use-gdbclient-to-debug-the-kernel-on-nexus-7
On Tue, Feb 3, 2015 at 11:09 AM, lars18th notifications@github.com wrote:
Hi Pelya,
With current version of the kernel (without the line "if (hid_enabled)") the HID-Gadget patch is working: I can send keystrokes using the tool hid-gadget-test.
However, I have found a problem with the current patch. I comment the problem:
- By default, the USB mode in my Android device (with the patch applied) is: mpt,adb,hid. Because I need to connect the Android device to a very buggy USB device, I like to enable ONLY keyboard and mouse emulation over the USB connection. Then I execute these commands from the shell (as root):
$ echo 0 > /sys/class/android_usb/android0/enable $ echo hid > /sys/class/android_usb/android0/functions $ echo 1 > /sys/class/android_usb/android0/enable
And when I execute the last line the Android device freezes. Only with a hard-reboot (remove battery) I can restore it.
You know where is the problem? Thank you for your time!
— Reply to this email directly or view it on GitHub https://github.com/pelya/android-keyboard-gadget/issues/9#issuecomment-72616651 .
Maybe you are initializing HID module twice? There is already one explicit initialization inside enable_functions(), and when you do
echo hid > /sys/class/android_usb/android0/functions
there is another initialization. On Feb 3, 2015 12:28 PM, "Sergii Pylypenko" x.pelya.x@gmail.com wrote:
No, I never tried to use it this way. Looks like you'll need to add printk() to each function, and trace where it freezes. Or you can try to debug it - http://stackoverflow.com/questions/17477258/how-to-use-gdbclient-to-debug-the-kernel-on-nexus-7
On Tue, Feb 3, 2015 at 11:09 AM, lars18th notifications@github.com wrote:
Hi Pelya,
With current version of the kernel (without the line "if (hid_enabled)") the HID-Gadget patch is working: I can send keystrokes using the tool hid-gadget-test.
However, I have found a problem with the current patch. I comment the problem:
- By default, the USB mode in my Android device (with the patch applied) is: mpt,adb,hid. Because I need to connect the Android device to a very buggy USB device, I like to enable ONLY keyboard and mouse emulation over the USB connection. Then I execute these commands from the shell (as root):
$ echo 0 > /sys/class/android_usb/android0/enable $ echo hid > /sys/class/android_usb/android0/functions $ echo 1 > /sys/class/android_usb/android0/enable
And when I execute the last line the Android device freezes. Only with a hard-reboot (remove battery) I can restore it.
You know where is the problem? Thank you for your time!
— Reply to this email directly or view it on GitHub https://github.com/pelya/android-keyboard-gadget/issues/9#issuecomment-72616651 .
Hi Pelya,
After weeks using a kernel with your patch applied, I found that in some cases the kernel hangs when changing the USB mode. I suggest that you reimplement a safe mode for enable/disable HID mode. Perhaps this can be complex, but it minimizes the cases of a crash.
Regards!
Answer has been given: to deactivate HID;
Possible functions are adb, mtp, midi, ptp, charging, ffs, hid; seperated with a comma (,) and no whitespace.
Is it possible to deactivate HID? It think it should be possible to activate/deactivate it like mtp, mass_store, ...