ccwienk / temper

Simple python for accessing TEMPer USB thermometers
MIT License
35 stars 27 forks source link

Only root can run it? #25

Open knfevg opened 1 year ago

knfevg commented 1 year ago

Sorry for a total newbee question but why do I need SU rights to run this script? Without SUDO i get an permission denied error

biochem-fan commented 8 months ago

You need a udev rule.

If a user called USERNAME needs access, make a file called /etc/udev/rules.d/temper.rules with the content below:

SUBSYSTEM=="hidraw", ATTRS{idVendor}=="3553", ATTRS{idProduct}=="a001", MODE="0600", OWNER="USERNAME"

idVendor and idProduct can be looked up by temper.py -l.

Then reload and apply the rule:

sudo udevadm control --reload-rules
sudo udevadm trigger

Of course you can use a group level access control (MODE="0660", GROUP="GROUPNAME") instead.

The above worked for me but other devices that use serial access might need a different SUBSYSTEM string.