Tinker Board Forum

Full Version: wiringPi for Android
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6
Hi Lobo

Thank you so much for the libraries. I tried using it for gpio and it works great. However, while trying to use it for serial communication, I am facing some issues.

While doing a serialOpen(), I always get '-1' as the return value, irrespective of which file I pass - /dev/ttys0, /dev/ttys1, /dev/ttyAMA0, etc.

But when I open a terminal and use this command:

echo -ne '\033[2J' > /dev/ttyS1

The data is transmitted over serial port on pins 8 and 10 with a baud rate of 9600. Is there something that has to be done and I am not doing it? Please let me know. Thanks in advance Smile
Hi viveKB,

I tried now to integrate the serial part into an app and it works so far. I think you missed to chmod the serial port:
Code:
chmod 666 /dev/ttyS1
If you need this at start, I see the only working solution so far to extract the boot.img and to modify the ueventd.rk30board.rc. Please see my thread libGPS https://tinkerboarding.co.uk/forum/thread-671.html for details.
Hi,
I may be new here but I come from slow world of RPi and Android Things.
I'll get to the point straight away.
I followed all instructions to the letter about compiling and deploying these shared libraries.
I included them into my Android app and as far as I can see, wpi_android is loaded by the system.
However, when i invoke any method or function, my app just ends up in an endless loop.
This might seem a bit vague, but have you got any clues or have you encountered this before?
How can I check if /dev/mem can be accessed?
I see no /dev/gpiomem present on filesystem but I am using 7.1.2 kernel which should have that implemented by default since April 2018.
Any help would be greatly appriciated, thanks!

EDIT:
I stand corrected, with a few corrections, your work actually does work. My addition of I2C is failing for some reason.
Ok, I was just looking into this. Maybe you need to chmod 666 the i2c device, if not you probably need su in your app.
I think you should continue looking into I2C support. I'm sort of stuck at code level now, providing all WiringPi I2C functions through JNI.
Regarding su, I cross compiled i2c-tools for Android and i2cdetect works without root.

Code:
rk3288:/ # i2cdetect -y 1                                                                                                                                                              
    0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- 13 -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- 39 -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: 50 -- -- -- -- -- -- 57 -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- UU -- -- -- -- -- -- --
70: -- -- -- -- -- -- 76 77  

It is correct data on bus 1, although I have no idea why 0x68 is reserved. That was my DS3231 RTC.
(01-03-2019, 05:30 PM)lobo Wrote: [ -> ]Ok, I was just looking into this. Maybe you need to chmod 666 the i2c device, if not you probably need su in your app.

You were right, it seems. After I chmod 666 /dev/i2c-1 app doesn't crash and I can read out a test value of a chip and verify it actually works.
How can I make this permission change permanent and persistent after reboot?
You can look here into my post: https://tinkerboarding.co.uk/forum/threa...ml#pid2585
Note that the SuperUser alternative is no option on Android Nougat, as no one since now was able to install it as on Marshmallow. To root the Android Nougat, the only working solution so far I know is: https://tinkerboarding.co.uk/forum/thread-2026.html . So it seems that you need to go the way to modify and flash the boot.img. If you consider to install Magisk, you can can take a look at the module 'Init.d Enabler'.
(01-04-2019, 09:00 AM)knobtviker Wrote: [ -> ]How can I make this permission change permanent and persistent after reboot?
Writing an udev rule
I have updated the repository, because old version don't work with Android 7.1.2.
https://github.com/joerg65/wiringTinker_Android
Good News! Thanks
Pages: 1 2 3 4 5 6