[sane-devel] devfs and scanner detection

Mr E_T troll@logi.net.au
Mon, 18 Aug 2003 08:25:35 +0800 (WST)


On Sun, 17 Aug 2003, Henning Meier-Geinitz wrote:

> Hi,
>
> On Sun, Aug 17, 2003 at 10:37:51PM +0800, Mr E_T wrote:
> > The problem as I said is that the usb module does a directory listing b4 opening
> > the device file Whereas it should just try opening it.
>
> It shouldn't. If the device file is not there, SANE thinks there is no
> device. SANE can't open all possible device files because the kernel
> takes too long. We did this in earlier versions but wainting more than
> 30 seconds for a "scanimage -L" when devfs is used is just not
> acceptable.
>
> Shouldn't hotplug care for autoloading the scanner module when the
> scanner is plugged in? If that doesn't work for some reason, you could
> also add a link /dev/usb/scanner --> /dev/usb/scanner0.
>
> > This should cause the kernel to attempt to create the device if it does not
> > exist.
>
> The only way to find out quickly if a device (possibly) exists with
> devfs is to look if the device file is there.
>

Instead of doing a dir listing - why dont you just "stat" the file - if stat
works then the file exists - else it doesnt.

This should provide the required device listing and prep the kernel that the
device is required.

Hotplugging is ok for devices that get plugged in and out and are required
straight away. But what about devices that are always plugged in and not always
used.

The idea for autoloading of modules is that the driver is loaded when required
and unloaded other times.

The cups printer driver scans serial, parrallel, usb and scsi by using this
method and causes the usb printer module to autoload with no great loss of
speed.

 --
regs MR E_T
_______________________
\                      \
  \   OOHH I hate TYPOS  \
    \                      \
      ~~~~~~~~~~~~~~~~~~~~~~~