Search code examples
javaandroidandroid-ndkjava-native-interfacelinux-device-driver

How to access device drivers via Java in Android OS?


I’m creating an Android app that requires access to device drivers of Broadcomm’s Single Chip (integrated Wifi+Bluetooth+FM) chip URL: http://www.broadcom.com/products/Wireless-LAN/802.11-Wireless-LAN-Solutions/BCM4334.

Broadcomm has supposedly allowed access to the device drivers on Android OS ,and made their implementation open.

The functionality of the App, is irrelevant.

1) What is the best way, in detail to access device drivers via Java in Android?

2) Is using JNI to access device drivers a good approach?

3) Is using the NDK necessary or is the SDK sufficient, since I’m just accessing device drivers & not actually writing native code?

4) Any other important advice while I’m going down this path?

Also please be kind enough to respond only if you have developed similar applications or an expert , I don’t want to end up with 50 different opinions that will confuse me.

Thanks a million.


Solution

  • BCM4334 is a Wi-fi/BT combo chip, it doesn't include 3G modem.

    I'm not sure what you mean by "accessing device driver", Wi-fi is exposed via the android.net.wifi, bluetooth - via android.bluetooth, and this is really the best way to use Wi-fi and BT on Android - via public API. Again, it is not clear to me what you want to do with the driver, but most likely your app doesn't have permissions to do anything useful anyway.

    Different drivers have different interfaces, for example Wi-fi driver is controlled via IOCTL-based WE API (which would require native code), but there is also a set of command line tools (wireless tools) that can be used from pure Java, so there are multiple options depending on what you want to achieve.

    But I want to reiterate that Android provides public API for both Wi-fi and BT and my advice is to use Android API, not low-level driver interface.