pelya / android-keyboard-gadget

Convert your Android device into USB keyboard/mouse, control your PC from your Android device remotely, including BIOS/bootloader.
Apache License 2.0
1.22k stars 308 forks source link

Android Lollypop hid_function_bind_config failed #54

Closed ajit1433 closed 7 years ago

ajit1433 commented 7 years ago

I am trying to add HID functionality to my device but i keep getting the hid_function_bind_config failed error.

Below is output while booting device...

[ 3.782222] adb_android_function_enable ...1 [ 3.786518] ==kcj enable_store dev->enabled:1 [ 3.791609] ==kcj enable_store [ 3.794741] ==kcj enable_store dev->enabled:0 [ 3.799429] ==kcj enable_store [ 3.802525] ==kcj enable_store..2 [ 3.805896] adb_android_function_enable ...1 [ 3.810220] ==kcj enable_store dev->enabled:1 [ 3.817129] adb_open [ 3.819438] hid keyboard [ 3.822014] hidg_bind: creating device d6f3e700 [ 3.827827] android_usb gadget: hidg_bind FAILED [ 3.832534] hid_function_bind_config: hid_function_bind_config keyboard failed: -19 [ 3.841698] android_bind_enabled_functions: hid failed

Please help.

pelya commented 7 years ago

What device is this? Who built the kernel?

On Fri, Aug 5, 2016 at 6:10 PM, ajit1433 notifications@github.com wrote:

I am trying to add HID functionality to my device but i keep getting the _hid_function_bindconfig failed error.

Below is output while booting device...

[ 3.782222] adb_android_function_enable ...1 [ 3.786518] ==kcj enable_store dev->enabled:1 [ 3.791609] ==kcj enable_store [ 3.794741] ==kcj enable_store dev->enabled:0 [ 3.799429] ==kcj enable_store [ 3.802525] ==kcj enable_store..2 [ 3.805896] adb_android_function_enable ...1 [ 3.810220] ==kcj enable_store dev->enabled:1 [ 3.817129] adb_open [ 3.819438] hid keyboard [ 3.822014] hidgbind: creating device d6f3e700 [ 3.827827] android_usb gadget: hidgbind FAILED _[ 3.832534] hid_function_bind_config: hid_function_bindconfig keyboard failed: -19 _[ 3.841698] android_bind_enabledfunctions: hid failed

Please help.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/pelya/android-keyboard-gadget/issues/54, or mute the thread https://github.com/notifications/unsubscribe-auth/AAJewKdRhUpm9IzL-bSkUAvqRe-lExxbks5qc1JOgaJpZM4JdxlR .

ajit1433 commented 7 years ago

Hi,

Following are the details:

Android OS Version: ro.build.version.sdk=17 ro.build.version.codename=REL ro.build.version.release=4.2 ...... ro.product.name=rk2928sdk ro.product.device=rk2928sdk ro.product.board=rk2928sdk ro.product.cpu.abi=armeabi-v7a ro.product.cpu.abi2=armeabi .... ro.board.platform=rk2928 ro.build.product=rk2928sdk

Kernel Version: Linux version 3.0.36+ (gcc version 4.6.x-google 20120106 (prerelease) (GCC) )

ajit1433 commented 7 years ago

Figured it out...

Initially .wMaxPacketSize was set dynamically in kernel/drivers/usb/gadget/f_hid.c

After modification i set it to 64: / High-Speed Support / static struct usb_endpoint_descriptor hidg_hs_in_ep_desc = { .bLength = USB_DT_ENDPOINT_SIZE, .bDescriptorType = USB_DT_ENDPOINT, .bEndpointAddress = USB_DIR_IN, .bmAttributes = USB_ENDPOINT_XFER_INT, .wMaxPacketSize = 64, .bInterval = 4, }; ... / Full-Speed Support / static struct usb_endpoint_descriptor hidg_fs_in_ep_desc = { .bLength = USB_DT_ENDPOINT_SIZE, .bDescriptorType = USB_DT_ENDPOINT, .bEndpointAddress = USB_DIR_IN, .bmAttributes = USB_ENDPOINT_XFER_INT, .wMaxPacketSize = 64, .bInterval = 10, };