Gentoo Archives: gentoo-user

From: Dave S <gentoo@××××××××.net>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user][SOLVED] hotplug permissions xsane
Date: Sun, 17 Jul 2005 18:09:20
Message-Id: 42DA9D99.9030000@pusspaws.net
In Reply to: [gentoo-user] hotplug permissions xsane by Dave S
1 Dave S wrote:
2
3 >Hello all,
4 >
5 >My scanner was working OK till I did a 'emerge -uDv world'. xsane now
6 >picks up my logitech webcam instead of my scanner and does not see my
7 >scanner.
8 >
9 >In root xsane sees both devices, asks me which one to use and all is OK,
10 >so its a permissions problem.
11 >
12 >
13 >
14 >
15 >vanda_comp dave # lsusb
16 >Bus 002 Device 001: ID 0000:0000
17 >Bus 001 Device 006: ID 046d:08b2 Logitech, Inc. QuickCam Pro 4000
18 >Bus 001 Device 005: ID 055f:0008 Mustek Systems, Inc. ScanExpress 1200
19 >CU Plus
20 >Bus 001 Device 004: ID 056a:0011 Wacom Co., Ltd Graphire 2
21 >Bus 001 Device 003: ID 04b8:0005 Seiko Epson Corp. Stylus Printer
22 >Bus 001 Device 002: ID 0409:0050 NEC Corp.
23 >Bus 001 Device 001: ID 0000:0000
24 >vanda_comp dave #
25 >
26 >dave@vanda_comp /proc/bus/usb/001 $ ls -al
27 >total 0
28 >dr-xr-xr-x 2 root root 0 Jul 17 13:15 .
29 >drwxr-xr-x 4 root root 0 Jul 17 13:15 ..
30 >-rw-r--r-- 1 root root 43 Jul 17 13:15 001
31 >-rw-r--r-- 1 root root 43 Jul 17 13:15 002
32 >-rw-r--r-- 1 root root 50 Jul 17 13:15 003
33 >-rw-r--r-- 1 root root 52 Jul 17 13:15 004
34 >-rw-r--r-- 1 root root 57 Jul 17 13:15 005
35 >-rw-r--r-- 1 root root 508 Jul 17 13:15 006
36 >dave@vanda_comp /proc/bus/usb/001 $
37 >
38 >
39 >
40 >
41 >
42 >Looking in hotplug I have stripped down the usermap to just my scanners
43 >entry to make sure it is seen - it matches 055f 0008.
44 >
45 >
46 >
47 >
48 >
49 >dave@vanda_comp /etc/hotplug/usb $ cat libsane.usermap
50 ># This file is part of sane-backends.
51 >#
52 ># The entries below are used to detect a USB scanner when it's plugged in
53 ># and then run the libusbscanner script to change the ownership and
54 ># permissions on the "device node" used by libusb.
55 >#
56 >
57 >.....
58 >
59 >#
60 >#
61 ># The following list already contains a lot of scanners. If your scanner
62 ># isn't mentioned there, add it as explained above and mail the entry to
63 ># the sane-devel mailing list.
64 >#
65 ># Hewlett-Packard|ScanJet 4100C
66 ># Mustek Systems Inc.|ScanExpress 1200 CU Plus
67 >libusbscanner 0x0003 0x055f 0x0008 0x0000
68 >0x0000 0x00 0x00 0x00
69 >0x00 0x00 0x00 0x00000000
70 >dave@vanda_comp /etc/hotplug/usb $
71 >
72 >
73 >
74 >
75 >
76 >dave@vanda_comp /etc/hotplug/usb $ cat libusbscanner
77 >#!/bin/sh
78 >
79 ># This file is part of sane-backends.
80 >#
81 ># This script changes the permissions and ownership of a USB device under
82 ># /proc/bus/usb to grant access to this device to users in the scanner
83 >group.
84 >#
85 ># Ownership is set to root:scanner, permissions are set to 0660.
86 >#
87 ># Arguments :
88 ># -----------
89 ># ACTION=[add|remove]
90 ># DEVICE=/proc/bus/usb/BBB/DDD
91 ># TYPE=usb
92 >
93 ># latest hotplug doesn't set DEVICE on 2.6.x kernels
94 >if [ -z "$DEVICE" ] ; then
95 > IF=`echo $DEVPATH | sed 's/\(bus\/usb\/devices\/\)\(.*\)-\(.*\)/\2/'`
96 > DEV=`echo $DEVPATH | sed 's/\(bus\/usb\/devices\/\)\(.*\)-\(.*\)/\3/'`
97 > DEV=`expr $DEV + 1`
98 > DEVICE=`printf '/proc/bus/usb/%.03d/%.03d' $IF $DEV`
99 >fi
100 >
101 >
102 >if [ -z "${DEVICE}" ] ; then
103 > IF=$(echo ${DEVPATH} | sed
104 >'s:\(bus/usb/devices/\)\(.*\)-\(.*\):\2:')
105 > if [ -r /sys/${DEVPATH}/devnum ]; then
106 > DEV=$(cat /sys/${DEVPATH}/devnum)
107 > else
108 > DEV=1 # you'll have to adjust this manually for kernel < 2.6.6
109 > fi
110 > DEVICE=$(printf '/proc/bus/usb/%.03d/%.03d' ${IF} ${DEV})
111 >fi
112 >
113 >if [ "$ACTION" = "add" -a "$TYPE" = "usb" ]; then
114 > chown root:scanner "$DEVICE"
115 > chmod 0660 "$DEVICE"
116 >fi
117 >
118 >
119 ># That's an insecure but simple alternative
120 ># Everyone has access to the scanner
121 >
122 ># if [ "$ACTION" = "add" -a "$TYPE" = "usb" ]; then
123 ># chmod 0666 "$DEVICE"
124 ># fi
125 >dave@vanda_comp /etc/hotplug/usb $
126 >
127 >
128 >
129 >
130 >Should set my scanner to the scanner group but does not. If I unplug my
131 >scanner & re-plug it in I get ...
132 >
133 >
134 >
135 >
136 >
137 >vanda_comp dave # lsusb
138 >Bus 002 Device 001: ID 0000:0000
139 >Bus 001 Device 007: ID 055f:0008 Mustek Systems, Inc. ScanExpress 1200
140 >CU Plus
141 >Bus 001 Device 006: ID 046d:08b2 Logitech, Inc. QuickCam Pro 4000
142 >Bus 001 Device 004: ID 056a:0011 Wacom Co., Ltd Graphire 2
143 >Bus 001 Device 003: ID 04b8:0005 Seiko Epson Corp. Stylus Printer
144 >Bus 001 Device 002: ID 0409:0050 NEC Corp.
145 >Bus 001 Device 001: ID 0000:0000
146 >vanda_comp dave #
147 >
148 >dave@vanda_comp /proc/bus/usb/001 $ ls -al
149 >total 0
150 >dr-xr-xr-x 2 root root 0 Jul 17 13:15 .
151 >drwxr-xr-x 4 root root 0 Jul 17 13:15 ..
152 >-rw-r--r-- 1 root root 43 Jul 17 13:15 001
153 >-rw-r--r-- 1 root root 43 Jul 17 13:15 002
154 >-rw-r--r-- 1 root root 50 Jul 17 13:15 003
155 >-rw-r--r-- 1 root root 52 Jul 17 13:15 004
156 >-rw-r--r-- 1 root root 508 Jul 17 13:15 006
157 >-rw-rw---- 1 root scanner 57 Jul 17 13:55 007
158 >dave@vanda_comp /proc/bus/usb/001 $
159 >
160 >
161 >
162 >
163 >
164 >Everything works AOK and I can scan. However unplugging & plugging in
165 >scanners every time the machine starts is a pain.
166 >
167 >Hotplug is started on bootup ...
168 >
169 >
170 >
171 >
172 >
173 >vanda_comp 001 # rc-update add hotplug default
174 > * hotplug already installed in runlevel default; skipping
175 >vanda_comp 001 #
176 >
177 >
178 >
179 >
180 >but does not seem to setup my scanner. I also found that just ...
181 >
182 >
183 >
184 >
185 >vanda_comp 001 # /etc/init.d/hotplug restart
186 >vanda_comp 001 #
187 >
188 >
189 >
190 >
191 >does not setup my scanner, I do have to unplug & plug it in.
192 >
193 >Any suggestions as to where to go from here ?
194 >
195 >Dave
196 >
197 >
198 >
199 >
200
201 emerge coldplug
202 rc-update add coldplug default
203
204 patch coldplug api bug 83738
205
206 re-boot & it works :-)
207
208 Dave
209 --
210 gentoo-user@g.o mailing list