Giter Club home page Giter Club logo

Comments (12)

alandewayne avatar alandewayne commented on July 21, 2024 1

Stop fucking sending me those emails
On Jan 28, 2015 3:04 AM, "lars18th" [email protected] 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
#9 (comment)
.

from android-keyboard-gadget.

pelya avatar pelya commented on July 21, 2024

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 [email protected]
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
#9.

from android-keyboard-gadget.

lars18th avatar lars18th commented on July 21, 2024

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?

from android-keyboard-gadget.

pelya avatar pelya commented on July 21, 2024

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" [email protected] 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
#9 (comment)
.

from android-keyboard-gadget.

lars18th avatar lars18th commented on July 21, 2024

Hi Pelya,

Yes, the patch is using the "hid_enabled" check.
See code here: Al3XKOoL/tinno82_S5501@d6ff89b#diff-d3d3db76db0b001fddee1bdcfc972c17R1855

But when I execute this script as root:

#!/system/bin/sh
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?

from android-keyboard-gadget.

pelya avatar pelya commented on July 21, 2024

@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" [email protected] wrote:

Stop fucking sending me those emails
On Jan 28, 2015 3:04 AM, "lars18th" [email protected] 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
#9 (comment)
.

from android-keyboard-gadget.

pelya avatar pelya commented on July 21, 2024

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

from android-keyboard-gadget.

lars18th avatar lars18th commented on July 21, 2024

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!

from android-keyboard-gadget.

pelya avatar pelya commented on July 21, 2024

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 [email protected] 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
#9 (comment)
.

from android-keyboard-gadget.

pelya avatar pelya commented on July 21, 2024

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" [email protected] 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 [email protected]
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
#9 (comment)
.

from android-keyboard-gadget.

lars18th avatar lars18th commented on July 21, 2024

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!

from android-keyboard-gadget.

conrad-heimbold avatar conrad-heimbold commented on July 21, 2024

Answer has been given: to deactivate HID;

  1. compile with android_enable_function() commented out
  2. Execute in root shell (replace $FUNCTION with what you would like to have):
    echo 0 > /sys/class/android_usb/android0/enable
    echo $FUNCTION > /sys/class/android_usb/android0/functions
    echo 1 > /sys/class/android_usb/android0/enable

Possible functions are adb, mtp, midi, ptp, charging, ffs, hid; seperated with a comma (,) and no whitespace.

from android-keyboard-gadget.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.