# [solved]usb-scanner and kernel 2.6.1

## polle

I have a lifetec LT9385 usb scanner, with the vanilla kernel 2.4.xx it works correct.

I recently tried the new linux-2.6.1-rc3-gentoo kernel but untill now i can't get the scaznner working

I believe usb is configured correct (I can mount and explore my usb memory stick)

the scanner is found by sane-find-scanner:

found USB scanner (vendor=0x05d8, product=0x4002) at libusb:001:002

but in kooka there is no trace of it

I think it's a configuration problem, searched the forum but untill now didn't find a solution

scanimage -L gives this:

devilgentoo root # scanimage -L

device `gt68xx:libusb:001:002' is a Artec MD/LT 9385 flatbed scannerLast edited by polle on Tue Jan 13, 2004 5:50 pm; edited 2 times in total

----------

## polle

solved it by:

chmod  666 /proc/bus/usb/001/002

But I'm not sure this is the right solution

----------

## polle

I think it's have something to do with hotplug: when I disconnet the scanner after booting and after a few seconds plug it again in, it's dedected and works fine, but I want it also working when it's plugged in when I boot

anyone an idea?

----------

## HotShotDJ

 *polle wrote:*   

> I think it's have something to do with hotplug: when I disconnet the scanner after booting and after a few seconds plug it again in, it's dedected and works fine, but I want it also working when it's plugged in when I boot
> 
> anyone an idea?

 

I finally got this one figured out on my own system... so I'll share with the class.  :Smile: 

Add the following lines to /etc/hotplug/usb.usermap

```
# Epson Perfection 1650 Flatbed Scanner

scanner          0x0003 0x04b8 0x0110 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0
```

Of course, you'll want to change things to match your device.  The second and third string on the "scanner" line will be the make and model of your scanner... mine is an epson (0x04b8) perfection 1650 (0x0110).   EVERYTHING else leave as is.  So polle would likley want the line to read as follows:

```
# Lifetec LT9385 USB Scanner

scanner          0x0003 0x05d8 0x4002 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0
```

STEP TWO:

Create a text file:

```
#!/bin/bash

if [ "${ACTION}" = "add" ] && [ -f "${DEVICE}" ]

then

        chown root "${DEVICE}"

        chgrp scanner "${DEVICE}"

        chmod 660 "${DEVICE}"

fi

```

Save it as /etc/hotplug/usb/scanner and be sure that you make it executable!  Now, when hotplug detects the device "scanner" that you defined in usb.usermap, it will run the above script.   Note that it assumes that the users that you want using the scanner belong to the group "scanner."  You can change this to anything you'd like.   Or you could get rid of the chown and chgrp line and then change chmod 660 to chmod 666 so that anybody can have read/write access to the scanner.

Good Luck

----------

## polle

thanks for the reply, I did steps above mentioned and added a group scanner added the user to it, but still no luck.

pity, because everyting you say sounds very logical.

----------

## polle

Sorry, my fault, during boot I saw the message that there was a syntax error in /etc/hotplug/usb/scanner, seemed  I forgot the last "fi"

now it works;

thanks a lot HotShot, very nice, thanks again

----------

## HotShotDJ

polle:

Great that you got it working!!  I saw your message earlier and was racking my brain trying to figure out what could have possibly gone wrong.   Usually its the simple "little" things.  (I usually forget things like "}" ..   :Embarassed:  )

----------

## vdboor

I was wondering, instead using a shell script to set the permissions, might it be a nice idea to use devfs for this? I've added this line to /etc/devfsd.conf, and it seams to work:

```
REGISTER        ^usb/scanner0$  PERMISSIONS root.scanner 660
```

----------

## AgenT

You can also do it in a more dirty fashion and add this to your /etc/conf.d/local.start:

```
chmod 0666 /proc/bus/usb/001/*
```

Replace the 001 and * as needed for you. This is really only useful if the scanner is plugged into the same port every time or is never unplugged. And yes, this is a somewhat security issue since anyone can use your scanner. It could be changed, however.

----------

## steveb

 *vdboor wrote:*   

> I was wondering, instead using a shell script to set the permissions, might it be a nice idea to use devfs for this? I've added this line to /etc/devfsd.conf, and it seams to work:
> 
> ```
> REGISTER        ^usb/scanner0$  PERMISSIONS root.scanner 660
> ```
> ...

 it would be much more wise to create an file in /etc/devfs.d instead of directly editing the /etc/devfsd.conf file (maybe allowing everyone from group users to use the scanner):

```
# cat /etc/devfs.d/scanner 

REGISTER        ^usb/scanner0$  PERMISSIONS root.users 660
```

cheers

SteveB

----------

## xcable

This fix seams like a hack.  Has anyone figured out why adding the user to the "usb" ground does not work.

heath

----------

## vdboor

 *xcable wrote:*   

> This fix seams like a hack.

 

Agreed, I hope hotplug will be changed for this.

 *xcable wrote:*   

> Has anyone figured out why adding the user to the "usb" group (I assume group) does not work.

 

Well, what is the group-field of the /proc/bus/usb/* files...  :Wink:  (or your /dev/scanner file..  :Wink: ) Adding a user to a group called usb doesn't do much unfortunately, unless there are some files who give these group-members additional privileges.

I do think you can change the umask, and gid setting in /etc/fstab

```
none      /proc/bus/usb   usbfs    defaults,noauto,umask=0002,gid=<id of usb group> 0 0
```

Then remount that filesystem, and check the permissions on /proc/bus/usb with ls -l

Hope this helps...

----------

