LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 10-23-2007, 09:03 PM   #1
niels.horn
Senior Member
 
Registered: Mar 2007
Location: Rio de Janeiro - Brazil
Distribution: Slackware64-current
Posts: 1,004

Rep: Reputation: 91
Unhappy udev and scanner - only as root since upgrade to -current


Hi to all,

I'm having this silly problem since I upgraded to -current a few days ago.
My scanner (Canon LiDE 20) is only working as root, not as any other user.

scanimage -L doesn't find my scanner as a normal user.

as root it returns:
Code:
device `plustek:libusb:002:004' is a Canon N670U/N676U/LiDE20 USB flatbed scanner
I checked the obvious: yes, I am a member of the group 'scanner'.

udev creates /dev/usbdev2.4 with owner=root, group=scanner, mode=660
But I found /dev/bus/usb/002/004 is root.root mode 644

When I do "chmod 666 /dev/bus/usb/002/004" it is recognized by any normal user and evrything works fine until my next boot.

I checked /etc/udev/rules.d/80-libsane.rules and there is a line saying:
Code:
SYSFS{idVendor}=="04a9", SYSFS{idProduct}=="220d", MODE="660", GROUP="scanner"
Apparently everything here is ok, but there seems to be some problem at a lower level creating /dev/bus/usb/002/004

This all worked fine before upgrading to -current

Any ideas?
 
Old 10-24-2007, 11:28 AM   #2
allend
LQ 5k Club
 
Registered: Oct 2003
Location: Melbourne
Distribution: Slackware64-15.0
Posts: 6,371

Rep: Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750
I am having a similiar difficulty with my Brother DCP-110C printer/scanner.
As root, everything works just fine.
However, for a normal user (who is a member of the scanner group) to access the scanner, I have found that I need to execute 'chgrp scanner /dev/bus/usb/xxx/yyy' where xxx is the Bus number and yyy is the device number reported by 'lsusb'.
It appears that an alteration to the udev rules is required (maybe in 65-permissions.rules or else by creation of 90-local.rules), but I do not have a solution at this time.
 
Old 10-24-2007, 01:02 PM   #3
rworkman
Slackware Contributor
 
Registered: Oct 2004
Location: Tuscaloosa, Alabama (USA)
Distribution: Slackware
Posts: 2,559

Rep: Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351
Run this and post all output.
This is probably something missing in the 80-libsane.rules (perhaps they haven't caught up to changes in latest udev)
Code:
udevinfo --query=all --attribute-walk --name /dev/bus/usb/002/004
 
Old 10-24-2007, 01:14 PM   #4
Piter PUNK
Slackware Contributor
 
Registered: Aug 2007
Location: Sao Paulo - Brazil
Distribution: Slackware
Posts: 4

Rep: Reputation: 0
Hi,

Can you make available a tar.gz from your /dev and your /etc/udev?
this is important to me to see and discover what is happening.
If you can send your /etc/group is good, too.

Thanks

Piter PUNK
 
Old 10-24-2007, 02:19 PM   #5
niels.horn
Senior Member
 
Registered: Mar 2007
Location: Rio de Janeiro - Brazil
Distribution: Slackware64-current
Posts: 1,004

Original Poster
Rep: Reputation: 91
Well, Robby Workman and Piter PUNK replying to my thread... I'm honored!

udevinfo --query=all --attribute-walk --name /dev/bus/usb/002/005 (after unplugging and plugging my scanner changed to 002/005) gives:

Code:
Udevinfo starts with the device specified by the devpath and then
walks up the chain of parent devices. It prints for every device
found, all possible attributes in the udev rules key format.
A rule to match, can be composed by the attributes of the device
and the attributes from one single parent device.

  looking at device '/devices/pci0000:00/0000:00:10.1/usb2/2-2':
    KERNEL=="2-2"
    SUBSYSTEM=="usb"
    DRIVER=="usb"
    ATTR{product}=="CanoScan"
    ATTR{manufacturer}=="Canon"
    ATTR{quirks}=="0x1"
    ATTR{maxchild}=="0"
    ATTR{version}==" 1.10"
    ATTR{devnum}=="5"
    ATTR{busnum}=="2"
    ATTR{speed}=="12"
    ATTR{bMaxPacketSize0}=="8"
    ATTR{bNumConfigurations}=="1"
    ATTR{bDeviceProtocol}=="ff"
    ATTR{bDeviceSubClass}=="00"
    ATTR{bDeviceClass}=="ff"
    ATTR{bcdDevice}=="0100"
    ATTR{idProduct}=="220d"
    ATTR{idVendor}=="04a9"
    ATTR{bMaxPower}=="500mA"
    ATTR{bmAttributes}=="a0"
    ATTR{bConfigurationValue}=="1"
    ATTR{bNumInterfaces}==" 1"
    ATTR{configuration}==""
    ATTR{dev}=="189:132"

  looking at parent device '/devices/pci0000:00/0000:00:10.1/usb2':
    KERNELS=="usb2"
    SUBSYSTEMS=="usb"
    DRIVERS=="usb"
    ATTRS{serial}=="0000:00:10.1"
    ATTRS{product}=="UHCI Host Controller"
    ATTRS{manufacturer}=="Linux 2.6.23.1-smp uhci_hcd"
    ATTRS{quirks}=="0x0"
    ATTRS{maxchild}=="2"
    ATTRS{version}==" 1.10"
    ATTRS{devnum}=="1"
    ATTRS{busnum}=="2"
    ATTRS{speed}=="12"
    ATTRS{bMaxPacketSize0}=="64"
    ATTRS{bNumConfigurations}=="1"
    ATTRS{bDeviceProtocol}=="00"
    ATTRS{bDeviceSubClass}=="00"
    ATTRS{bDeviceClass}=="09"
    ATTRS{bcdDevice}=="0206"
    ATTRS{idProduct}=="0000"
    ATTRS{idVendor}=="0000"
    ATTRS{bMaxPower}=="  0mA"
    ATTRS{bmAttributes}=="e0"
    ATTRS{bConfigurationValue}=="1"
    ATTRS{bNumInterfaces}==" 1"
    ATTRS{configuration}==""
    ATTRS{dev}=="189:128"

  looking at parent device '/devices/pci0000:00/0000:00:10.1':
    KERNELS=="0000:00:10.1"
    SUBSYSTEMS=="pci"
    DRIVERS=="uhci_hcd"
    ATTRS{msi_bus}==""
    ATTRS{broken_parity_status}=="0"
    ATTRS{enable}=="1"
    ATTRS{modalias}=="pci:v00001106d00003038sv00001106sd00003038bc0Csc03i00"
    ATTRS{local_cpus}=="ffffffff"
    ATTRS{irq}=="18"
    ATTRS{class}=="0x0c0300"
    ATTRS{subsystem_device}=="0x3038"
    ATTRS{subsystem_vendor}=="0x1106"
    ATTRS{device}=="0x3038"
    ATTRS{vendor}=="0x1106"

  looking at parent device '/devices/pci0000:00':
    KERNELS=="pci0000:00"
    SUBSYSTEMS==""
    DRIVERS==""
    ATTRS{uevent}==""
To Piter:
Quote:
Can you make available a tar.gz from your /dev and your /etc/udev?
this is important to me to see and discover what is happening.
If you can send your /etc/group is good, too.
I can send it to an e-mail address if you want (the one that is in the man page of slackpkg?)

Hopefully we can find a solution!

Edit:
I just found that changing this line:
Code:
SUBSYSTEM=="usb", ACTION=="add", ENV{DEVTYPE}=="usb_device", NAME="bus/usb/$env{BUSNUM}/$env{DEVNUM}", MODE="0644"
in 50-udev-default.rules to:
Code:
SUBSYSTEM=="usb", ACTION=="add", ENV{DEVTYPE}=="usb_device", NAME="bus/usb/$env{BUSNUM}/$env{DEVNUM}", MODE="0666"
(changing 0644 to 0666) "resolves" my problem.
But is it supposed to work this way? Now I am giving rw access to everybody...

Last edited by niels.horn; 10-24-2007 at 02:59 PM.
 
Old 10-25-2007, 01:59 AM   #6
anewguy
LQ Newbie
 
Registered: Oct 2007
Posts: 2

Rep: Reputation: 0
Wink Similar problem?

I am a newbie, so please forgive me if I am misunderstanding this. If I am following correctly, the USB device(s) are getting mounted with root access only?

I ask this because I am using the avidownload program from sourceforge to download videos off a hacked 1-time use CVS video camera. If I don't run the application as root, it won't open the device. This all uses libusb.

Because it downloads videos to a directory in the users' directory tree, the user now ends up with files he can't delete, etc., because they are owned by root.

Does this sound like a similar problem (I thought it did)?

BTW - I'm running Ubuntu 7.10. Can you point me to the place where I would make the above change?

Thanks!
Dave

EDIT: SOLVED - yes!, this was the problem. In Ubuntu I had to edit /etc/udev/rules.d/40-permissions.rules. Works like a champ! Thanks, guys!!

Last edited by anewguy; 10-25-2007 at 02:43 AM. Reason: SOLVED
 
Old 10-25-2007, 02:28 AM   #7
Fluxx
Member
 
Registered: Aug 2005
Location: Bavaria, Germany
Distribution: Slackware (Current)
Posts: 225

Rep: Reputation: 30
Hi niels.horn,

quite good! This is also the solution for my camera in current udev!

http://www.linuxquestions.org/questi...-gtkam-594315/

Thank you very much!

Fluxx.
 
Old 10-25-2007, 04:34 AM   #8
niels.horn
Senior Member
 
Registered: Mar 2007
Location: Rio de Janeiro - Brazil
Distribution: Slackware64-current
Posts: 1,004

Original Poster
Rep: Reputation: 91
Exclamation Solved or hacked?

Quote:
Originally Posted by anewguy
SOLVED - yes!, this was the problem.
Quote:
Originally Posted by Fluxx
quite good! This is also the solution for my camera in current udev!
Well, at least I made some people happy.
But I'm not very proud of my solution, it's more like a hack.

Maybe the real experts can give their opinion here about my preoccupation with the security consequences of giving r/w access to a device to everyone.
I know that in a home environment this won't be a problem, but in an office it might be. (In my office I only have read access to the usb ports so that I cannot copy documents to my pendrive)
I thought of changing the rule to give access only to a group called 'usb' (I'd have to create it) with
Code:
MODE="660", GROUP="usb"
in the default-rules line. Then to use the scanner I have to be a member of 'scanner' and 'usb'.

What do you think?
 
Old 10-25-2007, 10:20 AM   #9
rworkman
Slackware Contributor
 
Registered: Oct 2004
Location: Tuscaloosa, Alabama (USA)
Distribution: Slackware
Posts: 2,559

Rep: Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351
Please still send the requested information - mail it to PiterPunk (piterpunk@) and CC me (rworkman@)
 
Old 10-25-2007, 10:56 AM   #10
niels.horn
Senior Member
 
Registered: Mar 2007
Location: Rio de Janeiro - Brazil
Distribution: Slackware64-current
Posts: 1,004

Original Poster
Rep: Reputation: 91
Ok, I'll send the information tonight from home. I agree with your comment in the other thread that what I did is not the ideal solution, just a workaround so that I donīt have to do a chmod everytime I plug in my scanner or reboot.
 
Old 10-25-2007, 11:10 AM   #11
rworkman
Slackware Contributor
 
Registered: Oct 2004
Location: Tuscaloosa, Alabama (USA)
Distribution: Slackware
Posts: 2,559

Rep: Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351
For the time being, this *should* work for you - put this in a 90-local.rules file:
Code:
SUBSYSTEM=="usb" \
  ATTR{product}=="CanoScan" \
  ATTR{manufacturer}=="Canon" \
  GROUP:="plugdev" \
  MODE:="0664"
Please confirm whether or not this works.
 
Old 10-25-2007, 11:28 AM   #12
allend
LQ 5k Club
 
Registered: Oct 2003
Location: Melbourne
Distribution: Slackware64-15.0
Posts: 6,371

Rep: Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750
Thanks Robby,

I have just spent a lot of time finding that this works for me.
~$ cat /etc/udev/rules.d/90-local.rules
Code:
# Custom rule to assign privileges to scanner device file 
SUBSYSTEM=="usb",  ATTR{idProduct}=="0169",  ATTR{idVendor}=="04f9",  ATTR{dev}=="189*" \
                  GROUP="scanner", MODE="0660"
 
Old 10-25-2007, 08:32 PM   #13
Piter PUNK
Slackware Contributor
 
Registered: Aug 2007
Location: Sao Paulo - Brazil
Distribution: Slackware
Posts: 4

Rep: Reputation: 0
Quote:
Originally Posted by allend View Post
Code:
# Custom rule to assign privileges to scanner device file 
SUBSYSTEM=="usb",  ATTR{idProduct}=="0169",  ATTR{idVendor}=="04f9",  ATTR{dev}=="189*" \
                  GROUP="scanner", MODE="0660"
Can you try the rules that are here?
http://slackware.com/~piterpunk/udev/testing

SYSFS attribute are marked to be obsolete some time ago. Use ATTR is the
preferred way (and now, the only correct way). Some rules shipped with other
packages doesn't fix it yet.

Piter PUNK

Last edited by Piter PUNK; 10-25-2007 at 08:48 PM. Reason: New information appended
 
Old 10-25-2007, 10:13 PM   #14
niels.horn
Senior Member
 
Registered: Mar 2007
Location: Rio de Janeiro - Brazil
Distribution: Slackware64-current
Posts: 1,004

Original Poster
Rep: Reputation: 91
To Robby Workman:
Quote:
Please confirm whether or not this works.
Yes it does. Now the /dev/bus/usb/aaa/bbb is created with mode 664 group plugdev

I'll send the info in a few moments by e-mail.

Thanks for the help until now!
 
Old 10-25-2007, 10:26 PM   #15
rworkman
Slackware Contributor
 
Registered: Oct 2004
Location: Tuscaloosa, Alabama (USA)
Distribution: Slackware
Posts: 2,559

Rep: Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351
Quote:
Originally Posted by niels.horn View Post
To Robby Workman:

Yes it does. Now the /dev/bus/usb/aaa/bbb is created with mode 664 group plugdev

I'll send the info in a few moments by e-mail.

Thanks for the help until now!
Thank you. At this point, I don't think we need any more information.
We were exchanging random thoughts on IRC and suddenly there was a flash of light, and PiterPunk had the solution. ;-) See his post above.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
/dev/rtc + udev in current dive Slackware 3 09-02-2006 09:37 PM
udev problems in current MS3FGX Slackware 15 08-14-2006 06:20 AM
slackware-current, udev 0.96, and custom udev rules not working rignes Slackware 6 08-10-2006 03:43 AM
scanner with udev only - possible? aspartat Linux - Hardware 0 04-24-2006 02:01 PM
How to upgrade to -current ? New udev for new kernel !? introuble Slackware 8 04-21-2006 02:47 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 08:51 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration