开发者

Android USB HID Device

Does anyone know how to configure an Android device (tablet) to appear as a USB HID device when connected to a PC? Is there any other way of getting data from the tablet to the PC (via USB) other than writing it to a file, and have the PC retrieve the (updated) file from the tablet which is acting as a 'mass storage device' for the PC? Can USB carry a TCP/IP end-end connection? Using a tablet as a high-end intelligent 'keyboard' 开发者_运维知识库or 'mouse' or similar device would be immensely powerful, and open up lots of possibilities. Controlling a model railway layout is the end I have in mind. Thanks


It's possible to do this using the linux gadget framework http://www.linux-usb.org/gadget/ using a custom composite USB device. The gadget framework is part of the Android kernel source tree by inheritance from Linux.

Unfortunately, Android has its own customizations that restrict the ability to dynamically register new USB gadgets so you will need to patch the kernel source tree for your particular device and add your HID gadget (otherwise you could create a module and load it that way) to the supported Android list.

I have done this before and will update this answer to contain more detail if there is interest. Unfortunately I lost the code so I will have to start from scratch.


If I set up a web server on my phone and enable usb tethering, I can access that server from my PC. If that's not enough for you, this might help: https://market.android.com/details?id=usbwebcam.application&hl=en

I'm running cyanogenmod on a Desire CDMA (BravoC)

Let me know what you find out; it would be pretty handy to use my phone as a USB keyboard in the field. An android server with a PC client is gonna be easiest though.


Have a look at Android Open Accessory Protocol 2.0. This could help you out.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