Android-SD - How to run script at boot or otherwise chmod 666 /dev/ttyS[67]

Started by kbro, March 19, 2014, 02:59:24 PM

Previous topic - Next topic

kbro

I'm running Android from an SD card on an A20-OlimeXino-Micro.  I have a non-root app that wants to read /dev/ttyS6 or S7, but the devices are owned by root and the file permissions are 600.  I therefore need to run "chmod 666 /dev/ttyS[67]" as root every time the board boots, or else find a way to get the file permission change to persist through a reboot.  How do I do that?

I was hoping to put some additional commands in an "init.sh" script, but looking at /init.rc there's no "service system_init" or "service initrdscript" that I can hand this off, and I can't edit /init.rc without rebuilding the initramfs, which I don't have time to learn how do right now.

Can anyone help?  Thanks!

sickmind

Why don't you just put it in /etc/rc.local?
Linux is usually executing everything there upon reboot, haven't tried with this image thought.

dave-at-axon

Edit the init.sun7i.rc script and put these lines in the "on boot" section. (Use Droidexplorer to copy to your computer or use ADB to pull it, make the changes and push it back)


# Allow user access to UART6 and 7

    chmod 0666 /dev/ttyS6
    chmod 0666 /dev/ttyS7


I also have I2C and always used GPIO done in the same way.

dave-at-axon

Quote from: sickmind on March 21, 2014, 07:05:17 PM
Why don't you just put it in /etc/rc.local?
Linux is usually executing everything there upon reboot, haven't tried with this image thought.

There is no /etc/rc.local with Android linux  :)

egrojoz

Dave,

How I can get the file permission change "chmod 0666 /dev/ttyS7" in the 'on boot' section of init.sun7i.rc script persist through a reboot ?

Thanks,

dave-at-axon

It should automatically do this. I reboot the system here if there is a permanent lockout or the watchdog times out and serial works each time.

Have you modified the init.sun7i.rc script as part of the build or are you trying to edit this locally and then reboot?

Either way, it should remain.