Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Installing USB Scanner - HOWTO
View unanswered posts
View posts from last 24 hours

Goto page 1, 2  Next  
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
Joseph_sys
Advocate
Advocate


Joined: 08 Jun 2004
Posts: 2571
Location: Edmonton, AB

PostPosted: Sun Aug 15, 2004 8:26 pm    Post subject: Installing USB Scanner - HOWTO Reply with quote

Due to lack of decent installation instructions, I decided to write a short but complete how-to on installing USB scanner in Gentoo for kernel 2.6.4 and higher. There is already a lot of information around but none of them is complete and in some cases not applicable to kernel 2.6.4 and higher.

To install USB Scanner in Gentoo (kernel 2.6.4 & higher) follow the steps below:

Note that all of these information is based on assumption that SANE supports your scanner. You will find a list of SANE supported scanners at:
http://www.sane-project.org/sane-supported-devices.html

1.) Before emerging any packages make sure you have "USE=usb" variable in your /etc/make.config; if not add "usb" variable using your favorable editor.

The packages we will need are:
libusb
sane-backends
hotplug

Check if you have any of them intalled:
Code:
# emerge -s libusb sane-backends hotplug


2.) Make sure you have USB support in your kernel:
(the option you select will depend on your motherboard shipset, select "OHCI HCD" or "UHCI HCD") check your manual or select both options and see which one your motherboad will recognize (might not be the professional way of doing it but it will work if you have no manual or not sure which chipset you have).

In my case above I've VT82xxxxx motherboard with UHCI support so I selected the kernel below: "UHCI HCD"

Code:
# cd /usr/src/linux
# make menuconfig

Device Drivers  --->
    USB support  --->
        <*>   EHCI HCD (USB 2.0) support
   < >   OHCI HCD support
        <*>   UHCI HCD (most Intel and VIA) support


Save and compile the kernel if you made any changes, upload and reboot.

NOTE: I compiled the options into kernel though you can compile it as Modules <M>

Connect your scanner to USB port when you issue a command:
Code:
# cat /proc/bus/usb/devices
(you should see similar output).

T: Bus=02 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#= 1 Spd=12 MxCh= 2
B: Alloc= 0/900 us ( 0%), #Int= 0, #Iso= 0
D: Ver= 1.10 Cls=09(hub ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1
P: Vendor=0000 ProdID=0000 Rev= 2.06
S: Manufacturer=Linux 2.6.7-gentoo-r11 uhci_hcd
S: Product=VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1 Controller (#2)
S: SerialNumber=0000:00:11.3
C:* #Ifs= 1 Cfg#= 1 Atr=c0 MxPwr= 0mA
I: If#= 0 Alt= 0 #EPs= 1 Cls=09(hub ) Sub=00 Prot=00 Driver=hub
E: Ad=81(I) Atr=03(Int.) MxPS= 2 Ivl=255ms

T: Bus=02 Lev=01 Prnt=01 Port=01 Cnt=01 Dev#= 3 Spd=12 MxCh= 0
D: Ver= 2.00 Cls=ff(vend.) Sub=ff Prot=ff MxPS=64 #Cfgs= 1
P: Vendor=04b8 ProdID=011b Rev= 1.00
S: Manufacturer=EPSON
S: Product=EPSON Scanner
C:* #Ifs= 1 Cfg#= 1 Atr=c0 MxPwr= 2mA
I: If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
E: Ad=81(I) Atr=02(Bulk) MxPS= 64 Ivl=0ms
E: Ad=02(O) Atr=02(Bulk) MxPS= 64 Ivl=0ms

(you might or might not have a USB 2 support, it depends on your motherboard). Though at this point you should notice on "P" section (of the EPSON Scanner) the output: Vendor=04b8 ProdID=011b (you might have different values depending on your scanner model). Write it down as you will use this output in some configuration files later on.

3.) Next, you will emerge libusb, sane-backends and hotplug
Code:
# emerge libusb


4.)
Code:
# emerge sane-backends


