[sane-devel] Epson Perfection 1650 on FreeBSD

Henning Meier-Geinitz henning@meier-geinitz.de
Fri, 25 Jan 2002 22:55:08 +0100


Hi,

On Thu, Jan 24, 2002 at 04:04:31PM -0800, JJ Behrens wrote:
> I'm not able to get scanimage to scan an image on my Epson Perfection 1650
> under FreeBSD. I get the following error message:
[...]

> Jan 24 15:41:04 tcp /kernel: uscanner0: EPSON EPSON Scanner, rev
> 1.00/1.08, addr 2

Looks fine. Is there a device /dev/uscanner0 (or whatever you call it)
with the correct major and minor device numbers? Is this file listed
in epson.conf?

> I used truss to do a kernel trace while debugging was turned on,
> and I get the following:
> 
> open("/dev/uscanner0",2,02001)                   = 3 (0x3)
> ioctl(3,CAMGETPASSTHRU,0xbfbfd614)               ERR#22 'Invalid argument'

I'm not sure but isn't "cam" the FreeBSD generic SCSI interface? Maybe
something tries to acces your scanner as a SCSI device. Be sure to NOT
have a link from /dev/scanner to your USB device. Double-check that in
epson.conf there is only a line "usb /dev/uscanner" (or similar). To
be sure that no other backend makes trouble, you can disable
everything but epson in dll.conf.

> int
> uscannerioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc
> *p)
> {
> 	return (EINVAL);
> }
> 
> Hence, it's not proper to do an IOCTL for USB scanners under FreeBSD. 

The ioctls for USB scanners with Linux are used to detect vendor and
product ids and to send control messages. However, sanei_usb.c (and
the backends that use ioctls directly) should only use them with Linux.

> The remainder of this email contains the result of using truss with full
> debugging turned on. Thank you all very much for any help you can provide.

Which command did you run exactly? "scanimage -d epson:/dev/uscanner0"?

[...]
> open("/usr/local/etc/sane.d/epson.conf",0,0666)	 = 3 (0x3)

now reading the config file ...
[...]

> sane_init, >scsi EPSON<
> write(2,0xbfbfe9fc,24)				 = 24 (0x18)
> fstat(2,0xbfbff074)				 = 0 (0x0)
> [epson] write(2,0xbfbfe9dc,8)				 = 8 (0x8)
> sane_init, >scsi EPSON<
> write(2,0xbfbfe9fc,24)				 = 24 (0x18)
> open("/dev/xpt0",2,027757770304)		 = 4 (0x4)
> break(0x805d000)				 = 0 (0x0)
> break(0x805e000)				 = 0 (0x0)
> ioctl(4,CAMIOCOMMAND,0xbfbff020)		 = 0 (0x0)
> close(4)					 = 0 (0x0)

Tried to open a SCSI scanner...
[...]

> sane_init, >#usb /dev/usbscanner0<

Why is this one commented out?

> write(2,0xbfbfe9fc,35)				 = 35 (0x23)
> read(0x3,0x8052000,0x2000)			 = 0 (0x0)
> close(3)					 = 0 (0x0)
> fstat(2,0xbfbff4b4)				 = 0 (0x0)
> [dll] write(2,0xbfbfee1c,6)				 = 6 (0x6)
> init: backend `epson' is version 1.0.212

sane_init is finished. Looks like it couldn't find an epson scanner at
all. Probably because you didn't remove the "#" in front of the "usb"
entry?

> write(2,0xbfbfee3c,41)				 = 41 (0x29)
> fstat(2,0xbfbff4c4)				 = 0 (0x0)
> [epson] write(2,0xbfbfee2c,8)				 = 8 (0x8)
> sane_open(/dev/uscanner0)

Now sane_open is called with the name "/dev/usbscanner0". For some
reason, the epson backend seems to think it's a SCSI scanner.

> write(2,0xbfbfee4c,26)				 = 26 (0x1a)
> fstat(2,0xbfbfdc34)				 = 0 (0x0)
> [epson] write(2,0xbfbfd59c,8)				 = 8 (0x8)
> SANE Epson Backend v0.2.12 - 2001-10-28
> write(2,0xbfbfd5bc,40)				 = 40 (0x28)
> fstat(2,0xbfbfdc24)				 = 0 (0x0)
> [epson] write(2,0xbfbfd58c,8)				 = 8 (0x8)
> attach(/dev/uscanner0)
> write(2,0xbfbfd5ac,23)				 = 23 (0x17)
> fstat(2,0xbfbfdc34)				 = 0 (0x0)
> [epson] write(2,0xbfbfd59c,8)				 = 8 (0x8)
> attach: opening /dev/uscanner0
> write(2,0xbfbfd5bc,31)				 = 31 (0x1f)
> open("/dev/uscanner0",2,02001)			 = 3 (0x3)
> ioctl(3,CAMGETPASSTHRU,0xbfbfd620)		 ERR#22 'Invalid argument'

That's why it uses this ioctl on the device.

In reality, I don't know the epson backend at all and don't own any
epson scanner. So it's just a guess.

Bye,
  Henning