37
votes

Now that the Android APIs support working directly with USB devices (since 3.1), I am curious if there has been any work to create "soft-mode" drivers for some of the more popular class-compliant devices (such as audio or HID).

In other words, are there any open source projects that wrap up more useful communication with specific classes of devices into a Java class that can be added to an Android project?

For my purposes, I am specifically interested in USB audio, but it seems that a community-built set of classes derived from Linux kernel module sources could be beneficial to many projects. My hope is that others have thought of the same thing and have already began work. Any pointers in this direction would be most appreciated.


A few more resources that I have stumbled on:

1
USB Audio: If you are interested in audio data streaming, this is impossible with android, because isochronous endpoints are not supported by the API. However the MIDI part of the Audio Class will work (uses bulk endpoints only). Not seen any projects so far.Alexander
Thanks Alexander, this is very good to know.Brad
This is an interesting idea. However it may be tricky to handle large amounts of small data pakets with a 'thick' API layer. Also, it is questionable if universal USB access would undermine security considerations. On vanilla linux, each USB device is configured according to system defined rules which also decide who is able to access the device. On the other hand, an Android device is usually a 'single user' device and apps are sandboxed on the API layer, so that should be ok. However, for the beginning it would be nice if Android just incoorperates a well chosen set of kernel mode drivers.dronus
@dronus, Agreed. It actually seems that adding some additional kernel drivers is happening. The problem is, it is device-specific. Only a couple manufacturers are stepping into that right now.Brad
However, it is not specific to any Android device (where USB is abstracted by the generic USB stack) but to the connected device. So any pluggable-device manufacturer could make a Java driver this way, where it would be more useful to add a kernel module driver... which cannot be added to the Android devices by an 3rd party developer. On the other hand, native code can be added to an Android application, secured by the application sandbox. This maybe shows a design flaw in linux itself, making it questionable if drivers should be always placed inside the kernel mode.dronus

1 Answers

1
votes

I have started work on an IRDA driver stack over USB in user space. I am working out the basic plumbing but as far as I can see if I can create the equivalent user space driver to the linux kernel drivers such as the STIR4200 driver then I "ought" to then be able to port over existing IRDA protocol stacks such as JIR.

We shall see...