LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (http://www.linuxquestions.org/questions/slackware-14/)
-   -   udev and scanner - only as root since upgrade to -current (http://www.linuxquestions.org/questions/slackware-14/udev-and-scanner-only-as-root-since-upgrade-to-current-594071/)

niels.horn 10-23-2007 10:03 PM

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?

allend 10-24-2007 12:28 PM

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.

rworkman 10-24-2007 02:02 PM

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

Piter PUNK 10-24-2007 02:14 PM

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

niels.horn 10-24-2007 03:19 PM

Well, Robby Workman and Piter PUNK replying to my thread... I'm honored! :cool:

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! :scratch:

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...

anewguy 10-25-2007 02:59 AM

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!!

Fluxx 10-25-2007 03:28 AM

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.

niels.horn 10-25-2007 05:34 AM

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. :D
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?

rworkman 10-25-2007 11:20 AM

Please still send the requested information - mail it to PiterPunk (piterpunk@) and CC me (rworkman@)

niels.horn 10-25-2007 11:56 AM

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.

rworkman 10-25-2007 12:10 PM

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.

allend 10-25-2007 12:28 PM

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"


Piter PUNK 10-25-2007 09:32 PM

Quote:

Originally Posted by allend (Post 2936557)
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

niels.horn 10-25-2007 11:13 PM

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!

rworkman 10-25-2007 11:26 PM

Quote:

Originally Posted by niels.horn (Post 2937141)
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.


All times are GMT -5. The time now is 02:38 AM.