# USB scanners?

## uncle_meat

I read someone else's thread on the subject, but his comments don't seem to apply in my situation.

I have USB scanner support compiled in as a kernel module.  I also have devfs compiled in.  (But it doesn't seem to work)  I have emerged sane-frontends, sane-backends, and xsane.  My scanner shows up in /proc/bus/usb/drivers.  However, sane-findscanner doesn't find it - "invalid argument" over and over again.

I was thinking that since I have devfs, the device should appear automatically?  But it doesn't.  In fact, /dev appears to be a regular filesystem, and I don't understand why.

Help?

----------

## uncle_meat

Just to clarify, devfs IS getting mounted, according to the kernel (grep devfs /var/log/messages)... but I can create stuff on it just like any other filesystem... I thought devfs was supposed to create devices automatically?

Still haven't got a clue about how to get my USB scanner device up.

----------

## qwkbrnfox

My scanner shows up as /dev/usb/scanner0.  I had to go into /etc/sane.d/plustek.conf and change the line that says 

device /dev/scanner

to

device /dev/usb/scanner0

in order to get sane to recognize it.

Let us know how it goes.

T

----------

## uncle_meat

Nothing has changed, sane-find-scanner still doesn't work.  "Checking /dev/usb/scanner0... failed to open (Invalid argument)" 

 *qwkbrnfox wrote:*   

> My scanner shows up as /dev/usb/scanner0.  I had to go into /etc/sane.d/plustek.conf and change the line that says 
> 
> device /dev/scanner
> 
> to
> ...

 

----------

## uncle_meat

Also, I should mention that nothing is showing up in /dev/usb, e.g. /dev/usb/scanner0 does not exist.

----------

## qwkbrnfox

OK, have to dig deeper.  

When you load the scanner module, does dmesg show any errors?

Start usbview.  When you click on the scanner, what does it say?

What does 'ls /dev/usb' show?

What kind of scanner is it?

I had a problem with usb hotplugging not recognizing my scanner, and had to edit the conf file to connect it properly.

T

----------

## uncle_meat

 *qwkbrnfox wrote:*   

> OK, have to dig deeper.  
> 
> When you load the scanner module, does dmesg show any errors?
> 
> 

 

No errors.

 *Quote:*   

> 
> 
> Start usbview.  When you click on the scanner, what does it say?
> 
> 

 

um.... how do I copy from that window?

Anyway, it shows EPSON Scanner, Speed: 12MB/s, USB Version 1.10, Device Class ff, etc etc etc.

 *Quote:*   

> 
> 
> What does 'ls /dev/usb' show?
> 
> 

 

As I mentioned in a previous message, /dev/usb is absolutely empty.

 *Quote:*   

> 
> 
> What kind of scanner is it?
> 
> 

 

Epson Perfection 1260 Photo

----------

## uncle_meat

With scanner.o loaded, I tried removing and plugging in the USB scanner.  dmesg shows this:

```

usb.c: USB disconnect on device 2

hub.c: USB new device connect on bus1/1, assigned device number 3

usb.c: USB device 3 (vend/prod 0x4b8/0x11d) is not claimed by any active driver.

```

And there's still nothing in /dev/usb.

----------

## qwkbrnfox

Whoa, weird, I have the 1250.  I had to edit /etc/hotplug/usb.distmap to get the usb system to connect the scanner to the module properly.  You will need the vendor id and the product id, both found in usbview.  Mine are 04b8 (vendor) and 010f (product).  Yours will probably be similar.

Then, edit usb.distmap.  Search for the scanner section, the go forward to the 04b8 series.  Copy one of the lines, and change the product id to match yours.  I added the following line:

scanner              0x0003 0x04b8   0x010f    0x0000       0x0000       0x00         0x00            0x00            0x00            0x00            0x00            0x00000000

I guess that you should check to see if you scanner is already in the file, but I suspect that it isn't, since the 1260 is pretty new.  After editing the file, you will have to restart the usb hotplugging, and the scanner module.  One way (maybe not the best, but it should work) is to: 

rmmod scanner

/etc/init.d/hotplug restart

This should automatically load the scanner module.  

'lsmod | grep scanner'  to check.  If it didn't something is wrong.  Let us know what happens!

T

----------

## uncle_meat

 *qwkbrnfox wrote:*   

> Whoa, weird, I have the 1250.  I had to edit /etc/hotplug/usb.distmap to get the usb system to connect the scanner to the module properly. 

 

That file doesn't exist on my system.  Is there something I'm supposed to emerge to get it?

----------

## qwkbrnfox

That file comes from the hotplug ebuild.  You don't really need it.  Instead try 

rmmod scanner

insmod scanner vendor=04b8 product=<prod id>

T

----------

## uncle_meat

 *qwkbrnfox wrote:*   

> Then, edit usb.distmap.  Search for the scanner section, the go forward to the 04b8 series.  Copy one of the lines, and change the product id to match yours....
> 
> Then...
> 
> rmmod scanner
> ...

 

Okay, I emerged sys-apps/hotplug and did all that, but the scanner module wasn't loaded.

----------

## qwkbrnfox

Unplug the usb cable from your scanner, wait a sec, then plug it in again.  What does dmesg say?

----------

## uncle_meat

 *qwkbrnfox wrote:*   

> That file comes from the hotplug ebuild.  You don't really need it.  Instead try 
> 
> rmmod scanner
> 
> insmod scanner vendor=04b8 product=<prod id>
> ...

 

Ugh, the scanner module doesn't recognize hexadecimal numbers... grumble grumble... but after converting to decimal and inserting the module manually, /dev/usb/scanner0 shows up.  Great.

However, why doesn't it show up using hotplug?  That concerns me.  Does hotplug actually work?

----------

## qwkbrnfox

Damn.  Sorry, I knew I was forgetting something.  Use 

insmod scanner vendor=0x04b8....

As to why hotplugging doesn't work...dmesg is your friend!  It works fine for me, with the modifications to the config file.

T

----------

## uncle_meat

I would like to get hotplug working.  Broken software bothers me.  But I also want to try out the scanner to see if it works.  So let's move on.

What're some command line utils I can use to grab stuff from the scanner?

----------

## uncle_meat

 *qwkbrnfox wrote:*   

> Damn.  Sorry, I knew I was forgetting something.  Use 
> 
> As to why hotplugging doesn't work...dmesg is your friend!  It works fine for me, with the modifications to the config file.
> 
> 

 

dmesg may be your friend, but it isn't mine.    :Very Happy:   Nothing's showing up in dmesg relevant to the scanner, except when I remove/insert it manually.  hotplugging isn't working for me... I would like to get it to work... but I also want to see if I can receive scanned material from Linux.

----------

## uncle_meat

Okay, I found this command line utility called scanimage.  sane-find-scanner sees the SANE scanner, but scanimage does not.  Once again, I am lost.

----------

## qwkbrnfox

I know what you mean about broken software...for example, none of the Quote, Code, List,... buttons in this forum are working.  Damned irritating.  I usually use xsane, which is great.  emerge xsane.  However, if you are looking for a command line, try

scanimage -d plustek:/dev/usb/scanner0 --resolution 600 > test.pnm

Be aware that there has been reported problems with the 1260, although I'm a little suspicious of whether they are true.  If you hear a hair-raising noise coming from the motor, pull the power plug, stat.  It makes some funny noises, but I imagine you will know when to do it.

BTW, the latest version of sane has updated drivers for the epson, allowing the slide and negative adapter to be used.  I've got a (slightly) modified ebuild to get 'em.  Let me know if you want it.

Good luck!

T

----------

## uncle_meat

 *qwkbrnfox wrote:*   

> 
> 
> scanimage -d plustek:/dev/usb/scanner0 --resolution 600 > test.pnm
> 
> 

 

scanimage: open of device plustek:/dev/usb/scanner0 failed: Error during device I/O

 :Sad: 

Thanks for the warning about the 1260.  Hopefully, I will get at least one of hotplug or scanimage working before tomorrow.

----------

## qwkbrnfox

About the hotplugging:  Do you have hotplug enabled in your kernel?  In general setup, set Support for Hotplug Devices.

I'm puzzled that scanimage doesn't work.  The 1260 is a USB2.0 device, but I really doubt that is it.

Let me know if you figure it out.  I'll post if I think of anything.

T

----------

## uncle_meat

 *qwkbrnfox wrote:*   

> About the hotplugging:  Do you have hotplug enabled in your kernel?  In general setup, set Support for Hotplug Devices.
> 
> I'm puzzled that scanimage doesn't work.  The 1260 is a USB2.0 device, but I really doubt that is it.
> 
> Let me know if you figure it out.  I'll post if I think of anything.
> ...

 

Yes, hotplug is enabled in the kernel.  Do I need to do anything to the scanner before I use scanimage?  I tried pressing the scan button, but nothing happened.  (Yes it is plugged in  :Very Happy: )

----------

## uncle_meat

scanimage --list-devices finds nothing, BTW, although sane-find-scanner does detect /dev/usb/scanner0.

----------

## qwkbrnfox

OK, this is where I usually get desperate.  There are a few things to try:

Make sure you run scanimage as root.  Could be permissions?

Upgrade your sane-backends.  You can simply (?!) copy /usr/portage/media-gfx/sane-backends-1.0.8-r2.ebuild to

/usr/portage/media-gfx/sane-backends-1.0.9.ebuild.  

emerge sane-backends.   It'll complain about a digest.  Do what it tells you to and emerge again.  You can try this, but I'd be surprised if it is the problem.

Add hotplugging to your default rc.  rc-update add hotplug default, then *ahem* try rebooting.  Embarrasing, but what the hell.  It may work, and like I said desperate!

T

----------

## uncle_meat

Yes, I've been doing all this as root.  I tried your other suggestions and rebooting and manually re-inserting the module; no luck.  sane-find-scanner sees the device, but scanimage doesn't.

----------

## qwkbrnfox

/etc/sane.d/plustek.conf does have device /dev/usb/scanner0, and there are no 'device' lines after it?  (Make sure it's not the line that begins with #, which indicates a comment.)*

My next move would be to try xsane.  I believe that it uses sane-find-scanner, so it should find it ok, and may give something more useful than i/o error!

T

* I hope this isn't condecending!  I never know what people have(n't) done before.

----------

## qwkbrnfox

I just looked at the plustek mailing list, and it seems that the 1260 is _not_ supported in sane version 1.0.8, so if you haven't upgraded to 1.0.9, give that a whirl.

----------

## qwkbrnfox

This came from the list:

> export SANE_DEBUG_PLUSTEK=12

> scanimage -L

>

It seems to give more info...

T

----------

## uncle_meat

 :Arrow:   Yes, upgrading to version 1.0.9 does the trick.  (Note to anyone trying this: you have to add /usr/local/bin to your PATH for the compile/install to work)  I hope there'll be an ebuild for sane-1.0.9 soon.

Hotplug capability would be nice, but I'll save that for another thread.  Thank you very much for your help!

----------

## uncle_meat

Satisfied that my scanner was working, I shut down my computer and went off to relieve the stress of struggling with Gentoo all day... then I came back just now, rebooted, carefully insmod'd the scanner because hotplug doesn't do anything, and my scanner is no longer recognized by scanimage -L (sane-find-scanner does find it).  So I can't scan.

Okay, I'm annoyed now.

What gives?  Why did it mysteriously stop working?  How can I fix it, and prevent it from unfixing itself?

 :Evil or Very Mad: 

----------

## uncle_meat

I've been trying several combinations of turning my computer on, then plugging in the scanner then turning it on then insmod'ing the modules... or turning on the scanner then plugging it in then turning the computer on... or plugging in the scanner, turning on the computer then insmod'ing then turning on the scanner... nothing.

Still doesn't work.  It worked for a brief period yesterday, then I turned off my computer and I can't get the scanner working again.

----------

## uncle_meat

I didn't remove any software or add any software after getting the scanner to work.  I merely shut down the computer.  After a few hours, I simply booted up, again not installing or removing anything.

A working configuration somehow stopped working between power down and power up a few hours later.  I don't get it!

----------

## qwkbrnfox

Back to square one!  Does the scanner show up in /dev/usb/scanner0?  Anything funny in dmesg?  If you do have /dev/usb/scanner0, try the SANE_DEBUG_PLUSTEK thing.

----------

## uncle_meat

 *qwkbrnfox wrote:*   

> Back to square one!  Does the scanner show up in /dev/usb/scanner0?  Anything funny in dmesg?  If you do have /dev/usb/scanner0, try the SANE_DEBUG_PLUSTEK thing.

 

Okay, apparently what's happened is that BEFORE, scanimage was using /etc/sane.d for its configuration files, but now, it's using /usr/local/etc/sane.d

I don't understand why it's changed, but the SANE_DEBUG_PLUSTEK helped me pin down this problem.  It looks like it's working now.  Thanks again...

----------

## qwkbrnfox

Out of curiosity, did you use a new ebuild to make sane 1.0.9, or download and build by hand?  The latter would explain why there was a change in the location of the config file.

Glad I could be of assistance!

T

----------

## uncle_meat

 *qwkbrnfox wrote:*   

> Out of curiosity, did you use a new ebuild to make sane 1.0.9, or download and build by hand?  The latter would explain why there was a change in the location of the config file.

 

Right... but the thing is, everything worked just fine yesterday before rebooting...

So I guess what happened is that the scanimage I was using yesterday was from a Gentoo package.  It didn't get removed when I unmerged sane-frontends and sane-backends.

----------

