Re: Problem with SANE and SCSI scanner

Douglas Gilbert (dgilbert@interlog.com)
Mon, 29 Nov 1999 09:01:50 -0500

Manuel Panea wrote:
>
> -----BEGIN PGP SIGNED MESSAGE-----
>
> Hi, Laura and everyone who has followed this thread.
>
> I have put together all things which Laura has tried. I find the results
> puzzling:
>
> 1) Is Linux seeing the scanner? Yes:
>
> > sh-2.03$ cat /proc/scsi/scsi
> > Attached devices:
> > Host: scsi0 Channel: 00 Id: 02 Lun: 00
> > Vendor: CANON Model: IX-06015C Rev: 2.02
> > Type: Scanner ANSI SCSI revision: 02
>
> 2) Does "find-scanner" find the scanner? Yes:
>
> > [root@c554912-a ldewitt]# find-scanner
> > find-scanner: found scanner "CANON IX-06015C 2.02" at device /dev/sg0
> > find-scanner: found scanner "CANON IX-06015C 2.02" at device /dev/sga
>
> 3) Does "scanimage" find the scanner? No!:
>
> > [root@c554912-a ldewitt]# scanimage --list-devices
>
> > sh-2.03$ scanimage -d /dev/sga
> > scanimage: open of device /dev/sga failed: Invalid argument
>
> > sh-2.03$ scanimage -d /dev/sg0
> > scanimage: open of device /dev/sg0 failed: Invalid argument
>
> 4) Why not? Let's see some debugging information:
>
> > sh-2.03$ export SANE_DEBUG_CANON=128
> > sh-2.03$ scanimage --list-devices
> > [sanei_init_debug]: Setting debug level of canon to 128.
> > [canon] >> sane_init
> > [canon] sane_init: sane 1.0.1
> > [canon] >> attach_one
> > [canon] >> attach
> > [canon] attach: opening /dev/scanner
> > [canon] attach: open failed: Access to resource has been denied
> > [canon] << attach_one
> > [canon] << sane_init
> > [canon] >> sane_get_devices
> > [canon] << sane_get_devices
> > [canon] >> sane_exit
> > [canon] << sane_exit
>
> 5) Aha! Maybe she tried "find-scanner" as root and "scanimage" as a
> normal user, so she has no access to the device? Wrong! See the
> devices:
>
> > [root@c554912-a ldewitt]# ls -l /dev/sg0 /dev/sga
> > lrwxrwxrwx 1 root root 3 Nov 10 03:57 /dev/sg0 -> sga
> > crwxrwxrwx 1 root cdwriter 21, 0 May 5 1998 /dev/sga
> >
> > [root@c554912-a ldewitt]# ls -l /dev/scanner
> > lrwxrwxrwx 1 root root 8 Nov 24 19:54 /dev/scanner -> /dev/sga
>
> I checked the "find-scanner" sources and the SANE sources to see in what
> way they could be doing things differently. But they do the same thing,
> namely:
>
> sanei_scsi_open(devname, &fd, NULL, NULL);
>
> Apparently, on Laura's system, this works for "find-scanner" but not
> for "scanimage". This, of course, is impossible, but Laura's system
> doesn't seem to care.
>
> Does anyone know how this could be happenning?
>
> Just to be sure, I would ask Laura to try the following things, in this order,
> and tell us what the output is:
>
> 1) Switch on the scanner, then the computer, then log in as "root".
>
> 2) Do 'cat /proc/scsi/scsi'
>
> 3) Do 'find-scanner'
>
> 4) Do 'export SANE_DEBUG_CANON=128' and 'export SANE_DEBUG_SANEI=128', then
> 'scanimage --list-devices'
>
> 5) Do 'scanimage -d canon:/dev/sga'
>
> 6) Do 'ls -l /dev/sga /dev/scanner'

Perhaps "strace" may help to find exactly which file
name/handle gives the EACCES and EINVAL errors. So
to this list I would like to add:

5a) Do 'strace scanimage -d canon:/dev/sga'

Then perhaps the strace output around the lines:
[canon] attach: opening /dev/scanner
[canon] attach: open failed: Access to resource has been denied

would be interesting.

Doug Gilbert

--
Source code, list archive, and docs: http://www.mostang.com/sane/
To unsubscribe: echo unsubscribe sane-devel | mail majordomo@mostang.com