This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Thread Rating:
  • 2 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
wiringPi for Android
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:
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 for details.
[-] The following 1 user Likes lobo's post:
  • vivekb
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!

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.
[-] The following 1 user Likes lobo's post:
  • knobtviker
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.

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:
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: . 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
Light blue words might be a link. Have you try to click on them? Big Grin
I have updated the repository, because old version don't work with Android 7.1.2.
Good News! Thanks
I have to use gbwhatsapp for android here and I think this is the best app because this app features so nice and I prefer to use this app.

Forum Jump:

Users browsing this thread: 1 Guest(s)