# USB Scanner, Hotplug, v2.6 kernel WORKING!!!

## BeanDip

I have solved the riddle of getting my niash chip based HP 3400C usb scanner installed in gentoo with dev-sources kernel and hotplug enabled.  These instructions should pretty much apply to any usb scanner if you are intuitive enough to follow along and google a bit where needed.  If folks add enough info and feedback conscerning their specific difficulties and solutions this may grow into a usb scanner howto for gentoo.  First off, please make sure that if you are doing this you have devfs disbled and are using udev and have emerged a kernel source tree >= 2.6.8 as 2.6.8 has included a patch to fix problems conscerning detection of various usb hardware that hit us hp  niash-based scanner owners pretty hard.  and so... the howto

```
            

emerge hotplug 

rc-update add hotplug default

emerge libusb

cat /proc/bus/usb/devices

```

look for your scanner and write down vendor=*******  and ProdID=******

in my case for the hp scanjet 3400c the output was:

```

T:  Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  5 Spd=12  MxCh= 0

D:  Ver= 1.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs=  1

P:  Vendor=03f0 ProdID=0405 Rev= 0.00

S:  Manufacturer=Hewlett-Packard

S:  Product=Hewlett-Packard ScanJet 3400C

S:  SerialNumber=CN1251D0D6TG

C:* #Ifs= 1 Cfg#= 1 Atr=40 MxPwr= 48mA

I:  If#= 0 Alt= 0 #EPs= 3 Cls=10(unk. ) Sub=01 Prot=00 Driver=usbfs

E:  Ad=81(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms

E:  Ad=02(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms

E:  Ad=83(I) Atr=03(Int.) MxPS=   1 Ivl=8ms

```

So Vendor=03f0 ProdID=0405  are the relevent info.

next edit your /etc/sane.d/(SCANNER VENDOR).conf file

for me /etc/sane.d/hp.conf

and insert two lines or edit those existing to read:

```

# scanner model number

usb vendor ProdID

```

for me:

```

# HP ScanJet 3400C

usb 0x03f0 0x0405

```

Next edit your /etc/hotplug/usb.usermap

insert a line reading

```
scannername(make this up and remember it)       0x0003      0xVendor   0xProdID    0x0000    0x0000    0x00    0x00    0x00    0x00    0x00    0x00               0x00000000

```

all on one line, in my case:

```

hp_scanner        0x0003      0x03f0   0x0405    0x0000    0x0000    0x00    0x00    0x00    0x00    0x00    0x00               0x00000000

```

now make a file called /etc/hotplug/usb/scannername_you_made-up_last_step

my case: /etc/hotplug/usb/hp_scanner

and put the following script in it:

```

#!/bin/bash

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

then

        chown root "${DEVICE}"

                chgrp scanner "${DEVICE}"

                chmod 660 "${DEVICE}"

        fi

```

now make sure you have any users needing to scan added in your /etc/group file at the line reading:

```

scanner:x:440:

```

That's it!  enjoy your now working usb scanner!  

Run 

rc 

or /etc/init.d/hotplug restart

or whatever you need to do to get the hotplug script started on your system and enjoy.

Hope this helps and this thread can serve as a pointer and aid to those needing it.  Please, if you have another scanner other than my HP 3400C you've gotten working post your entries for those who need them to look over.

----------

## stevyn

Thanks for the tutorial.  I have an epson perfection 1650 scanner and I followed your steps, but I wasn't sucessful.  

I ended up commenting out the line:

# chown root:scanner "$DEVICE"

in the file:

/etc/hotplug/usb/libusbscanner

That did it for me.  Hope this helps others.

----------

## BeanDip

I'm glad it worked for you.

The chown root:scanner "$DEVICE"  line makes the device accessible only by those in the scanner group.  if you edit the /etc/group file and add the login names of those on your system who need access to the scanner and have them log out and back in it should work.  You might have done everything as I wrote and forgotten to log out and back in before trying to access your scanner.  either way, I'm glad you've gotten things up and running.

----------

## apmurray

or you could bypass needing the script etc by letting those with usb group use it and not needing a separate scanner group

----------

