[sane-standard] SANE 2 driver suggestion

Donald Straney burntfuse at gmail.com
Wed Mar 7 23:41:35 CET 2007


Sorry for bringing up an old thread again, but here's an idea that
could solve the hardware detection problem in a simpler way, without
adding anything to the kernel or having all probing go through HAL:

Instead of using the sane_get_device_list call in most backends to
probe for devices, there could be another function,
sane_get_supported_devices, which would return a pointer to a
SANE_Supported_Devices struct.

typedef struct {
  int autodetect;  //1 if it can be autodetected, 0 if it needs to be
probed by the driver
  SANE_Bus bus;  //shows which bus the device is on
  char **id_list;  //a null-terminated list of IDs for the bus the
device is on -
                       // is there a better way to store this?
  sane_probe_func probe_func;  //the probe function to use if needed
} SANE_Supported_Devices;

Then, there could be a small program (sane-update-driverlist or
something similar) which would load each driver, get its supported
devices, and build a driver list in /etc/sane.d, which would list each
driver, whether it can be autodetected or not, and if it can the bus
and bus IDs.  That way, instead of having to load each driver in turn
for a simple device listing, sane_get_device_list in the dll backend
could just read the driver list, compare the bus IDs in it against a
list of PCI, USB, and other devices it gets from a bit of
platform-specific code (I don't know if libusb and the others can do
this, or if it would have to check in /proc or /sys on Linux), and
only load the drivers which need to manually probe the hardware.  To
keep the list up to date, RPM and .deb packages with additional SANE
drivers could run sane-update-driverlist as a post-install command.

Anyways, I'd definitely work on implementing it myself in SANE 2 if
you all agree.

Donald Straney



More information about the sane-standard mailing list