GPIO access running Android
#11
(09-10-2016, 01:11 PM)MarkHaysHarris777 Wrote: I was reading in the sunxi manual for gpio access, and found that the kernel option CONFIG_GPIO_SYSFS must be enabled.  I checked my Android /sys/class/ folder and found that gpio is not there;  the kernel in my Android has not been anabled for CONFIG_GPIO_SYSFS.

It should be easy to enable this option, and frankly, it should be enabled by default.


edit:  PS  I spoke with ayufan about this, and will be updating the configs for his kernel, so that the CONFIG_GPIO_SYSFS will be enabled in his kernel soon...

marcus

That would be awesome and very helpful!!
#12
(09-10-2016, 01:11 PM)MarkHaysHarris777 Wrote: I was reading in the sunxi manual for gpio access, and found that the kernel option CONFIG_GPIO_SYSFS must be enabled.  I checked my Android /sys/class/ folder and found that gpio is not there;  the kernel in my Android has not been anabled for CONFIG_GPIO_SYSFS.

It should be easy to enable this option, and frankly, it should be enabled by default.


edit:  PS  I spoke with ayufan about this, and will be updating the configs for his kernel, so that the CONFIG_GPIO_SYSFS will be enabled in his kernel soon...

marcus


Eager to see that happen Marcus. Please keep us in the loop.


Sent from my iPhone using Tapatalk
#13
(09-11-2016, 01:19 PM)ltorsini Wrote:
(09-10-2016, 01:11 PM)MarkHaysHarris777 Wrote: I was reading in the sunxi manual for gpio access, and found that the kernel option CONFIG_GPIO_SYSFS must be enabled.  I checked my Android /sys/class/ folder and found that gpio is not there;  the kernel in my Android has not been anabled for CONFIG_GPIO_SYSFS.

It should be easy to enable this option, and frankly, it should be enabled by default.


edit:  PS  I spoke with ayufan about this, and will be updating the configs for his kernel, so that the CONFIG_GPIO_SYSFS will be enabled in his kernel soon...

marcus


Eager to see that happen Marcus.  Please keep us in the loop.


Sent from my iPhone using Tapatalk

This was the main reason for buying the Pine64. I use IOIO OTG usb cards for reading analog/digital inputs from joysticks to android tablet. Another use is information screens (big lcd's) with navigation buttons. It would simplify the hardware setup.
#14
(01-13-2017, 03:06 AM)Mr.Loken Wrote:
(09-11-2016, 01:19 PM)ltorsini Wrote:
(09-10-2016, 01:11 PM)MarkHaysHarris777 Wrote: I was reading in the sunxi manual for gpio access, and found that the kernel option CONFIG_GPIO_SYSFS must be enabled.  I checked my Android /sys/class/ folder and found that gpio is not there;  the kernel in my Android has not been anabled for CONFIG_GPIO_SYSFS.

It should be easy to enable this option, and frankly, it should be enabled by default.


edit:  PS  I spoke with ayufan about this, and will be updating the configs for his kernel, so that the CONFIG_GPIO_SYSFS will be enabled in his kernel soon...

marcus


Eager to see that happen Marcus.  Please keep us in the loop.


Sent from my iPhone using Tapatalk

This was the main reason for buying the Pine64. I use IOIO OTG usb cards for reading analog/digital inputs from joysticks to android tablet. Another use is information screens (big lcd's) with navigation buttons. It would simplify the hardware setup.
IOIO is a big reason why GPIO was never developed fully on android by google.
#15
(09-10-2016, 01:11 PM)MarkHaysHarris777 Wrote: I was reading in the sunxi manual for gpio access, and found that the kernel option CONFIG_GPIO_SYSFS must be enabled.  I checked my Android /sys/class/ folder and found that gpio is not there;  the kernel in my Android has not been anabled for CONFIG_GPIO_SYSFS.

It should be easy to enable this option, and frankly, it should be enabled by default.


edit:  PS  I spoke with ayufan about this, and will be updating the configs for his kernel, so that the CONFIG_GPIO_SYSFS will be enabled in his kernel soon...

marcus

Is there any progress regarding GPIO under Android?

I'd like to use at least couple GPIO (at least output) pins, for example intended for LED flashlight and vibration motor. I need them to control slave devices, to re-init USB OTG connection or for hard reset if it hangs and doesn't response.
d;-)
#16
(01-17-2017, 04:06 PM)Workaholic Wrote:
(09-10-2016, 01:11 PM)MarkHaysHarris777 Wrote: I was reading in the sunxi manual for gpio access, and found that the kernel option CONFIG_GPIO_SYSFS must be enabled.  I checked my Android /sys/class/ folder and found that gpio is not there;  the kernel in my Android has not been anabled for CONFIG_GPIO_SYSFS.

It should be easy to enable this option, and frankly, it should be enabled by default.


edit:  PS  I spoke with ayufan about this, and will be updating the configs for his kernel, so that the CONFIG_GPIO_SYSFS will be enabled in his kernel soon...

marcus

Is there any progress regarding GPIO under Android?

I'd like to use at least couple GPIO (at least output) pins, for example intended for LED flashlight and vibration motor. I need them to control slave devices, to re-init USB OTG connection or for hard reset if it hangs and doesn't response.


There is a android 7.0 beta image on the download page where GPIO is enabled, i have tried it a little and it works Smile
#17
(03-06-2017, 04:57 AM)Skivholme Wrote:
(01-17-2017, 04:06 PM)Workaholic Wrote:
(09-10-2016, 01:11 PM)MarkHaysHarris777 Wrote: I was reading in the sunxi manual for gpio access, and found that the kernel option CONFIG_GPIO_SYSFS must be enabled.  I checked my Android /sys/class/ folder and found that gpio is not there;  the kernel in my Android has not been anabled for CONFIG_GPIO_SYSFS.

It should be easy to enable this option, and frankly, it should be enabled by default.


edit:  PS  I spoke with ayufan about this, and will be updating the configs for his kernel, so that the CONFIG_GPIO_SYSFS will be enabled in his kernel soon...

marcus

Is there any progress regarding GPIO under Android?

I'd like to use at least couple GPIO (at least output) pins, for example intended for LED flashlight and vibration motor. I need them to control slave devices, to re-init USB OTG connection or for hard reset if it hangs and doesn't response.


There is a android 7.0 beta image on the download page where GPIO is enabled, i have tried it a little and it works Smile

Good to know! Will try too, fortunately now there are images combined for LCD and HDMI ...
Could you share your experience "how-to" a bit and which exactly things were working well?
Thanks a lot in advance Skivholme!
d;-)
#18
ayufan enabled gpio on the droid kernel some time ago...

... you do need to understand the sysfs !
marcushh777    Cool

please join us for a chat @  irc.pine64.xyz:6667   or ssl  irc.pine64.xyz:6697

( I regret that I am not able to respond to personal messages;  let's meet on irc! )
#19
(03-06-2017, 10:54 AM)Workaholic Wrote:
(03-06-2017, 04:57 AM)Skivholme Wrote:
(01-17-2017, 04:06 PM)Workaholic Wrote:
(09-10-2016, 01:11 PM)MarkHaysHarris777 Wrote: I was reading in the sunxi manual for gpio access, and found that the kernel option CONFIG_GPIO_SYSFS must be enabled.  I checked my Android /sys/class/ folder and found that gpio is not there;  the kernel in my Android has not been anabled for CONFIG_GPIO_SYSFS.

It should be easy to enable this option, and frankly, it should be enabled by default.


edit:  PS  I spoke with ayufan about this, and will be updating the configs for his kernel, so that the CONFIG_GPIO_SYSFS will be enabled in his kernel soon...

marcus

Is there any progress regarding GPIO under Android?

I'd like to use at least couple GPIO (at least output) pins, for example intended for LED flashlight and vibration motor. I need them to control slave devices, to re-init USB OTG connection or for hard reset if it hangs and doesn't response.


There is a android 7.0 beta image on the download page where GPIO is enabled, i have tried it a little and it works Smile

Good to know! Will try too, fortunately now there are images combined for LCD and HDMI ...
Could you share your experience "how-to" a bit and which exactly things were working well?
Thanks a lot in advance Skivholme!

Sure,

First of you need to use the right gpio numbers, they can be calculated by the pin number, I found this page where the right gpis number is already calculated. http://joey.hazlett.us/pine64/pine64_pins.html
You need to be superuser to use the gpis, I dont know if you can chmod around this.

I then ran into some trouble for trying to use PL10, but in the IRC channel I was told not to use pins with other functions.

I startet using the gpio's from the shell.
$adb connect xxx.xxx.xxx.xxx
$adb shell

To use the gpio's you need to following command

Enable an gpio, in this example I use pin PH9 gpio233:
$echo 233 > /sys/class/gpio/export

Set direction (in or out)
$echo “out” > /sys/class/gpio/gpio233/direction

Set value HIGH or LOW (1 or 0)
$echo “1” > /sys/class/gpio/gpio233/value

Read value
$cat /sys/class/gpio/gpio233/value

Disable the gpio
$echo 233 > /sys/class/gpio/unexport


To use it from an android app I found this code:
https://gist.github.com/rosterloh/c4bd02bed8c5e7bd47c5

I haven’t figured out how to make a listener for when state changed yet. I tried to make a loop with a handler, and then I checked the state of 7 pins on each loop. But it was very slow, but if I didnt click the buttons to fast the app would notice it. I’m still new to android/java so chances are I’m doing something wrong Smile
#20
Congratulations; its a first step, and a fun experiment, nice job.
marcushh777    Cool

please join us for a chat @  irc.pine64.xyz:6667   or ssl  irc.pine64.xyz:6697

( I regret that I am not able to respond to personal messages;  let's meet on irc! )


Possibly Related Threads…
Thread Author Replies Views Last Post
  Android 6.0 Tablet and TV (release candidate, maintained) ayufan 228 426,876 12-29-2020, 01:13 AM
Last Post: firmwarefile
Shocked Remote for Android? liodra 18 32,760 12-23-2020, 06:11 AM
Last Post: Learnincurve
  Adding an accelerometer to Android modsbyus 11 18,575 11-02-2020, 08:12 PM
Last Post: Little_Johnny
  Android Things OS dqvsra 2 7,612 12-03-2019, 09:52 AM
Last Post: hangglider
  Is there another link for Android images? Maalth 3 7,747 10-10-2019, 07:57 AM
Last Post: tophneal
Question Android SDK Oreo NGC6691 2 6,178 07-15-2019, 08:29 PM
Last Post: dazza5000
  Putting Android 9 RockPro64 source into easier to manage repositories dazza5000 0 3,645 07-15-2019, 08:29 PM
Last Post: dazza5000
  Android 5.1.1 TV (old-stable, no longer maintained) ayufan 194 285,541 03-12-2019, 04:53 PM
Last Post: neosapien
  Issues with SD Card and Running Android Twistedx 0 3,835 02-26-2019, 11:58 AM
Last Post: Twistedx
  Android 7.1 (PINE A64(+)) pineadmin 59 115,601 02-10-2019, 07:44 PM
Last Post: mmmarcus

Forum Jump:


Users browsing this thread: 2 Guest(s)