Android Application Accessing Hardware Resources: Difference between revisions
(→CAN) |
|||
(4 intermediate revisions by the same user not shown) | |||
Line 6: | Line 6: | ||
==Android Application Access== | ==Android Application Access== | ||
By default Android Application can't access the hardware directly as per design. | By default Android Application can't access the hardware directly as per design. <br> | ||
All the hardware access either have to be via Android services or via the HAL layers. | All the hardware access either have to be via Android services or via the HAL layers. <br> | ||
There are multiple ways to access the hardware like GPIOs / UART/ SPI / I2C/CAN <br> | |||
However if | However, if you still want to access you can do so by making Selinux in permissive mode or modifying the | ||
* SELinux policies | |||
* make your application system app. | |||
See: | |||
https://devarea.com/aosp-creating-a-systemapplication/#.XxaL2ShKiUk | https://devarea.com/aosp-creating-a-systemapplication/#.XxaL2ShKiUk | ||
Select the interface you are trying to access via Application and clone projects in the Android Studio. <br> | |||
====UART==== | ====UART==== | ||
The project you can take as a reference: | |||
https://github.com/chzhong/serial-android | https://github.com/chzhong/serial-android | ||
====SPI==== | ====SPI==== | ||
The project you can take as a reference: | |||
https://github.com/rrandyzh/android-jni-spi | https://github.com/rrandyzh/android-jni-spi | ||
====GPIO==== | ====GPIO==== | ||
The project you can take as a reference: | |||
https://github.com/synportack24/GPIO | https://github.com/synportack24/GPIO | ||
====I2C==== | ====I2C==== | ||
The project you can take as a reference: | |||
https://github.com/synportack24/GPIO/blob/master/app/src/main/jni/i2c_fragment.c | https://github.com/synportack24/GPIO/blob/master/app/src/main/jni/i2c_fragment.c | ||
====CAN==== | ====CAN==== | ||
The project you can take as a reference: | |||
https://github.com/entropia/libsocket-can-java <br> | https://github.com/entropia/libsocket-can-java <br> | ||
Please refer to README.md for making an application. <br> | Please refer to README.md for making an application. <br> | ||
You can either use the setenforce 0 or have your own sepolicies written, for that refer to {{Varlink|Android Customizing SePolicy|{{#var:RELEASE_LINK}}|SeLinux}} | |||
==Tips/Questions/More Details== | |||
* You can either use the setenforce 0 or have your own sepolicies written, for that refer to {{Varlink|Android Customizing SePolicy|{{#var:RELEASE_LINK}}|SeLinux}} | |||
* For more questions/details register a ticket to our online portal <br> | |||
at [http://www.variscite.com/support/variscite-customer-portal '''Variscite Customer Portal'''] to get high-quality specific details or engineering support for Variscite products |
Latest revision as of 21:52, 19 September 2023
This page is using the default release RELEASE_O8.1.0_1.3.0_8M_DART-MX8M.
To view this page for a specific Variscite SoM and software release, please follow these steps:
- Visit variwiki.com
- Select your SoM
- Select the software release
Android Application Access
By default Android Application can't access the hardware directly as per design.
All the hardware access either have to be via Android services or via the HAL layers.
There are multiple ways to access the hardware like GPIOs / UART/ SPI / I2C/CAN
However, if you still want to access you can do so by making Selinux in permissive mode or modifying the
- SELinux policies
- make your application system app.
See: https://devarea.com/aosp-creating-a-systemapplication/#.XxaL2ShKiUk
Select the interface you are trying to access via Application and clone projects in the Android Studio.
UART
The project you can take as a reference: https://github.com/chzhong/serial-android
SPI
The project you can take as a reference: https://github.com/rrandyzh/android-jni-spi
GPIO
The project you can take as a reference: https://github.com/synportack24/GPIO
I2C
The project you can take as a reference: https://github.com/synportack24/GPIO/blob/master/app/src/main/jni/i2c_fragment.c
CAN
The project you can take as a reference:
https://github.com/entropia/libsocket-can-java
Please refer to README.md for making an application.
Tips/Questions/More Details
- You can either use the setenforce 0 or have your own sepolicies written, for that refer to SeLinux
- For more questions/details register a ticket to our online portal
at Variscite Customer Portal to get high-quality specific details or engineering support for Variscite products