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:
User mode USB isochronous transfer from device-to-host
Audio Evolution seems to have built their own userland driver somehow
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...
Related
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:
User mode USB isochronous transfer from device-to-host
Audio Evolution seems to have built their own userland driver somehow
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...
I'm looking for a way to get UVC compartible usb cameras working on other android devices that don't have a kernel driver for those UVC cameras by default.
I don't want to root those devices nor change their image/kernel, because usual customers should be able to use the camera later on with every tablet and without special requirements (except an app).
Do you think it might be possible to establish a raw connection to an unknown device using Android's USB class in Android 3.1 and higher (http://developer.android.com/guide/topics/usb/host.html) or can I only use it with devices that are supported and recognized by the kernel already?
If it would be possible, I would be interested in integrating the UVC driver using Java/NDK to get the video stream out of it. At least that's my rough idea.
Do you think that's possible?
It is definitely possible if you are compromising on that rooted part.. I did the same project and was finally successful. Inside uvc code, you shall be opening /dev/video1 or video0 node for which by default on most of the devices there are no user permissions.
To state it simply,
It depends on 2 things :
1) When you connect the USB Camera, if the camera node is getting created or not. It should be inside /dev directory with major number 81(signifies V4l2 device)
2) For that device node you are having user permissions or not.
These are the two hurdles you will be facing.
Solution to first is not there in our hands coz it depends from vendor to vendor. Ex, Acer tab it gets created but in Samsung Galaxy it doesnt.. The reason is missing support of V4L2 or UVC modules inside the kernel.
Solution to the second one is if you are a root user you can change the permissions of the node.
It is quite a big project and should take some time if you are starting from scratch.. All the best
Yes, the purpose of the usb host support in more recent versions of Android userspace is to allow you to talk to USB devices which don't have kernel drivers. Conceptually it sounds a bit similar to the libusb idea, though it is not libusb.
http://developer.android.com/guide/topics/usb/host.html
It occurs to me (as pure, unverified speculation) that there might perhaps be situations where partial driver-in-kernel support for a device could interfere with attempting to talk to it directly from userspace in this manner.
I'm looking for a way to get UVC compartible usb cameras working on other android devices that don't have a kernel driver for those UVC cameras by default.
That is dependent on the kernel, and the drivers compiled in, also take into consideration in respect of the hardware if it can support it.
By the very sound of it - its resembling USB On-The-Go mechanism... now if you're saying you don't want the devices to be rooted, unfortunately for the USB OTG mechanism you do need root to avail of it and the scripts mechanism in the /etc directory within the ramdisk to handle the plugin event.
I am writing an Android 2.1 application that needs to get data from a USB device. The USB device is an embedded system i created. The embedded system has no OS. Also, the android device does not send any data to the embedded system.
How should i go about this, I'm guessing i will need to make a high-level driver to communicate from USB to the application. But, i have never made a Linux driver before.
If creating a high-level driver is the best way to do this, can someone give me some references so i have somewhere to start.
If there are other ways to accomplish this i would also like to hear about it
-Thanks
The Android Open Accessory Development Kit is where you should start looking. Like many of other Google's documents, the tutorial is reasonably complete and should provide you with a good starting point
Good Luck!
I think you will need to recompile Android kernel to add usb device support.
It can be an option if you are working on some dedicated project and only one Android phone should be supported. If you want to support all kinds of Android phones, I can suggest to implement USB host in your embedded system( if it is possible), thus your Android phone can be connected using ADB protocol.
I've got an application that is written in Java and which talks to a device using virtual serial port (ie a USB CDC ACM device). Currently it runs an a PC (Windows/Linux/Mac OS X),
but it would be a perfect match to be able to port this to a cheap tablet PC to create a stand alone system.
I've been googling for hours now and it seems quite a lot of people are interested in this sort of thin (no surprise there) and some have managed, but I've not found a good match for what I'm looking for or a good place to discuss this.
I'm looking at something like this:
http://www.prlog.org/10776061-101-inch-android-ipad-android-google-mid-tablet-pc.html
I would like to discuss the following:
This says that it supports USB host so it should be doable, eh?
Android is a kind of Linux so I should be able to use a serial dongle there, right?
Has Android got drivers so that I could just plug in a serial port dongle and open it as /dev/tty?
Would the above quoted APAD be usable as a development platform ?
So where would be a best place to discuss this?
br Kusti
To keep this at least partly programming-related: If your application has a GUI, moving to Android is not going to be a load-it-and-go effort. Android has a very different application structure that you're used to and doesn't have Swing (if that's what you're using) or any GUI toolkits other than its own.
On your USB problem: There is support for a few USB-to-RS232C adapters in the stock kernel, but there are a bunch of practical reasons not to use it. Most involve limiting yourself to devices that support host mode, cabling and powering the Android device and the serial adapter. You might be better off using a Bluetooth-to-RS232 adapter on your serial device, which would allow your app to run on a wider variety of devices and gets you the bonus feature of being wireless to put in your marketing material.
I just ported the RXTX library to the Android. Unfortunately I had to fork it to accomodate for different layout of the android projects. More details are here http://v-lad.org/projects/gnu.io.android/
You need to have a device that supports host USB mode. Also the kernel on the device has to support the USB to Serial converter or you have to recompile the kernel yourslef.
Android devices become incredible cheap (especially those with android v1.6). I'm considering to use one as a brain of autonomous robot. Unfortunately I didn't find any info on that.
I would like to connect two external USB-webcams and some DIY-selfmade USB ADC & output-ports converter to steer the wheels and read analog distance sensors. If I choose some cheap netbook than they usually already have 3 usb ports. But if I will be forced to use a tablet, then it requires also an usb hub.
Do android devices support usb-hubs?
Is there any API to grab still frames from external usb webcams (e.g. "vfa://0" & "vfa://1")
Is there any API to read from USB custom device? Let assume that it will simulate serial port for simplicity.
Do I get all of this in android 1.6 or any newer version?
As an update for your information: Based on answers I assume that android device will be too expensive in comparison to effort. I will go for cheap atom netbook with standard linux & arduinio USB device for controls & sensors. At cost of half kg (one pound) heavier device I will save months on learning & development.
You need an android device that either supports usb host mode out of the box (a few of the cheap tablets apparently do) or a phone that can do so with custom usb power wiring and perhaps a new kernel driver (as many phones can).
You will likely need root.
The api would be the normal linux USB stack, including just about any C-coded source-available device driver available for a desktop linux (excepting those that use bits of x86 binary windows drivers run in a compatibility wrapper).
You could interact with that either from the ndk using normal methods (device files, read/write/ioctl) or with careful driver design so things really look like files you can probably get at some of it from java or at the very least java with some thin ndk wrappers around device file operations.
Essentially, this isn't an "android" question, it's a question about the capabilities of a particular android device's hardware, how to get root on that device, and then it becomes a standard embedded linux question.
As far as I know you won't get any of this with the default Java API. Lots of this stuff can however be achieved if you build a custom kernel and add needed modules to it. Basically it all comes down to kernel hacking and won't be really Android related.
I'm very interested in stuff like that myself so keep me updated please.