If you have sane-backends installed, check as it is important that sane-backends is compiled with usb support.
Quick check: was sane-backends compiled with the usb USE flag? etcat should have "+ + besides usb" like:
Code:
Code:
# etcat -u sane-backends
[ Colour Code : set unset ]
[ Legend   : (U) Col 1 - Current USE flags        ]
[          : (I) Col 2 - Installed With USE flags ]

 U I [ Found these USE variables in : media-gfx/sane-backends-1.0.14-r3 ]
 + + usb     : Adds USB support to applications that have optional USB support (e.g. cups)
 + + gphoto2 : Adds digital camera support


If not re-emerge sane-backend with USE="usb" in your make.conf file.

5.)
Code:
# emerge hotplug


Edit /etc/hotplug/usb.usermap
Code:
# nano -w /etc/hotplug/usb.usermap


This section is straight copy from: http://khk.net/sane/libusb.html where you will find more information.
Quote:
-------- copy ------------
You have to add one or more lines (for one or more scanners) to the file /etc/hotplug/usb.usermap. Every line in this file is for one device, the line starts with a name that will also be used for a handler script. We are trying to get an EPSON scanner working, so let's call the entry "epson_scanner". The next entry is always 0x0003, and I don't know - and don't care - what it stands for, so let's just keep it set to 0x0003. The following two entries are the vendor ID (0x4b8 for EPSON) and the product ID (e.g. 0x11c for the Perfection 3200). The remaining fields are all set to 0, so let's just add the following after the product ID: 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000

You can make this a lot simpler by just copying an existing line and replacing the script name and the two IDs. The line for the Perfection 3200 should look like this (the whole string should be on one line, I split it up so that it does not make this page unreasonable wide):

epson_scanner 0x0003 0x04b8 0x011b 0x0000 0x0000
0x00 0x00 0x00 0x00 0x00
0x00 0x00000000

I already mentioned a handler script that gets started when the device is connected or disconnected. Save the following script as /etc/hotplug/usb/epson_scanner

------- epson_scanner --------------
Code:
#!/bin/bash

if [ "${ACTION}" = "add" ] && [ -f "${DEVICE}" ]
then
        chown root "${DEVICE}"
        chgrp scanner "${DEVICE}"
        chmod 660 "${DEVICE}"
fi

--------- epson_scanner -----------
------------end copy ---------------


IMPORTANT: make this script executable
Code:
# chmod 755 /etc/hotplug/usb/epson_scanner


Next, edit /etc/fstab and add entry
Code:
# Scanner
none   /proc/bus/usb   usbfs           defaults,devmode=0666   0 0


6.) Edit /etc/sane.d/epson.conf and comment out the entry "scsi EPSON" by default this entry is uncommented; add the following line:
Code:
usb 0x4b8 0x011b
#make sure these numbers match your scanner manufacture and ID you wrote earlier

Code:
# rc-update add hotplug default
# /etc/init.d/hotplug start


Plug-in back your scanner to USB port.

If you type sane-find-scanner you should see:
Code:
# sane-find-scanner


Quote:
# No SCSI scanners found. If you expected something different, make sure that
# you have loaded a SCSI driver for your SCSI adapter.

found USB scanner (vendor=0x04b8 [EPSON], product=0x011b [EPSON Scanner]) at libusb:001:003
# Your USB scanner was (probably) detected. It may or may not be supported by
# SANE. Try scanimage -L and read the backend's manpage.

# Not checking for parallel port scanners.

# Most Scanners connected to the parallel port or other proprietary ports
# can't be detected by this program.

# You may want to run this program as root to find all devices. Once you
# found the scanner devices, be sure to adjust access permissions as
# necessary.


7.) One last importand change, when you emerge xsane the program will add group scanner to your /etc/group file. At the end of the file you will find (your number might be different - DO Not change this number):
scanner:x:408:

add to the end root and yourself (or any other users that will have access to the scanner):
scanner:x:408:root,joseph

Exit and login your session for group to take effect.

Now in console as user type:
In console type groups
$ groups
tty wheel uucp audio games users scanner

Make sure you see "scanner" word above.

Code:
$ xsane


