I’m currently working on an Android project, where I have to collect data from a USB thermometer stick, called Temper, which will be directly connected to a tablet.
This device has Linux drivers, written in C, and I would like to make use of them for my Android app.
Do you know how to integrate those drivers into my apk, or somewhere else?
Or is it possible just to use the android.hardware.usb package (Android 3.0+), thus making my own “driver”?
Thanks in advance.
Option a) you compile just the kernel modules and use the specific device nodes. This would require rooting your device and compiling specific kernel modules for specific kernels for specific devices (ugly!)
Option b) you write a wrapper around the Linux drivers using NDK and let the wrapper be the man-in-the-middle between the Android USB Host interface (Java) and the Linux drivers (C) coordinating all events and pushing data around.
I started work on option b) for usb-dvb device drivers, and it’s an incredible amount of work to do. I hope your driver isn’t that complicated.
If your driver is very easy (only few files and not 10k+ lines of low-level code or even assembler) to translate into Java, go ahead and use
Option c) re-write C code in Java. Thus you don’t need a wrapper in C and you can skip the NDK part which saves you lots of trouble and nightmares.