Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have an app that reads input from 4 (four) mice that are plugged in via USB in addition to the built-in touchpad. This is no problem for Ubuntu 9.10: hald notices the new devices and udev's them brand new entries called /dev/input/mouse4 ... mouse7.

My app runs as a normal user app. The files in /dev belong to root and aren't readable to anyone else.

I don't have a problem doing chmod a+r mouse? once, but the devices come and go with every reboot and every time the dang rodents are plugged in or out.

Can someone please tell me a script or something to manipulate so my chmod happens automagically?

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

You can read up on Writing udev rules. I've never dealt with that stuff myself, so I couldn't give you an outright solution right now, but I'm certain it's in that document. Sorry about the RTFM solution. Hopefully someone else has more experience with that stuff than I.

share|improve this answer
    
Hey, that's fine! Thanks for the pointer, I think I'll be fine from here on. –  Carl Smotricz Nov 16 '09 at 20:00
add comment

In case anyone else has the same problem, here's what I discovered:

Being a debian, Ubuntu keeps most of its rules in /lib/udev/rules.d. The directory /etc/udev/rules.d is only for manually introduced exceptions; they will apparently override the settings in /lib/udev/rules.d.

Mice are among the basic stuff handled by udev, I wasn't surprised to find a handful of settings for them in lib/udev/rules.d/50-udev-default.rules. The paragraph of interest to me was:

# input
KERNEL=="mouse*|mice|event*",   MODE="0640"
KERNEL=="ts[0-9]*|uinput",      MODE="0640"
KERNEL=="js[0-9]*",             MODE="0644"

I willfully ignored the warning at the top of the file:

# do not edit this file, it will be overwritten on update

as I intend for this change to be temporary anyway.

I changed the first "640" to "644", unplugged and re-plugged two of my mice. And presto,

crw-r----- 1 root root 13, 32 2009-11-16 19:14 mouse0
crw-r----- 1 root root 13, 33 2009-11-16 19:14 mouse1
crw-r--r-- 1 root root 13, 34 2009-11-16 21:58 mouse2
crw-r--r-- 1 root root 13, 35 2009-11-16 21:58 mouse3

mouse2 and mouse3 became world-readable. Mission accomplished!

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.