Root permissions with displayotronhat


#1

I’ve got a displayotron hat working, but one must have root access to talk to the device. I feel like I should be able to find information about this, and I did try “sudo chmod 666 /dev/spidev0.0” but that doesn’t work.

How can I set the display contents without root access?


#2

What OS are you running? What do you see if you run lsb_release -a on the terminal.

There may be an SPI group that your user needs to be added to.


#3

Thanks for getting back so quickly. Here’s what I found:

jbf@gardenhousepi:~ $ lsb_release -a
No LSB modules are available.
Distributor ID:	Raspbian
Description:	Raspbian GNU/Linux 9.4 (stretch)
Release:	9.4
Codename:	stretch
jbf@gardenhousepi:~ $ groups jbf
jbf : jbf
jbf@gardenhousepi:~ $ cat /etc/group | grep spi
spi:x:999:pi

I added my username (jbf) to the /etc/group, and tried it again, but I still get a permission error. Is it a different group that I should use? …Okay, I did log in as user pi and I can see now that it works. I should be able to figure out what the difference is. Thanks!


#4

That’s curious- everything should work out of the box on Raspbian Stretch.

groups pi on one of my setups lists the spi group.

What did you see if you ls -hal /dev/spi* are the spidev0.0 devices correctly owned by root:spi?


#5

The problem is because I don’t use the user “pi”. I gave my username access to the same groups as pi, which worked, but only after a reboot. Thanks for the help! Now the kids will be able to see the water temperature before they get into our little pool.


#6

Ooh, I totally missed that you were using an alternate user!