This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Running native codes on USB arrival

Hi Experts,

In Linux environment I use native codes cross compiled for ARM processor in the user space. The requirement is when on a USB device arrival, udevd will invoke the binary in association with rules containing VID/PID.

In Android environment I would like to do the same. I tried cross compiling the native codes for the same ARM development board and able to execute it manually using adb.

Also I developed a sample Android application with JNI interface to manually execute it.

1. How to auto execute the native binary in Android environment, since udev is missing in Android for USB devices ?

2. Writing Android app with JNI native code or straight away native code like GNU utils which one is the best way to satisfy the above needs

Regards,

techguyz

Parents
  • Android may run on the Linux kernel but it does not use a conventional Linux desktop configuration for managing USB host class drivers and associations. Your question has nothing to do with ARM but with the OSes device management system. You can execute binaries from the shell or from an application just fine but if the APIs that your code rely on in the kernel aren't there, it won't matter. You should see errors reported in LogCat when this happens stating this. If you want to ensure your USB host application will work across a range of Android devices and future versions of Android, it is highly suggested that you use Androids native methods for USB host management.

    USB Host | Android Developers

Reply
  • Android may run on the Linux kernel but it does not use a conventional Linux desktop configuration for managing USB host class drivers and associations. Your question has nothing to do with ARM but with the OSes device management system. You can execute binaries from the shell or from an application just fine but if the APIs that your code rely on in the kernel aren't there, it won't matter. You should see errors reported in LogCat when this happens stating this. If you want to ensure your USB host application will work across a range of Android devices and future versions of Android, it is highly suggested that you use Androids native methods for USB host management.

    USB Host | Android Developers

Children
No data