0
votes


I have a project where I have to communicate between an android application and a usb device. This device has a hid descriptor with different interfaces (5). There are one interface type "keyboard" and one interface type "mouse", other interface are undefined type. I have to read and write data from/to the device. I have seen the USB Host API can open a connection with a USB Device, but I can't see the device on android hid device list. I have seen that "USBManager.getDeviceList" doesn't return all the time keyboard. I think it's because there is still a handle open with this device. How can I prevent this handle ? How can I open get my device to open UsbDeviceConnection ?

For information :
- When I plug my usb device :
     - it recognized as a keyboard (I can use key and navigate on interface)
     - I see the new file event on /dev/input
- I use android 4.2.2
     - dmesg :

input: XXX USB HID SENSORS as /devices/pci0000:00/0000:00:10.1/usb8/8-1/8-1:1.0/input/input29
hid-generic 0003:2804:0100.0014: input,hidraw3: USB HID v1.10 Keyboard [XXX USB HID SENSORS] on usb-0000:00:10.1-1/input0
input: XXX USB HID SENSORS as > /devices/pci0000:00/0000:00:10.1/usb8/8-1/8-1:1.1/input/input30
hid-generic 0003:2804:0100.0015: input,hidraw4: USB HID v1.10 Device [XXX USB HID SENSORS] on usb-0000:00:10.1-1/input1
hid-generic 0003:2804:0100.0016: hiddev0,hidraw5: USB HID v1.10 Device [XXX USB HID SENSORS] on usb-0000:00:10.1-1/input2
input: XXX USB HID SENSORS as /devices/pci0000:00/0000:00:10.1/usb8/8-1/8-1:1.3/input/input31
hid-generic 0003:2804:0100.0017: input,hidraw6: USB HID v1.10 Mouse [XXX USB HID SENSORS] on usb-0000:00:10.1-1/input3
hid-generic 0003:2804:0100.0018: hiddev0,hidraw7: USB HID v1.10 Device [XXX USB HID SENSORS] on usb-0000:00:10.1-1/input4

Thank you for your help

1
aoa2.0 hid send to android stackoverflow.com/questions/28016382/… How to fix?low

1 Answers

0
votes

I think the linux hid driver hooks on to the HID class, which prevents you from accessing the device from the application layer.

Why not have a look at Android Open Accessory Protocol 2.0. Perhaps, this could help you out in your venture.