[sane-devel] HAL and scanners.
abel deuring
adeuring at gmx.net
Tue Mar 18 15:53:13 UTC 2008
Hi all,
On 18.03.2008 16:03, m. allan noah wrote:
> On Tue, Mar 18, 2008 at 10:24 AM, Étienne Bersac <bersace03 at gmail.com> wrote:
>> Hi,
>>
>> In january 2007, happened a very good discussion this list about SANE
>> and HAL wich led to shipping a basic fdi.
>> http://lists.alioth.debian.org/pipermail/sane-devel/2007-January/018343.html.
>>
>> Currently, sane-desc generate a very basic fdi which only badge device
>> as scanner and add a property "scanner.access_method" hardcoded to
>> "proprietary", the latter is pretty useless ;)
>>
>> Please keep in mind that supporting HAL does NOT mean depending on HAL
>> nor breaking API.
>>
>>
>> Abel Deuring did a very nice job on sane-fdi, a parser for .desc file
>> that provide much useful information right in the fdi. Sadly, the
>> discussion stopped without a lot of success. I updated the sane-fdi
>> script from Abel following the advice from Abel and Johannes Meixner.
>>
>> A device rule looks like :
>>
>> <device>
>> <match key="usb.vendor_id" int="0x04a9">
>> <match key="usb.product_id" int="0x2207">
>> <append key="info.capabilities" type="strlist">scanner</append>
>> <append key="scanner.api" type="strlist">sane</append>
>> <append key="scanner.sane.model" type="strlist">Canon CanoScan N1220U</append>
>> <append key="scanner.sane.backends" type="strlist">plustek</append>
>> <append key="scanner.sane.backends.plustek.supportstatus" type="strlist">complete</append>
>> <append key="scanner.sane.backends.plustek.comment" type="strlist">Identical to UMAX 3400</append>
>> </match>
>> </match>
>> </device>
>>
>> The updated sane-fdi script is available at
>> http://bersace03.free.fr/pub/Development/Scanner/sane-fdi .
>
> i've not looked at this code yet, but the output above seems reasonable.
>
>> There is still one thing needed to get full HAL support by SANE, build
>> the SANE device name from those infos.
>>
>> One goal would be to allow frontend to provide an entry for each backend
>> allowing user to select the backend to use. Using e.g. "Cannon CanoScan
>> N1220U (complete support with plustek driver)" along "Canon CanoScan
>> N1220U (complete support with umax driver)" will allow user to easily
>> select driver.
>>
>> According to discussion about HAL and SANE last year, seems that the
>> "udi:<backend>:<udi>" would be the solution for SANE to support HAL
>> (without depending on it). See
>> http://lists.alioth.debian.org/pipermail/sane-devel/2007-January/018353.html for details.
>
> ok, so lets assume that we have a new 'hal' meta backend to do some
> 'magic'. when the dll backend is asked to open a device like
> 'hal:<udi>:<backend>'. it will load the hal backend, and ask it to
> open '<udi>:<backend>'. the hal backend will load '<backend>', and ask
> it for a list of scanners it can find, and somehow pick the one that
> goes with the '<udi>'.
>
> i am worried that the last step means that each backend will have to
> know how to translate udi's.
As I understand it, the main point of the discussion is to find a way
for HAL that allows "HAL aware applications" to access a specific
scanner; this could be either a scan button daemon or a Sane frontend,
or whatever else. HAL already has quite detailed knowledge about
devices; what is missing is basically either a specialized "Sane-UDI" or
another way to assign a "Sane device string" (like
"fujitsu:libusb:005:003") to a specific device.
HAL knows already quite many details about devices, like USB bus/devide
numbers, SG device filenames and whatever else; the main problem is that
the Sane device names do not give a reliable indicator, which device (in
the HAL sense) belongs to a specific Sane device.
Instead of making Sane "HAL-aware", we can also add a function like
sane_get_device_information to the Sane API that would return data like
USB bus and devices numbers, USB vendor/product IDs, the SCSI device
filename, SCSI vendor/product strings, SCSI host/bus/device/LUN numbers
similar things.
A HAL callout (this is a script called by hald for certain devices
either when the daemon starts or when a device has been hotplugged) can
then call sane_get_devices, call sane_get_device_information for each
Sane device and can this way decide, if a Sane device "matches" the
"current" HAL device. And if the HAL and Sane devices match, the callout
can add a property like scanner.sane.device_name to the HAL device,
which would store the Sane device name as returned by sane_get_devices.
This should be enough to allow "HAL aware" scan software to find and
access devices via Sane.
Abel
PS: sorry, I don't have that much time to spare at present, so consider
this more to be a "backseat driver" comment...
More information about the sane-devel
mailing list