Making udev rule to set usb device permissions

From Finninday
Revision as of 08:00, 20 December 2010 by Rday (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

I have a USB temperature probe that defaults to 600 permission and ownership by root. I'd like everyone (especially my non-root script) to be able to read this device, so I set it to 644 permission. But something keeps switching the permission back. I assume this something is udev. To make my permission setting stick, I told udev to honor it by creating this file:

root@weasel:/etc/udev/rules.d# pwd;ls
/etc/udev/rules.d
45-libmtp7.rules	70-persistent-net.rules  README
70-persistent-cd.rules	99-vernier.rules
root@weasel:/etc/udev/rules.d# cat 99-vernier.rules 
# Vernier EasyTemp/Go!Temp
ATTR{idVendor}=="08f7", ATTR{idProduct}=="0002", MODE="644"

I guessed at the syntax by peeking at the other rules files in this directory.

My previous attempt at a fix for this was to add a "chmod" to /etc/rc.local, but udev is smarter than that, since it changes the permission of my usb device at times other than reboot. We'll see if this udev rule is sufficient. If not, I'll have to start reading more about udev.