Now, you should have a working scanner, scan anything to your heart's content. enjoy :-)
If you find that I missed anything or your scanner requires an additional configuration post your message here with additional instructions.

Final ERROR NOTES:
Sometimes when you restart your hotplug you will get an error:
Starting usb hotplugging...
chown: cannot access `/proc/bus/usb/001/005': No such file or directory
chmod: cannot access `/proc/bus/usb/001/005': No such file or directory

See this thread:
https://forums.gentoo.org/viewtopic.php?t=172556
and bug report:
https://bugs.gentoo.org/show_bug.cgi?id=50934

If you have a solutions share it with us, I was not able to resolve this bug.
_________________
#Thelma
Back to top
View user's profile Send private message
gcostanz
n00b
n00b


Joined: 24 Feb 2003
Posts: 69
Location: Hilton, New York

PostPosted: Sun Aug 15, 2004 9:37 pm    Post subject: Reply with quote

Awesome, awesome, awesome!

I can't thank you enough. I have not been able to scan as a user (non-root) since I upgaded my kernel. This worked great the first time.

Thanks!
Back to top
View user's profile Send private message
eWoud
n00b
n00b


Joined: 06 Jul 2002
Posts: 20

PostPosted: Sun Sep 12, 2004 2:58 pm    Post subject: Reply with quote

sane-backend provides its own libusbcanner in /etc/hotplug/usb, so there's no need to make your own
just add 'libusbscanner' to /etc/hotplug/usb.usermap
(you don't have to find out those weird numbers, everything is handled by the libusbscanner script)

Also editing /etc/fstab and /etc/sane.d/<vendor>.conf shouldn't be necessary :-)

so here's my howto:

put all the necessary usb stuff in your kernel (or let genkernel do it for you)
Code:
USE="usb" emerge sane-backends hotplug
rc-update add hotplug default

add 'libusbscanner' as a new line in /etc/hotplug/usb.usermap
Code:
/etc/init.d/hotplug start


don't forget to add your user to the scanner group

done :)

now, you need a frontend, like xsane:

Code:
emerge xsane


testing:

Code:
xsane
Back to top
View user's profile Send private message
anj
n00b
n00b


Joined: 26 Mar 2004
Posts: 1
Location: France / EU

PostPosted: Sat Sep 25, 2004 9:12 am    Post subject: Thank you Reply with quote

I've spent eons trying to find why my scanner was not seen by sane-find-scanner.
This howto was the first really helfull !!!
It works !!!
I did not have "usb" in my USE parameters !

Thank you so much. :idea:
Back to top
View user's profile Send private message
j_c_p
Guru
Guru


Joined: 30 Aug 2003
Posts: 315
Location: France - Colmar

PostPosted: Mon Oct 04, 2004 6:41 pm    Post subject: Reply with quote

Quote:
Final ERROR NOTES:
Sometimes when you restart your hotplug you will get an error:
Starting usb hotplugging...
chown: cannot access `/proc/bus/usb/001/005': No such file or directory
chmod: cannot access `/proc/bus/usb/001/005': No such file or directory

