Gentoo Archives: gentoo-user

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

Replies

Subject Author
Re: [gentoo-user][SOLVED] hotplug permissions xsane Dave S <gentoo@××××××××.net>
Re: [gentoo-user] hotplug permissions xsane Zac Medico <zmedico@×××××.com>