
|
[argyllcms]
||
[Date Prev]
[01-2008 Date Index]
[Date Next]
||
[Thread Prev]
[01-2008 Thread Index]
[Thread Next]
[argyllcms] Re: Recognizing instruments with udev under Linux
- From: "C" <ml-argyllcms712@xxxxxxxxxx>
- To: C <ml-argyllcms712@xxxxxxxxxx>
- Date: Thu, 03 Jan 2008 22:39:26 -0800
Mr. Evens,
I went through getting ArgyllCMS working on Fedora 8 a couple of
weeks ago, and encountered some udev / device permissions problems
relating to accessing the USB Huey colorimeter instrument.
Perhaps the configurations / resources I'll relate may help with
your configuration.
I found a SRPM here that's in development for Fedora 8/9:
http://nim.fedorapeople.org/argyllcms/
For the most part that original SRPM worked well for my FC8 X86_64 case,
though I did have to modify the udev rules file to get the unbinding
of the HUEY device to work since the supplied version seemed to
be trying to unbind via an incorrect device name link. I've included
my revised version below; I don't know if the SRPM linked
has been subsequently improved / changed since I originally pulled it.
Even after I built and installed the SRPM I found that normal
users could not access the HUEY colorimeter USB device, even when
it was unbound from the control of the HID driver (which it
defaults to using due to the particulars of the HUEY device
falsely claiming to be a HID device when it isn't).
The permission modes (e.g. 666) of the device files didn't
seem to be relevant to my failure to be able to access the
USB colorimiter device even when it was functional for root
and had been given world read/write permissions. It seemed like the
policykit policy files granting permissive access weren't being
honored.
Nicolas Mailhot helpfully suggested that perhaps the
revised policy file to allow non-root users access to the
device might only be instituted after a reboot or some
comparable event which would trigger policy reevaluation.
I rebooted and indeed it started working for non-root
users fully automatcally from that point forward.
I'm not quite sure about the semantics of rule/policy
reevaluations and why it wasn't working for me without
rebooting or what would have made it do so. But rebooting
solved the last problem for me anyway.
q.v.
http://www.freelists.org/archives/argyllcms/12-2007/msg00201.html
http://www.freelists.org/archives/argyllcms/12-2007/msg00202.html
Here's the version of the udev rules that I'm using, FWIW,
it seems to work for me, and is not the same one I downloaded
in the above SRPM (as of the time I downloaded it). This causes
the HUEY to not be bound to the HID driver; other colorimeter devices
may not need any such unbinding, though other aspects of udev rules
such as permission bit settings et. al. may be relevant to them.
[root@localhost ~]# cat /etc/udev/rules.d/96-huey-hid-workaround.rules
# The Gretag-Macbeth Huey declares itself as an HID device but it isn't one
# According to Frederic Crozat <fcrozat@xxxxxxxxxxxx>
# Does not match the device name on my system and does not unbind it
from usbhid.
#SUBSYSTEM=="usb", ATTR{idVendor}=="0971", ATTR{idProduct}=="2005",
PROGRAM="/bin/sh -c 'echo -n %k /sys/bus/usb/drivers/usbhid/unbind >
/tmp/tmp'"
# Changing the regexp from %k to %k:1.0 makes the name match and
unbinding work.
#SUBSYSTEM=="usb", ATTR{idVendor}=="0971", ATTR{idProduct}=="2005",
PROGRAM="/bin/sh -c 'echo -n %k:1.0 /sys/bus/usb/drivers/usbhid/unbind >
/tmp/tmp'"
#SUBSYSTEM=="usb", ATTR{idVendor}=="0971", ATTR{idProduct}=="2005",
PROGRAM="/bin/sh -c 'echo -n %k:1.0 /sys/bus/usb/drivers/usbhid/unbind >
/tmp/tmp'"
# Works for unbinding.
SYSFS{idVendor}=="0971", SYSFS{idProduct}=="2005", MODE="0666",
PROGRAM="/bin/sh -c 'echo -n $id:1.0 >/sys/bus/usb/drivers/usbhid/unbind'"
#SYSFS{idVendor}=="0971", SYSFS{idProduct}=="2005", MODE="0666",
PROGRAM="/bin/sh -c 'echo /sys/bus/usb/drivers/usbhid/$id:1.0
/sys/bus/usb/drivers/usbhid/unbind > /tmp/tmp'"
Graeme Gill wrote:
Leonard Evens wrote:
In the file from the distribution, there is the statement
PROGRAM="/bin/sh -c 'K=%k; K=$${K#usbdev}; printf bus/usb/%%03i/%%03i
$${K%%%%.*} $${K#*.}'"
I think I can decipher it if I work hard enough, but some clues from an
expert would help. It seems to send something to the device presumably
to initialize it.
As I understand it (and I don't know a great deal about udev), this makes
sure that there is the appropriate device name entry for the
USB device, so that libusb can find it. It makes use of the
"printf" function of the shell to simply generate the appropriate
device name. I think on some distributions this is taken care of elsewhere
(probably distros that come with libusb), while the above
is needed for distributions that don't know about libusb.
P.S. The documentation says that one might need to run /sbin/udevrestart
for udev to reread the rules. The current command is supposed to be
"/sbin/udevcontrol reload_rules". But for some reason, I haven't got
that to work either. I've had to reboot. (I think I may have forgotten
to unplug the device first.)
It's hard to know. The above was taken from publicly available
information (ie. <http://reactivated.net/writing_udev_rules.html>)
plus man files on the system I was developing on. Since
udev seems to change all the time, and isn't well documented,
it's hard to know what a particular system needs.
Graeme Gill.
|

|