To solve that, you can put into /etc/conf.d/local.start :
Quote:
chmod 0666 /proc/bus/usb/001/*

it's not beautiful but it works :D.
Back to top
View user's profile Send private message
alarmcall
n00b
n00b


Joined: 06 Jul 2004
Posts: 22

PostPosted: Wed Nov 24, 2004 11:59 am    Post subject: Epson Perfection 1250 Reply with quote

First off: To "Joseph-sys" thanks a lot for this How-To - at last a fully working system!

Just thought I'd share this problem I had (and solution :wink: ) with you all.

I have an Epson Perfection 1250, which after completing all the steps above results in xsane taking a very long time to start, whilst "searching for devices". When I tried to aquire preview it returns an error "Device Busy" and it will not scan at all :sad:

Now issuing "sane-find-scanner" results in the following:
Code:

$ sane-find-scanner

found USB scanner (vendor=0x04b8 [EPSON], product=0x010f [EPSON Scanner 010F], chip=LM9832/3) at libusb:002:002

However, typing "scanimage -L" at the CMD is much more revealling:
Code:

$ scanimage -L

device `plustek:libusb:002:002' is a Epson Perfection 1250/Photo USB flatbed scanner

Hmmm, plustek....Apparently the Epson uses the same chipset (National Semiconductor LM9832) as Plustek, see the link below for more details:

http://www.gjaeger.de/scanner/plustek/

So, in order to get the scanner working properly, the solution is not bother with point 6 in the How-To:

Code:

6) Edit /etc/sane.d/epson.conf and comment out the entry "scsi EPSON" by default this entry is uncommented; add the following line:

usb 0x4b8 0x011b



Simply comment out the line containing the word "epson" from the dll.conf file:
Code:

nano -w /etc/sane.d/dll.conf
...
dmc
#epson
fujitsu
...


Bingo! a working scanner and xSane front-end :D
Back to top
View user's profile Send private message
_AbYsS_
n00b
n00b


Joined: 23 Jan 2004
Posts: 18

PostPosted: Wed Nov 24, 2004 10:10 pm    Post subject: Reply with quote

j_c_p wrote:
Quote:
Final ERROR NOTES:
Sometimes when you restart your hotplug you will get an error:
Starting usb hotplugging...
chown: cannot access `/proc/bus/usb/001/005': No such file or directory
chmod: cannot access `/proc/bus/usb/001/005': No such file or directory

To solve that, you can put into /etc/conf.d/local.start :
Quote:
chmod 0666 /proc/bus/usb/001/*

it's not beautiful but it works :D.


I doubt this solves the pb, because /etc/conf.d/local.start is run after hotplug so ... but I will try nevertheless

And thanks joseph for your how-to it's great ;)
_________________
AbYsS
Back to top
View user's profile Send private message
totopo
n00b
n00b


Joined: 29 Sep 2004
Posts: 73
Location: Austria

PostPosted: Wed Dec 01, 2004 10:16 pm    Post subject: Worked with hpoj Reply with quote

Hello I have a HP OfficeJet v40, I followed the instructions but never detected the scanner, it worked when I emerged xsane and uncommented hpoj in the file:

/etc/sane.d/dll.conf


hope it works if someone is facing problems.

Regards

Marco
Back to top
View user's profile Send private message
hadoque
Apprentice
Apprentice


Joined: 09 Sep 2004
Posts: 150
Location: Stockholm, Sweden

PostPosted: Thu Dec 02, 2004 10:03 pm    Post subject: Reply with quote

I've been trying to install my USB scanner from canon, which actually wen't great until I restarted my machine. I've followed the steps in this thread and the scanner works like it should.

When I restart I'm getting two errors messages. The first one is:
Code:

mount: mount point /proc/bus/usb does not exist


But when the system is started the mount point is mounted, and if I remount it there is no error.
The second error is:
Code:

/etc/hotplug/usb.agent: line 259: 04a9: Value too great for base (error token is "04a9")



When the sysetm is started xsane cannot find the scanner, but if i restart hotplug everything works perfectly. Does anyone have any suggestions on how to fix this?
Back to top
View user's profile Send private message
kmarasco
n00b
n00b


Joined: 25 Jul 2003
Posts: 65
Location: Fernandina Beach, FL

PostPosted: Sat Dec 04, 2004 12:31 am    Post subject: One other issue Reply with quote

Follow eWoud's instructions. You don't need to mess with much of the stuff in the initial how to.

Still, you may run into a situation where you cannot access the scanner except as root, unless you unplug and replug in the scanner after booting.

This is probably because you have not emerged "coldplug." Not too long ago hotplug was split into to progs, hotplug and coldplug. Coldplug handles devices on boot. So,
Code:
emerge coldplug
rc-update add coldplug boot

Then be sure to get rid of the stuff in fstab if you added something there, and reboot. FYI, I'm using udev to manage my devices.
Back to top
View user's profile Send private message
xanderhsia
n00b
n00b


Joined: 08 Jul 2004
Posts: 34

PostPosted: Sun Dec 05, 2004 10:52 pm    Post subject: excellent howto! Reply with quote

Followed it and had success on first try. Kudos to the author.

But (there is always one isn't there?), I am getting an error everytime I try to save an image that xsane captures. As soon as it saves it, xsane exits with an error as follows
Code:

*** glibc detected *** double free or corruption (!prev): 0x082fa880 ***


Anybody have a clue as to what this is? Or should I start another thread for this.

Thanks all.
Back to top
View user's profile Send private message
markandrew
Apprentice
Apprentice


Joined: 04 Feb 2004
Posts: 176
Location: Manchester, UK

PostPosted: Sun Dec 12, 2004 1:18 am    Post subject: Reply with quote

what to do if you don't use sane? i use vuescan with libusb, and can only access my scanner with root. i don't have anything sane-related installed; the devmode edit for fstab seems to do nothing. any ideas?
Back to top
View user's profile Send private message
nephros
Advocate
Advocate


Joined: 07 Feb 2003
Posts: 2139
Location: Graz, Austria (Europe - no kangaroos.)

PostPosted: Sun Dec 12, 2004 6:05 pm    Post subject: Re: excellent howto! Reply with quote

xanderhsia wrote:
Code:

*** glibc detected *** double free or corruption (!prev): 0x082fa880 ***

Anybody have a clue as to what this is? Or should I start another thread for this.

lookie here:
https://forums.gentoo.org/viewtopic.php?p=1871330

I'd guess sane is calling ImageMagicks "display" tool to show images and hits the same error.
_________________
Please put [SOLVED] in your topic if you are a moron.
Back to top
View user's profile Send private message
NightDragon
Veteran
Veteran


Joined: 21 Aug 2004
Posts: 1150
Location: Vienna (Austria)

PostPosted: Fri Dec 17, 2004 10:50 pm    Post subject: Reply with quote

If the same Problem like above...
CanoScan 5000F

Found by sane-find-scanner
but not by the scanimage -L command.

I know the Scanner isn't supported on sane at the moment... ... but maybe has someone good infos?


Greets,
Nighty
Back to top
View user's profile Send private message
lazarusrat
Guru
Guru


Joined: 17 Jul 2002
Posts: 305
Location: Lafayette, IN

PostPosted: Wed Dec 22, 2004 12:30 pm    Post subject: Reply with quote

I was having the same problem with vanilla 2.6.9 and 2.69.-cksomething, where the libusbscanner script and scanimage -L had different values (001/003 vs. 002/003). Attempting to fix another problem, I recompiled the kernel with UHCI, EHCI, and agpgart as modules (they were compiled in) and added pci=routeirq to the boot arguments. It works now. The libusbscanner script and sane-find-scanner and scanimage -L all show it as 001/003.
Not sure which of those changes did the trick.
_________________
obpiper: pipe menu generator for openbox
obtheme: pipe menu to switch openbox themes
Back to top
View user's profile Send private message
evan18h
Tux's lil' helper
Tux's lil' helper


Joined: 02 Dec 2004
Posts: 83

PostPosted: Thu Dec 23, 2004 8:11 am    Post subject: Reply with quote

thanks so much eWoud, Joseph_sys and alarmcall... I have been trying to get my Epson Perfection 1250 to work for a few days now... I tried everything and couldn't figure out why it wouldn't work! But now It works and I a very happy :D ... really, i can't belive it was something this simple

Last edited by evan18h on Fri Jan 07, 2005 3:45 am; edited 1 time in total
Back to top
View user's profile Send private message
Tamerz
Apprentice
Apprentice


Joined: 29 Apr 2003
Posts: 232
Location: Chicago IL, USA

PostPosted: Tue Dec 28, 2004 2:53 am    Post subject: Reply with quote

Not quite sure what isn't working here. I followed the steps above and the scanner is being detected but xsane says no devices found. It does however detect my TV tuner as a device when I load the module for it.

Code:
# scanimage -L
device `v4l:/dev/video0' is a Noname BT878 video (Leadtek WinFast 20 virtual device
device `artec_eplus48u:libusb:002:005' is a Memorex MEM 48U USB flatbed scanner
Back to top
View user's profile Send private message
sidkdbl07
Apprentice
Apprentice


Joined: 25 May 2003
Posts: 184

PostPosted: Tue Dec 28, 2004 9:05 pm    Post subject: Reply with quote

I can run xsane as root but not as my user

in /etc/group
Quote:

...
scanner:x:407:sid
...
Back to top
View user's profile Send private message
MrBrightside
n00b
n00b


Joined: 06 Jan 2005
Posts: 19
Location: Georgia

PostPosted: Fri Jan 07, 2005 3:35 am    Post subject: Reply with quote

I followed this instruction guide and I still can't get my HP Scanjet 5400C to work. The scanner is detected by sane-find-scanner and I edited all of the config files, but scanimage doesn't find my scanner. I'm not sure what's wrong with it. Anyone have any ideas?
Back to top
View user's profile Send private message
Tamerz
Apprentice
Apprentice


Joined: 29 Apr 2003
Posts: 232
Location: Chicago IL, USA

PostPosted: Sat Jan 08, 2005 3:23 am    Post subject: Reply with quote

MrBrightside wrote:
I followed this instruction guide and I still can't get my HP Scanjet 5400C to work. The scanner is detected by sane-find-scanner and I edited all of the config files, but scanimage doesn't find my scanner. I'm not sure what's wrong with it. Anyone have any ideas?


Sounds like the same problem I have above. What does scanimage -L give you?
Back to top
View user's profile Send private message
MrBrightside
n00b
n00b


Joined: 06 Jan 2005
Posts: 19
Location: Georgia

PostPosted: Sat Jan 08, 2005 7:23 pm    Post subject: Reply with quote

Scanimage -L gives me:

Code:

No scanners were identified. If you were expecting something different, check that the scanner is plugged in, turned on and detected by the sane-find-scanner tool (if appropriate). Please read the documentation which came with this software (README, FAQ, manpages).
Back to top
View user's profile Send private message
Tamerz
Apprentice
Apprentice


Joined: 29 Apr 2003
Posts: 232
Location: Chicago IL, USA

PostPosted: Sat Jan 08, 2005 7:34 pm    Post subject: Reply with quote

Hmm... not the same then. Sorry I can't help. I can't even get mine working even though it is detected by scanimage.
Back to top
View user's profile Send private message
Gentree
Watchman
Watchman


Joined: 01 Jul 2003
Posts: 5350
Location: France, Old Europe

PostPosted: Sat Jan 29, 2005 9:15 pm    Post subject: Reply with quote

how about some version into here. "my scanner does not work" approach is a bit vague.

version no.s for sane sane-backends libusb udev may help narrow it down.

Like all of you I have issues that seem to come and go every few months, you debug it, it works fine then it gets blown away and you start again.

version numbers gentlemen.

emerge -p sane sane-backends libusb udev glibc

(any others you think may be relevant)

8)
_________________
Linux, because I'd rather own a free OS than steal one that's not worth paying for.
Gentoo because I'm a masochist
AthlonXP-M on A7N8X. Portage ~x86
Back to top
View user's profile Send private message
dr_rockstar66
n00b
n00b


Joined: 10 Nov 2003
Posts: 41

PostPosted: Thu Feb 24, 2005 9:56 pm    Post subject: Reply with quote

WORKS LIKE A CHARM, THANKS A TON!!!!!!

EPSON 1200U
Back to top
View user's profile Send private message
WL(inux)
n00b
n00b


Joined: 15 Jan 2004
Posts: 64
Location: Vienna

PostPosted: Tue Mar 08, 2005 6:55 pm    Post subject: Reply with quote

sidkdbl07 wrote:
I can run xsane as root but not as my user

in /etc/group
Quote:

...
scanner:x:407:sid
...


I have more or less the same problem ...

I can RUN and SCAN as root
but as a normal User i cannot scan ... i think it is only a Permission Problem ... i tried to influence the rights manually but i doesnt work either :-(
Somebody can scan as normal user ? please send me a Private message or answer here please !!!
_________________
http://www.ViennaLinux.at - Linux User Group Wien
please look @ http://Forum.ViennaLinux.at
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum