Scanners in HAL, playing with .fdi

David Zeuthen david at fubar.dk
Wed Aug 30 20:23:03 PDT 2006


On Tue, 2006-08-29 at 07:34 +0200, Étienne Bersac wrote:
> Hello all,
> 
> I'm playing with fdi in order to write the scanner.fdi file. I don't
> know how to develop such files. I just read the spec and the exemples,
> but nothing work.
> 
> How to test a .fdi ? 

You simple drop the file in, for example, 

 /etc/hal/fdi/information/

Look here

 http://gitweb.freedesktop.org/?p=hal.git;a=blob_plain;h=129c352e9f75bb33292d33c8414e022ce465fe34;f=fdi/information/10freedesktop/10-usb-music-players.fdi

for an example of an fdi file. So if you have a USB device with
vendor_id=0x1234 and product_id=0xabcd you would have this file

        <?xml version="1.0" encoding="UTF-8"?>
        <deviceinfo version="0.2">
          <device>
            <match key="usb.vendor_id" int="0x1234">
              <match key="usb.product_id" int="0xabcd">
                <merge key="info.capabilities" type="strlist">scanner</append>
                <merge key="scanner.type" type="string">sane</merge>
                <merge key="scanner.some_other_prop" type="string">foo</merge>
                <merge key="scanner.some_other_prop" type="int">32</merge>
              </match>
            </match>
          </device>
        </deviceinfo>
        
and when you plug in a device with these properties the scanner.*
properties will be merged and info.capabilities will be modified. Pretty
easy, huh?

> Do i have to restart hal ? dbus ? Does hal have
> debug message for fdi parsing ? Is there a howto ?

If the device is hotplugable, which USB devices are, you just need to
replug the device to make the new properties apply to the newly added
device. No need to restart anything.

Useful tools for looking at the device objects exported by hal includes
lshal and hal-device-manager. That's really all there is to it...

HTH,
David




More information about the hal mailing list