[argyllcms] Re: Argyll CMS in Fedora (and Mandriva)

  • From: "C" <ml-argyllcms712@xxxxxxxxxx>
  • To: argyllcms@xxxxxxxxxxxxx
  • Date: Sat, 22 Dec 2007 02:24:02 -0800

Thanks for the helpful replies, Mrs. Mailhot and Gill.

The PID+VID is correct AKAIK, and here's more information on the setup my system is generating. I *know* I've seen a different (it looked like it'd be better/right) regexp for the unbinding rule *somewhere* though
haven't tried it yet; I'll look for my bookmark and post that in a bit.

It's possible I was just running a slightly stale SRPM with
an old version rule regexp or something.

[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>
#SUBSYSTEM=="usb", ATTR{idVendor}=="0971", ATTR{idProduct}=="2005", PROGRAM="/bin/sh -c 'echo -n %k >/sys/bus/usb/drivers/usbhid/unbind'"

SYSFS{idVendor}=="0971", SYSFS{idProduct}=="2005", MODE="0666", PROGRAM="/bin/sh -c 'echo -n %k >/sys/bus/usb/drivers/usbhid/unbind'"

/* neither of those seem to work for unbinding or generating non-root useful permissions */

dmesg | tail when the Huey is attached.
usb 7-2.4.1.4: new low speed USB device using uhci_hcd and address 56
usb 7-2.4.1.4: configuration #1 chosen from 1 choice
hiddev97: USB HID v1.00 Device [HID 0971:2005] on usb-0000:00:1d.1-2.4.1.4


[root@localhost ~]# ls -lR /sys/bus/usb/drivers/usbhid/
/sys/bus/usb/drivers/usbhid/:
total 0
lrwxrwxrwx 1 root root 0 2007-12-22 01:48 7-2.1:1.0 -> ../../../../devices/pci0000:00/0000:00:1d.1/usb7/7-2/7-2.1/7-2.1:1.0 lrwxrwxrwx 1 root root 0 2007-12-22 01:48 7-2.2.1:1.0 -> ../../../../devices/pci0000:00/0000:00:1d.1/usb7/7-2/7-2.2/7-2.2.1/7-2.2.1:1.0 lrwxrwxrwx 1 root root 0 2007-12-22 01:48 7-2.2.1:1.1 -> ../../../../devices/pci0000:00/0000:00:1d.1/usb7/7-2/7-2.2/7-2.2.1/7-2.2.1:1.1 lrwxrwxrwx 1 root root 0 2007-12-22 01:48 7-2.3:1.0 -> ../../../../devices/pci0000:00/0000:00:1d.1/usb7/7-2/7-2.3/7-2.3:1.0 lrwxrwxrwx 1 root root 0 2007-12-22 01:48 7-2.4.1.4:1.0 -> ../../../../devices/pci0000:00/0000:00:1d.1/usb7/7-2/7-2.4/7-2.4.1/7-2.4.1.4/7-2.4.1.4:1.0
--w------- 1 root root 4096 2007-12-20 01:12 bind
lrwxrwxrwx 1 root root 0 2007-12-20 01:12 module -> ../../../../module/usbhid
--w------- 1 root root 4096 2007-12-20 01:12 new_id
--w------- 1 root root    0 2007-12-22 01:30 unbind


This is a working unbind command I manually came up with when the %k didn't seem to work, whatever regexp in the rules file
would generate "7-2.4.1.4:1.0" is the one I was looking for
and may have seen somewhere; "%k" doesn't seem to be it.

echo -n "7-2.4.1.4:1.0"  > /sys/bus/usb/drivers/usbhid/unbind

[root@localhost ~]# dispread --help
Read a Display, Version 0.70 (BETA 7)
Author: Graeme W. Gill, licensed under the GPL Version 3
Diagnostic: Usage requested
usage: dispread [options] outfile
 -v              Verbose mode
 -display displayname Choose X11 display name
-d n[,m] Choose the display n from the following list (default 1) Optionally choose different display m for VideoLUT access
    1 = 'Unknown at 0, 0, width 1920, height 1200'
-c listno Set communication port from the following list (default 1)
    1 = 'usb:/bus0/dev56 (GretagMacbeth Huey)'
    2 = '/dev/ttyS0'
    3 = '/dev/ttyS1'
    4 = '/dev/ttyS2'
    5 = '/dev/ttyS3'
 -y c|l               Display type, c = CRT, l = LCD
 -k file.cal          Apply display calibration file while reading
 -s                   Save spectral information (default don't save)
 -p ho,vo,ss          Position test window and scale it
ho,vi: 0.0 = left/top, 0.5 = center, 1.0 = right/bottom etc.
                      ss: 0.5 = half, 1.0 = normal, 2.0 = double etc.
 -n                   Don't set override redirect on test window
 -K                   Run instrument calibration first (used rarely)
 -N                   Disable auto calibration of instrument
 -H                   Use high resolution spectrum mode (if available)
 -D [level]           Print debug diagnostics to stderr
 outfile              Base name for input[ti1]/output[ti3] file


Unless I manually unbind it, this happens:

[root@localhost ~]# dispcal -v -yl test
Setting up the instrument
dispcal: Error - Configuring USB port 'usb:/bus0/dev56 (GretagMacbeth Huey)' to 1 failed with -16 (could not set config 1: Device or resource busy)


usb 7-2.4.1.4: new low speed USB device using uhci_hcd and address 56
usb 7-2.4.1.4: configuration #1 chosen from 1 choice
hiddev97: USB HID v1.00 Device [HID 0971:2005] on usb-0000:00:1d.1-2.4.1.4
usb 7-2.4.1.4: usbfs: interface 0 claimed by usbhid while 'dispcal' sets config #1


Admittedly my /etc/udev/rules.d/96-huey-hid-workaround.rules
is *NOT* the one in Mr. Mailhot's SRPM, though the regexp %k in there
didn't seem to be doing the unbinding so that's why I changed it.
I could have broken something, I suppose, confusing a SELINUX / permissions error for an unbinding related one yesterday, if
so, I apologize for the confusion.  I'd be glad to go back and test
it.

Ok I just changed the rulse file:

[root@localhost rules.d]# 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>
#SUBSYSTEM=="usb", ATTR{idVendor}=="0971", ATTR{idProduct}=="2005", PROGRAM="/bin/sh -c 'echo -n %k >/sys/bus/usb/drivers/usbhid/unbind'"

SYSFS{idVendor}=="0971", SYSFS{idProduct}=="2005", MODE="0666", PROGRAM="/bin/sh -c 'echo -n %k >/sys/bus/usb/drivers/usbhid/unbind'"

SYSFS{idVendor}=="0971", SYSFS{idProduct}=="2005", MODE="0666", PROGRAM="/bin/sh -c 'echo -n %k >/tmp/huey.unbind.command.regexp.out'"

[root@localhost rules.d]# cat /tmp/huey.unbind.command.regexp.out
usbdev7.57_ep81

So that's what the regexp %k is generating on my system.


Now I manually unbind it, and it works as root:

[root@localhost rules.d]# echo -n '7-2.4.1.4:1.0' > /sys/bus/usb/drivers/usbhid/unbind
[root@localhost rules.d]# dispcal -v -yl test
Setting up the instrument
Place instrument on test window.
Hit Esc, ^C or Q to give up, any other key to continue:
The instrument can be removed from the screen.
dispcal: Error - dispread failed with 'User Aborted'

[root@localhost rules.d]# uname -a
Linux localhost.localdomain 2.6.23.8-63.fc8 #1 SMP Wed Nov 21 17:56:40 EST 2007 x86_64 x86_64 x86_64 GNU/Linux
[root@localhost rules.d]#


I had been playing with some of the permissions on the USB devices and
had temporarily made some ArgyllCMS programs SUID root.

Now I have taken off the SUID bits I'd added, though am still
using those non-default rules and possibly some persisting non-default
usb permissions modes and it's working also for a non-root user running
dispcal.  So I'll have to go back and double check to see if anything
I did locally made that work or if the PolicyKit / etc. stuff is working
better than I thought it was yesterday.

Hmm looks like the permissions changes I had tried in the past
were /dev/usbdevXXXXXX and those seem to be irrelevant and
the MODE 666 changes I did to the local udev rules file seem
to be having the intended effect automatically via that rules file:

crw-rw-rw- 1 root root 251, 29 2007-12-22 01:55 /dev/usbdev7.57_ep00
crw-rw-rw- 1 root root 251, 30 2007-12-22 02:05 /dev/usbdev7.57_ep81

...and when I plug it into a different hub port, doing nothing else manually besides this [root@localhost rules.d]# echo -n '7-2.4.1.3:1.0' > /sys/bus/usb/drivers/usbhid/unbind

I get these permissions (q.v. my local mods. to the rules file):
crw-rw-rw- 1 root root 251, 29 2007-12-22 02:15 /dev/usbdev7.58_ep00
crw-rw-rw- 1 root root 251, 30 2007-12-22 02:15 /dev/usbdev7.58_ep81

...and dispcal works for a non-root user.


Any code in ArgyllCMS using libusb that's intended to "steal"
the device from the HID driver doesn't seem to be working,
though keep in mind I'm using the SRPM from Nicolas Mailhot's site
(as of a couple of days ago) as a code base, so that possibly
doesn't use the same libusb et. al. as the original Graeme Gill
source package if that's relevant.


Thanks again to all for all the good efforts and tools
in ArgyllCMS and the efforts to get it packaged/ported
to Fedora!





Nicolas Mailhot wrote:
Le vendredi 21 décembre 2007 à 22:49 -0800, C. a écrit :
Thanks to Graeme Gill, Nicolas Mailhot, et. al.

I had just started using ArgyllCMS and was attempting to use it with the Huey 
under
Fedora 8 X86-64 when I came across the SRPM derived from the
packaging efforts of Nicolas Mailhot et. al.

The regexp ...did not seem to correctly match ...

Also even after I had done that, I was unable to access the device as a normal
user ...
so I think there must be some other problems with the PolicyKit / SELINUX 
configurations
in the other files I mentioned.

If it didn't work that's probably because you have a device with
different USB ids than the one known for other Hueys. Please post the
result of /sbin/lsusb with your device plugged in the computer



Other related posts: