I really hope this information will help others as it was a real head scratcher for me. I have an HP Scanjet 6100C SCSI scanner attached to an Adaptec AHA-7850 based PCI SCSI card. I have never had much luck getting my scanner to work under Linux without having to change permissions on some device file which always seemed kind of wrong to me. I never believed that I should have to do that manually. I have spent hours reading posts on this forum with all of them basically saying to change the permissions on the device. Well I figured, especially with UDEV that there had to be a better way. And with a little bit of basic UDEV help from here I have found that way. Complete the instructions below and hopefully you too will soon be happily scanning in Ubuntu with your SCSI scanner...
First, load the SCSI Generic (sg) module.
Code:
gordo@neo:~ $ sudo modprobe sg
Next, add sg to the bottom of /etc/modules.
Code:
gordo@neo:~ $ sudo gedit /etc/modules
Code:
# /etc/modules: kernel modules to load at boot time.
#
# This file should contain the names of kernel modules that are
# to be loaded at boot time, one per line. Comments begin with
# a "#", and everything on the line after them are ignored.
psmouse
mousedev
ide-cd
ide-disk
ide-generic
lp
sg
Next, install the sane-utils package.
Code:
gordo@neo:~ $ sudo apt-get install sane-utils
Next, run sane-find-scanner to detect your scanner device.
Code:
gordo@neo:~ $ sudo sane-find-scanner
found SCSI processor "HP C2520A 3644" at /dev/sg0
# Your SCSI scanner was detected. It may or may not be supported by SANE. Try
# scanimage -L and read the backend's manpage.
found USB scanner (vendor=0x05a9, product=0xa511) at libusb:003: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
Next, run udevinfo as follows to find out the exact model name of your scanner substituting your scanners device for sg0.
Code:
udevinfo -a -p /sys/class/scsi_generic/sg0
Look for the line starting with "SYSFS{model}" as illustrated below then write down the exact model name ignoring any trailing spaces. For example the model name of my scanner is exactly "C2520A" minus the quotes.
Code:
follow the class device's "device"
looking at the device chain at '/sys/devices/pci0000:00/0000:00:1e.0/0000:02:03.0/host0/0:0:1:0':
BUS="scsi"
ID="0:0:1:0"
SYSFS{detach_state}="0"
SYSFS{device_blocked}="0"
SYSFS{model}="C2520A "
SYSFS{queue_depth}="2"
SYSFS{rev}="3644"
SYSFS{scsi_level}="3"
SYSFS{state}="running"
SYSFS{timeout}="0"
SYSFS{type}="3"
SYSFS{vendor}="HP "
Next, run the following to backup your current udev.rules file.
Code:
sudo cp /etc/udev/udev.rules /etc/udev/udev.rules.backup
Next, run the following to edit the udev.rules file.
Code:
sudo gedit /etc/udev/udev.rules
And below these two lines.
Code:
# permissions for SCSI sg devices
BUS="scsi", KERNEL="s[grt][0-9]*", SYSFS_type="5", NAME="%k", MODE="0660", GROUP="cdrom"
Add these two new lines substituting the exact model name of your scanner for C2520A. The SYMLINK="scanner" portion is optional. It is only needed if you actually want to have a /dev/scanner symlink that will always point to your actual scanner device.
Code:
# permissions for SCSI scanner
BUS="scsi", SYSFS{model}="C2520A", NAME="%k", SYMLINK="scanner", MODE="0660", GROUP="scanner"
Now make sure your user is a member of the scanner group, reboot then run XSane. Your SCSI scanner should hopefully be detected and working properly as a regular user.
But, just because this procedure works perfectly fine for me doesn't mean it will for you. Hopefully it will work for you. I am interested in hearing back from people about thier experiences. Also any constructive comments about this HOWTO are welcome and appreciated.
Gordo
Bookmarks