View previous topic :: View next topic |
Author |
Message |
petrjanda Veteran
Joined: 05 Sep 2003 Posts: 1557 Location: Brno, Czech Republic
|
Posted: Wed May 12, 2004 2:41 pm Post subject: Scanning works only as root |
|
|
Ok, I got my usb scanner to work first time ever in Linux using sane-backends. I also installed xsane frontend, but i can only run it when su'd or logged in as root. How do I fixed that? I looked at man usb-sane, but it was of a little help for me.
Also now I get an error during boot up while theres "usb hotplugging" being done. (i use udev).
Code: |
chown: cannot access "/proc/bus/usb/002/004" No such file or directory
chmod: cannot access "/proc/bus/usb/002/004" No such file or directory
|
Thank you. _________________ There is, a not-born, a not-become, a not-made, a not-compounded. If that unborn, not-become, not-made, not-compounded were not, there would be no escape from this here that is born, become, made and compounded. - Gautama Siddharta |
|
Back to top |
|
|
adaptr Watchman
Joined: 06 Oct 2002 Posts: 6730 Location: Rotterdam, Netherlands
|
Posted: Wed May 12, 2004 2:50 pm Post subject: |
|
|
What are the permissions along those paths ? _________________ >>> emerge (3 of 7) mcse/70-293 to /
Essential tools: gentoolkit eix profuse screen |
|
Back to top |
|
|
neysx Retired Dev
Joined: 27 Jan 2003 Posts: 795
|
Posted: Wed May 12, 2004 3:36 pm Post subject: Re: Scanning works only as root |
|
|
petrjanda wrote: | Ok, I got my usb scanner to work first time ever in Linux using sane-backends. I also installed xsane frontend, but i can only run it when su'd or logged in as root. How do I fixed that? I looked at man usb-sane, but it was of a little help for me.
Also now I get an error during boot up while theres "usb hotplugging" being done. (i use udev).
Code: |
chown: cannot access "/proc/bus/usb/002/004" No such file or directory
chmod: cannot access "/proc/bus/usb/002/004" No such file or directory
|
Thank you. |
Maybe this thread can help you. |
|
Back to top |
|
|
petrjanda Veteran
Joined: 05 Sep 2003 Posts: 1557 Location: Brno, Czech Republic
|
Posted: Wed May 12, 2004 10:15 pm Post subject: |
|
|
adaptr wrote: | What are the permissions along those paths ? |
The thing is, those paths don't even exist
Theres no such thing as /proc/bus/usb/002/004, the highest number is 002/003 which is the scanner. _________________ There is, a not-born, a not-become, a not-made, a not-compounded. If that unborn, not-become, not-made, not-compounded were not, there would be no escape from this here that is born, become, made and compounded. - Gautama Siddharta |
|
Back to top |
|
|
neysx Retired Dev
Joined: 27 Jan 2003 Posts: 795
|
Posted: Wed May 12, 2004 11:15 pm Post subject: |
|
|
How about the following /etc/hotplug/usb/libusbscanner that comes with the latest sane-backends (1.0.14-r3)
Code: | #!/bin/sh
# This file is part of sane-backends.
#
# This script changes the permissions and ownership of a USB device under
# /proc/bus/usb to grant access to this device to users in the scanner group.
#
# Ownership is set to root:scanner, permissions are set to 0660.
#
# Arguments :
# -----------
# ACTION=[add|remove]
# DEVICE=/proc/bus/usb/BBB/DDD
# TYPE=usb
if [ -z "$DEVICE" ] ; then
IF=$(echo $DEVPATH | sed 's:\(bus/usb/devices/\)\(.*\)-\(.*\):\2:')
DEV=$(echo $DEVPATH | sed 's:\(bus/usb/devices/\)\(.*\)-\(.*\):\3:')
DEV=$(expr $DEV + 1)
DEVICE=$(printf '/proc/bus/usb/%.03d/%.03d' $IF $DEV)
fi
if [ "$ACTION" = "add" -a "$TYPE" = "usb" ]; then
chown root:scanner "$DEVICE"
chmod 0660 "$DEVICE"
fi
# That's an insecure but simple alternative
# Everyone has access to the scanner
# if [ "$ACTION" = "add" -a "$TYPE" = "usb" ]; then
# chmod 0666 "$DEVICE"
# fi |
I am not using udev so I can't try with your setup. Sorry.
Hth. |
|
Back to top |
|
|
petrjanda Veteran
Joined: 05 Sep 2003 Posts: 1557 Location: Brno, Czech Republic
|
Posted: Thu May 13, 2004 6:59 am Post subject: |
|
|
Ive read the script, its same as the one you posted, but I can see a resolution in it. The question is, why is hotplug trying to access files 002/004 when they dont exist, clearly there is no device on it. _________________ There is, a not-born, a not-become, a not-made, a not-compounded. If that unborn, not-become, not-made, not-compounded were not, there would be no escape from this here that is born, become, made and compounded. - Gautama Siddharta |
|
Back to top |
|
|
neysx Retired Dev
Joined: 27 Jan 2003 Posts: 795
|
Posted: Thu May 13, 2004 8:58 am Post subject: |
|
|
The script above is indeed a verbatim copy of the one included in the latest sane-backends. I did not write it.
Could it be that Code: | DEV=$(expr $DEV + 1) | should have been Code: | DEV=$(expr $DEV - 1) | in your case, or in all cases? In your case at least, it looks very much like 004 should become 003, not 005. My guess is this check (-z) has been added for udev systems. All it does is increase the device number when /proc/bus/usb/BBB/DDD does not exist. Decreasing DDD should solve your problem. If it does, could you please file a bug on bugs.gentoo.org to let our devs know about this issue? Thanks.
Hth |
|
Back to top |
|
|
petrjanda Veteran
Joined: 05 Sep 2003 Posts: 1557 Location: Brno, Czech Republic
|
Posted: Thu May 13, 2004 9:21 am Post subject: |
|
|
neysx wrote: | The script above is indeed a verbatim copy of the one included in the latest sane-backends. I did not write it.
Could it be that Code: | DEV=$(expr $DEV + 1) | should have been Code: | DEV=$(expr $DEV - 1) | in your case, or in all cases? In your case at least, it looks very much like 004 should become 003, not 005. My guess is this check (-z) has been added for udev systems. All it does is increase the device number when /proc/bus/usb/BBB/DDD does not exist. Decreasing DDD should solve your problem. If it does, could you please file a bug on bugs.gentoo.org to let our devs know about this issue? Thanks.
Hth |
Well i temporarily solved it by commenting out everything but
Code: |
if [ -z "$DEVICE" ] ; then
IF=$(echo $DEVPATH | sed 's:\(bus/usb/devices/\)\(.*\)-\(.*\):\2:')
DEV=$(echo $DEVPATH | sed 's:\(bus/usb/devices/\)\(.*\)-\(.*\):\3:')
DEV=$(expr $DEV + 1)
DEVICE=$(printf '/proc/bus/usb/%.03d/%.03d' $IF $DEV)
fi
|
and everything still works.
I'll try to do as you have told me to do now and come and post results. _________________ There is, a not-born, a not-become, a not-made, a not-compounded. If that unborn, not-become, not-made, not-compounded were not, there would be no escape from this here that is born, become, made and compounded. - Gautama Siddharta |
|
Back to top |
|
|
petrjanda Veteran
Joined: 05 Sep 2003 Posts: 1557 Location: Brno, Czech Republic
|
Posted: Thu May 13, 2004 9:25 am Post subject: |
|
|
Yes, changing the plus sign into minus solved it as well. Thanks a lot!
Im gonna fill the bug report now. _________________ There is, a not-born, a not-become, a not-made, a not-compounded. If that unborn, not-become, not-made, not-compounded were not, there would be no escape from this here that is born, become, made and compounded. - Gautama Siddharta |
|
Back to top |
|
|
neysx Retired Dev
Joined: 27 Jan 2003 Posts: 795
|
Posted: Thu May 13, 2004 9:27 am Post subject: |
|
|
Glad I could help.
Cheers. |
|
Back to top |
|
|
Felix82 n00b
Joined: 31 Aug 2003 Posts: 50 Location: near Munich, Germany
|
Posted: Thu May 13, 2004 3:50 pm Post subject: |
|
|
I also used the script above, but it still didn't work.
I can only acess the scanner as normal user after reboot. But when i switch it off and on again, it's not acessable. _________________
- [Athlon XP 2500+, 512MB RAM, GF2MX, 120+160GB, SiS746FX Board]: Gentoo only
- [Athlon T-Bird 1000, 512MB RAM, GF2MX, 80GB, KT133 Board]: Gentoo, W2K
|
|
Back to top |
|
|
neysx Retired Dev
Joined: 27 Jan 2003 Posts: 795
|
Posted: Thu May 13, 2004 3:59 pm Post subject: |
|
|
Obviously the script doesn't do its work or can't be called.
Could you post
1) /etc/hotplug/usb.usermap
2) `ls -l /etc/hotplug/usb`
3) the script itself
4) `ls -lR /proc/bus/usb`
switch scanner off, on, wait ca. 30 seconds
5') `ls -lR /proc/bus/usb` again
I'll try to sort it out for you, if I can |
|
Back to top |
|
|
Felix82 n00b
Joined: 31 Aug 2003 Posts: 50 Location: near Munich, Germany
|
Posted: Thu May 13, 2004 4:23 pm Post subject: |
|
|
Here are the files you wanted to see:
Code: |
# /etc/hotplug/usb.usermap
# usb module match_flags idVendor idProduct bcdDevice_lo bcdDevice_hi bDeviceClass bDeviceSubClass bDeviceProtocol bInterfaceClass bInterfaceSubClass bInterfaceProtocol driver_info
scanner 0x0003 0x04b8 0x0802 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000
|
Code: |
felix@primergy / $ ls -l /etc/hotplug/usb
total 4
-rwxr-xr-x 1 felix users 913 May 13 17:35 scanner
|
Code: |
felix@primergy / $ cat /etc/hotplug/usb/scanner
#!/bin/sh
# This file is part of sane-backends.
#
# This script changes the permissions and ownership of a USB device under
# /proc/bus/usb to grant access to this device to users in the scanner group.
#
# Ownership is set to root:scanner, permissions are set to 0660.
#
# Arguments :
# -----------
# ACTION=[add|remove]
# DEVICE=/proc/bus/usb/BBB/DDD
# TYPE=usb
if [ -z "$DEVICE" ] ; then
IF=$(echo $DEVPATH | sed 's:\(bus/usb/devices/\)\(.*\)-\(.*\):\2:')
DEV=$(echo $DEVPATH | sed 's:\(bus/usb/devices/\)\(.*\)-\(.*\):\3:')
DEV=$(expr $DEV + 1)
DEVICE=$(printf '/proc/bus/usb/%.03d/%.03d' $IF $DEV)
fi
if [ "$ACTION" = "add" -a "$TYPE" = "usb" ]; then
chown root:scanner "$DEVICE"
chmod 0660 "$DEVICE"
fi
# That's an insecure but simple alternative
# Everyone has access to the scanner
# if [ "$ACTION" = "add" -a "$TYPE" = "usb" ]; then
# chmod 0666 "$DEVICE"
# fi
|
Code: |
felix@primergy / $ ls -lR /proc/bus/usb
/proc/bus/usb:
total 0
dr-xr-xr-x 2 root root 0 May 13 17:45 001
dr-xr-xr-x 2 root root 0 May 13 17:45 002
dr-xr-xr-x 2 root root 0 May 13 17:45 003
-r--r--r-- 1 root root 0 May 13 18:14 devices
/proc/bus/usb/001:
total 0
-rw-r--r-- 1 root root 43 May 13 17:45 001
/proc/bus/usb/002:
total 0
-rw-r--r-- 1 root root 43 May 13 17:45 001
-rw-r--r-- 1 root root 73 May 13 18:14 005
/proc/bus/usb/003:
total 0
-rw-r--r-- 1 root root 43 May 13 17:45 001
-rw-r--r-- 1 root root 43 May 13 17:45 002
|
After about 1 min:
Code: |
felix@primergy / $ ls -lR /proc/bus/usb
/proc/bus/usb:
total 0
dr-xr-xr-x 2 root root 0 May 13 17:45 001
dr-xr-xr-x 2 root root 0 May 13 17:45 002
dr-xr-xr-x 2 root root 0 May 13 17:45 003
-r--r--r-- 1 root root 0 May 13 18:19 devices
/proc/bus/usb/001:
total 0
-rw-r--r-- 1 root root 43 May 13 17:45 001
/proc/bus/usb/002:
total 0
-rw-r--r-- 1 root root 43 May 13 17:45 001
-rw-r--r-- 1 root root 73 May 13 18:19 006
/proc/bus/usb/003:
total 0
-rw-r--r-- 1 root root 43 May 13 17:45 001
-rw-r--r-- 1 root root 43 May 13 17:45 002
|
_________________
- [Athlon XP 2500+, 512MB RAM, GF2MX, 120+160GB, SiS746FX Board]: Gentoo only
- [Athlon T-Bird 1000, 512MB RAM, GF2MX, 80GB, KT133 Board]: Gentoo, W2K
|
|
Back to top |
|
|
neysx Retired Dev
Joined: 27 Jan 2003 Posts: 795
|
Posted: Thu May 13, 2004 5:59 pm Post subject: |
|
|
In petrjanda's case it turned out the device number had to be decreased and not increased. It has to do with udev and I have no idea whether it is generic or specific to his setup.
I added some tracing to find out if the script is actually called and what input it receives and what is does.
I just found out that the script does not receive the same input when hotplug is restarted and when the scanner is switched back on.
When I do /etc/init.d/hotplug restart, the script is called three times and does not work. I get Code: | In usbscanner
ACTION=add
DEVICE=/proc/bus/usb/002/002
DEVPATH=/devices/pci0000:00/0000:00:0c.0/usb2/2-1/2-1:1.0
In usbscanner
ACTION=add
DEVICE=/proc/bus/usb/002/003
DEVPATH=/devices/pci0000:00/0000:00:0c.0/usb2/2-1/2-1:1.0
/proc/bus/usb/002:
total 0
-rw-r--r-- 1 root root 43 May 13 19:36 001
/proc/bus/usb/002:
total 0
-rw-r--r-- 1 root root 43 May 13 19:36 001
In usbscanner
ACTION=add
DEVICE=
DEVPATH=bus/usb/devices/2-1
/proc/bus/usb/002:
total 0
-rw-r--r-- 1 root root 43 May 13 19:36 001
-rw-r--r-- 1 root root 50 May 13 19:36 003
new DEVICE=/proc/bus/usb/002/002
/proc/bus/usb/002:
total 0
-rw-r--r-- 1 root root 43 May 13 19:36 001
-rw-r--r-- 1 root root 50 May 13 19:36 003
|
I have no idea what DEVPATH=bus/usb/devices/2-1 means. I guess 2 is the bus and 1 the device. Or is it 1 for first device. I have to do +2 because my scanner starts as /proc/bus/usb/002/003. Or maybe 2-1 is the other way around and should become /proc/bus/usb/{1++}/{2++} ?
But when I switched my scanner on, script is called once and works. I get Code: | In usbscanner
ACTION=add
DEVICE=/proc/bus/usb/002/004
DEVPATH=/devices/pci0000:00/0000:00:0c.0/usb2/2-1/2-1:1.0
/proc/bus/usb/002:
total 0
-rw-r--r-- 1 root root 43 May 13 19:36 001
-rw-r--r-- 1 root root 50 May 13 19:38 004
/proc/bus/usb/002:
total 0
-rw-r--r-- 1 root root 43 May 13 19:36 001
-rw-rw---- 1 root users 50 May 13 19:38 004 |
Could you add some tracing in the script to find out what's happening on your system?
Here is my /etc/hotplug/usb/usbscanner Code: | #!/bin/bash
#
# /etc/hotplug/usb/usbscanner
#
GROUP=users
#!/bin/sh
echo "In usbscanner" >> /tmp/toto
echo "ACTION=$ACTION" >> /tmp/toto
echo "DEVICE=$DEVICE" >> /tmp/toto
echo "DEVPATH=$DEVPATH" >> /tmp/toto
ls -lR /proc/bus/usb/ >> /tmp/toto
if [ -z "$DEVICE" ] ; then
IF=$(echo $DEVPATH | sed 's:\(bus/usb/devices/\)\(.*\)-\(.*\):\2:')
DEV=$(echo $DEVPATH | sed 's:\(bus/usb/devices/\)\(.*\)-\(.*\):\3:')
DEV=$(expr $DEV + 2)
DEVICE=$(printf '/proc/bus/usb/%.03d/%.03d' $IF $DEV)
echo "new DEVICE=$DEVICE" >> /tmp/toto
fi
if [ "$ACTION" = "add" -a "$TYPE" = "usb" ]; then
chown root:"$GROUP" "$DEVICE"
chmod 0660 "$DEVICE"
fi
ls -lR /proc/bus/usb/ >> /tmp/toto
|
Besides, I have noticed that both libusbscanner and my own usbscanner are run. Probably because of the libsane.usermap file. I removed it and libusbscanner to make sure there was no interference. |
|
Back to top |
|
|
douglas_slac Tux's lil' helper
Joined: 29 Aug 2003 Posts: 89
|
Posted: Tue May 18, 2004 5:28 am Post subject: |
|
|
I had some craziness like that when I upgraded to sane-backends 1.0.14, lots of errors in the start of hotplug, and usb hotplugging would just fail. I had to remove the "scanner" script I had included when I upgraded to the 2.6.5 kernel, it was getting the way of the libusbscanner which came with sane-backends 1.0.14.
But I still could see the scanner, and my usb card reader wouldn't work either. It turns out the libusbscanner script was setting up the card reader as scanner, because of the line:
Code: |
DEV=$(expr $DEV + 1)
|
I commented this line out of the script, and now the scanner and the card reader work again. It is good that sane-backends took care the usb usermap and the libusbscanner script, but why is there this $DEV + 1 part of the script? And why do some people need to to be +1, some -1 and some +2?
Getting this scanner to work with kernel 2.6.5 has been a surreal experience. |
|
Back to top |
|
|
Ateo Advocate
Joined: 02 Jun 2003 Posts: 2021 Location: Republic of California
|
Posted: Wed May 19, 2004 9:10 pm Post subject: |
|
|
I had an interesting time getting xsane to open and access my scanner (canon lide 50) as a user (I was alway able to access the scanner as root). As everything in this thread, and numerous others, failed me, I tried something I didn't recall noticing. I created a group called scanner and added myself to it. After doing so, I installed Code: | emerge libusb hotplug xsane sane-frontends sane-backends |
.....After installing I started hotplug, exited my su environment, opened xsane and it gave me the choice of device (I also have a 3com usb webcam).
Since I had modified files and wanted a fresh start, before installing the above packages, I made sure they were all uninstalled and I removed 2 directories. In addition, I stopped hotplug and deleted it from startup. I probably over did it, but whatever.
Code: | /etc/init.d/hotplug stop
rc-update del hotplug
emerge -C libusb hotplug xsane sane-frontends sane-backends
rm -fr /etc/hotplug/ /etc/sane.d/ |
I laughed at myself at how simple it was in the end. Granted this might not be everyone's solution, but it IS practical. xsane wants to access the scanner using group root or scanner scanner by default. |
|
Back to top |
|
|
phosphan n00b
Joined: 02 Dec 2003 Posts: 46
|
|
Back to top |
|
|
2sheds n00b
Joined: 27 Feb 2004 Posts: 48 Location: Sydney, Oz
|
Posted: Wed Jun 16, 2004 10:03 am Post subject: |
|
|
i have this problem, i gather the bug still hasnt got a fix? iwas going to add my
name to the bug but couldnt work out how.
Code: | chown: cannot access `/proc/bus/usb/003/003': No such file or directory
chmod: cannot access `/proc/bus/usb/003/003': No such file or directory |
|
|
Back to top |
|
|
phosphan n00b
Joined: 02 Dec 2003 Posts: 46
|
Posted: Wed Jun 16, 2004 12:07 pm Post subject: |
|
|
- go to https://bugs.gentoo.org/
- Open a new Bugzilla account
- Log in using this account
- go to the bug
- type your email address in the "Add CC" input field
- press the "commit" button |
|
Back to top |
|
|
2sheds n00b
Joined: 27 Feb 2004 Posts: 48 Location: Sydney, Oz
|
Posted: Wed Jun 16, 2004 8:04 pm Post subject: |
|
|
thanks phospan - i'll do that right now |
|
Back to top |
|
|
Schnacki Tux's lil' helper
Joined: 19 Feb 2003 Posts: 105
|
Posted: Mon Aug 02, 2004 7:52 pm Post subject: |
|
|
One moment... this line just about made me drop out of my chair:
Ateo wrote: | I had an interesting time getting xsane to open and access my scanner (canon lide 50) as a user |
Are you really impying here, that you have the "Canon LiDE 50" working with sane? If so, what did you do? I'm just now doing research on wich scanner to buy. And apart from the fact that (until just now) everybody says that this scanner just "won't work", it has exactly the features, I want to have. So, could you clarify that for me, please?
Ciao, Jan |
|
Back to top |
|
|
Joseph_sys Advocate
Joined: 08 Jun 2004 Posts: 2712 Location: Edmonton, AB
|
Posted: Mon Aug 09, 2004 4:49 pm Post subject: |
|
|
I have the same problem every time I reboot I get this error:
Quote: | * Starting usb hotplugging...
chown: cannot access `/proc/bus/usb/001/005': No such file or directory
chmod: cannot access `/proc/bus/usb/001/005': No such file or directory |
Though only when the scanner is plugged IN; if I unplug the scanner and restart hotplug then plug the scanner again there is no error when I restart hotplug.
Changing DEV=$(expr $DEV + 1) from +1 to -1 or +2 does not help |
|
Back to top |
|
|
Vermyndax Apprentice
Joined: 13 Dec 2003 Posts: 208
|
Posted: Tue Aug 17, 2004 6:29 am Post subject: FYI... |
|
|
FYI, I had to change the line:
DEV=$(expr $DEV + 1)
... to:
DEV=$(expr $DEV)
...otherwise the script would execute on the wrong device! |
|
Back to top |
|
|
kamagurka Veteran
Joined: 25 Jan 2004 Posts: 1026 Location: /germany/munich
|
Posted: Sat Feb 04, 2006 3:10 pm Post subject: |
|
|
For me (as a udev user) it was pretty simple. I looked at my scanner with udevinfo
Code: | udevinfo -q all -n /dev/bus/usb/001/008 | and used the P: output for a walk along the device chain
Code: | udevinfo -a -p /class/usb_device/usbdev1.8 |
In that output I looked for my scanner and made a rule to have my scanner always owned by group scanner:
Code: | vim /etc/udev/rules.d/10-local.rules
SYSFS{manufacturer}=="EPSON", SYSFS{idProduct}=="0110", SYSFS{idVendor}=="04b8", SYSFS{product}=="EPSON Scanner", GROUP="scanner" |
Booya. _________________ If you loved me, you'd all kill yourselves today.
--Spider Jerusalem, the Word |
|
Back to top |
|
|
pjp Administrator
Joined: 16 Apr 2002 Posts: 20054
|
Posted: Sun Feb 05, 2006 12:39 am Post subject: |
|
|
Moved from Other Things Gentoo _________________ Quis separabit? Quo animo? |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|