-->

Android USB I/O

2020-07-24 08:19发布

问题:

OK, so i have seen all the stuff about how acting as a USB host is impossible on vanilla android, but is there anything in the Android API that would allow an app to override the default USB behavior in order to manually control the USB i/o responses, in order to support some other protocol? I have not seen anything that would facilitate this, but is it possible without hacking the kernel?

This seems like the sort of thing which should be relatively easy, but i haven't found anything. Forgive me if i've been googling incorrectly.

回答1:

I believe that the stock kernel does not include the correct drivers for this. You need to be able to root your device and you need one of the devices capable of acting as a USB host.

See this page, http://sven.killig.de/android/N1/2.2/usb_host/

The linked page had source for the kernel and drivers you'll need ... GOOD LUCK, you'll need it



回答2:

Last year I worked on an application that had a PC component and a smartphone component, and the two were communicating over a USB connection (using ADB port forwarding and regular sockets). So, if you want to do something like that, I'll show you how I did it, maybe it's helpful.



回答3:

USB On-The-Go (USB OTG or just OTG) is a specification first used in late 2001 that allows USB devices, such as tablets or smartphones, to act as a host

@Wikipedia, If anybody is still looking for it

In order to manage usb traffic your device needs to become a host according to USB specification.



标签: android usb