brata-hsdc / brata.station

Automatically exported from code.google.com/p/brata.station
Apache License 2.0
0 stars 0 forks source link

Station application needs sudo for hardware access #10

Open jawaad-ahmad opened 9 years ago

jawaad-ahmad commented 9 years ago

Currently, accessing the GPIO pins requires root privileges, meaning the entire station application needs to run with elevated privileges.

It would be nice if this was eventually reworked to be done the "right" way so that the entire application wouldn't need to run with sudo.

@ellerychan provided the following for CTS:

I also did this to avoid having to run the display programs with sudo all the time:

sudo chmod o+rw /dev/i2c-1

My previous suggestion to change the permission on the device (sudo chmod o+rw /dev/i2c-1) doesn't get preserved across reboots. However, an easier solution is to add the user account to the same group as the device, since the permissions are rw-rw----.

So this command does the trick to give access to the display without sudo:

gpasswd -a i2c

Tried this and updated the GUB; however, it looks like pibrella is also being loaded, so need to address that as well. Found these but haven't had a chance yet to try them out:

Is there documentation anywhere telling which pins are used by the Pibrella?

Typo. The command to add the user (pi) to the i2c group should be:

sudo gpasswd -a pi i2c

Follow with a reboot to get it to take effect.

sudo reboot

This continues brata-hsdc/brata#13.