Hi all,

The attached patch adds a preliminary support of LIRC and IR remote
controls into HAL, through LIRC.

It's composed of 4 pieces:
- a perl script that extracts USB information from the drivers/ dir
drivers, and generate an HAL .fdi file.
Once installed, whenever you'll plug a supported USB IR control, HAL
will report a new device with
info.capabilities=input.remote_control
For more info, refer to the below mentionned doc.
Thanks to Loic Dardant for his work on the script.
- an already generated .fdi file, though that one might be later
generated during the "make dist" target.
- a piece of HTML documentation.
- a patch to fix the comments in the drivers/
These needs to be of the form:
        /* Manufacturer - Model */
        { USB_DEVICE(0x????, 0x????) },

Using #define is supported, as well as having 1 comment line for
several USB_DEVICE declarations.

Some more comments:
- I've put everything in contrib/ while waiting for some better place,
- this should be extended in the future to support the drivers of the
daemons/ dir.
but this need either a scoring system to select the best driver when
several are available, or something alike.
- more information will be added to the .fdi file in the future
(comments welcomed!),
- the USB IDs extraction routine will be used to create a udev helper.
This one will in turn use an LIRC helper to configure itself, and load
the modules/daemons needed to operate automatically upon pluging an
USB IR control.
- some sanity checks still need to be done against the usb.ids file
(from the usbutils), for the names and completion.
- as for the previous patch, it doesn't hurt. OK to commit Christoph?

Arnaud
-- 
Linux / Unix Expert R&D - MGE Office Protection Systems - http://www.mgeops.com
Network UPS Tools (NUT) Project Leader - http://www.networkupstools.org/
Debian Developer - http://people.debian.org/~aquette/
Free Software Developer - http://arnaud.quette.free.fr/
diff -xCVS -Nru lirc/contrib/hal/20-ircontrol-lirc.fdi lirc-aqbak/contrib/hal/20-ircontrol-lirc.fdi
--- lirc/contrib/hal/20-ircontrol-lirc.fdi	1970-01-01 01:00:00.000000000 +0100
+++ lirc-aqbak/contrib/hal/20-ircontrol-lirc.fdi	2008-05-01 22:06:07.000000000 +0200
@@ -0,0 +1,409 @@
+<?xml version="1.0" encoding="ISO-8859-1"?> <!-- -*- SGML -*- -->
+<deviceinfo version="0.2">
+  <device>
+  <match key="info.bus" string="usb_device">
+  <!-- vendor -->
+  <match key="usb_device.vendor_id" int="0x03eb">
+    <!--  Igor Plug USB (Atmel's Manufact. ID) , driver : igorplugusb -->
+    <match key="usb_device.product_id" int="0x0002">
+      <merge key="info.category" type="string">input</merge>
+      <append key="info.capabilities" type="strlist">input</append>
+      <append key="info.capabilities" type="strlist">input.remote_control</append>
+    </match>
+  </match>
+  <!-- vendor -->
+  <match key="usb_device.vendor_id" int="0x03ee">
+    <!--  Mitsumi , driver : mceusb2 -->
+    <match key="usb_device.product_id" int="0x2501">
+      <merge key="info.category" type="string">input</merge>
+      <append key="info.capabilities" type="strlist">input</append>
+      <append key="info.capabilities" type="strlist">input.remote_control</append>
+    </match>
+  </match>
+  <!-- vendor -->
+  <match key="usb_device.vendor_id" int="0x040b">
+    <!--  Gamester Xbox DVD Movie Playback Kit IR , driver : atiusb -->
+    <match key="usb_device.product_id" int="0x6521">
+      <merge key="info.category" type="string">input</merge>
+      <append key="info.capabilities" type="strlist">input</append>
+      <append key="info.capabilities" type="strlist">input.remote_control</append>
+    </match>
+  </match>
+  <!-- vendor -->
+  <match key="usb_device.vendor_id" int="0x043e">
+    <!--  LG eHome Infrared Transceiver , driver : mceusb2 -->
+    <match key="usb_device.product_id" int="0x9803">
+      <merge key="info.category" type="string">input</merge>
+      <append key="info.capabilities" type="strlist">input</append>
+      <append key="info.capabilities" type="strlist">input.remote_control</append>
+    </match>
+  </match>
+  <!-- vendor -->
+  <match key="usb_device.vendor_id" int="0x045e">
+    <!--  table of devices that work with this driver , driver : mceusb -->
+    <match key="usb_device.product_id" int="0x006d">
+      <merge key="info.category" type="string">input</merge>
+      <append key="info.capabilities" type="strlist">input</append>
+      <append key="info.capabilities" type="strlist">input.remote_control</append>
+    </match>
+    <!--  Microsoft MCE Infrared Transceiver , driver : mceusb2 -->
+    <match key="usb_device.product_id" int="0x00a0">
+      <merge key="info.category" type="string">input</merge>
+      <append key="info.capabilities" type="strlist">input</append>
+      <append key="info.capabilities" type="strlist">input.remote_control</append>
+    </match>
+    <!--  Microsoft Xbox DVD Movie Playback Kit IR , driver : atiusb -->
+    <match key="usb_device.product_id" int="0x0284">
+      <merge key="info.category" type="string">input</merge>
+      <append key="info.capabilities" type="strlist">input</append>
+      <append key="info.capabilities" type="strlist">input.remote_control</append>
+    </match>
+  </match>
+  <!-- vendor -->
+  <match key="usb_device.vendor_id" int="0x0471">
+    <!--  ATI Remote Wonder 2: Input Device , driver : atiusb -->
+    <match key="usb_device.product_id" int="0x0602">
+      <merge key="info.category" type="string">input</merge>
+      <append key="info.capabilities" type="strlist">input</append>
+      <append key="info.capabilities" type="strlist">input.remote_control</append>
+    </match>
+    <!--  ATI Remote Wonder 2: Controller (???) , driver : atiusb -->
+    <match key="usb_device.product_id" int="0x0603">
+      <merge key="info.category" type="string">input</merge>
+      <append key="info.capabilities" type="strlist">input</append>
+      <append key="info.capabilities" type="strlist">input.remote_control</append>
+    </match>
+    <!--  Philips Infrared Transceiver - HP branded , driver : mceusb2 -->
+    <match key="usb_device.product_id" int="0x060c">
+      <merge key="info.category" type="string">input</merge>
+      <append key="info.capabilities" type="strlist">input</append>
+      <append key="info.capabilities" type="strlist">input.remote_control</append>
+    </match>
+    <!--  Philips SRM5100 , driver : mceusb2 -->
+    <match key="usb_device.product_id" int="0x060d">
+      <merge key="info.category" type="string">input</merge>
+      <append key="info.capabilities" type="strlist">input</append>
+      <append key="info.capabilities" type="strlist">input.remote_control</append>
+    </match>
+    <!--  Philips eHome Infrared Transceiver , driver : mceusb2 -->
+    <match key="usb_device.product_id" int="0x0815">
+      <merge key="info.category" type="string">input</merge>
+      <append key="info.capabilities" type="strlist">input</append>
+      <append key="info.capabilities" type="strlist">input.remote_control</append>
+    </match>
+  </match>
+  <!-- vendor -->
+  <match key="usb_device.vendor_id" int="0x04e8">
+    <!--  ext IR only , driver : imon -->
+    <match key="usb_device.product_id" int="0xff30">
+      <merge key="info.category" type="string">input</merge>
+      <append key="info.capabilities" type="strlist">input</append>
+      <append key="info.capabilities" type="strlist">input.remote_control</append>
+    </match>
+  </match>
+  <!-- vendor -->
+  <match key="usb_device.vendor_id" int="0x051c">
+    <!--  Shuttle eHome Infrared Transceiver , driver : mceusb2 -->
+    <match key="usb_device.product_id" int="0xc001">
+      <merge key="info.category" type="string">input</merge>
+      <append key="info.capabilities" type="strlist">input</append>
+      <append key="info.capabilities" type="strlist">input.remote_control</append>
+    </match>
+  </match>
+  <!-- vendor -->
+  <match key="usb_device.vendor_id" int="0x0609">
+    <!--  SMK/Toshiba G83C0004D410 , driver : mceusb2 -->
+    <match key="usb_device.product_id" int="0x031d">
+      <merge key="info.category" type="string">input</merge>
+      <append key="info.capabilities" type="strlist">input</append>
+      <append key="info.capabilities" type="strlist">input.remote_control</append>
+    </match>
+    <!--  SMK eHome Infrared Transceiver (Sony VAIO) , driver : mceusb2 -->
+    <match key="usb_device.product_id" int="0x0322">
+      <merge key="info.category" type="string">input</merge>
+      <append key="info.capabilities" type="strlist">input</append>
+      <append key="info.capabilities" type="strlist">input.remote_control</append>
+    </match>
+    <!--  bundled with Hauppauge PVR-150 , driver : mceusb2 -->
+    <match key="usb_device.product_id" int="0x0334">
+      <merge key="info.category" type="string">input</merge>
+      <append key="info.capabilities" type="strlist">input</append>
+      <append key="info.capabilities" type="strlist">input.remote_control</append>
+    </match>
+  </match>
+  <!-- vendor -->
+  <match key="usb_device.vendor_id" int="0x0aa8">
+    <!--  IR only     , driver : imon -->
+    <match key="usb_device.product_id" int="0x8001">
+      <merge key="info.category" type="string">input</merge>
+      <append key="info.capabilities" type="strlist">input</append>
+      <append key="info.capabilities" type="strlist">input.remote_control</append>
+    </match>
+    <!--  IR & VFD    , driver : imon -->
+    <match key="usb_device.product_id" int="0xffda">
+      <merge key="info.category" type="string">input</merge>
+      <append key="info.capabilities" type="strlist">input</append>
+      <append key="info.capabilities" type="strlist">input.remote_control</append>
+    </match>
+  </match>
+  <!-- vendor -->
+  <match key="usb_device.vendor_id" int="0x0B48">
+    <!--  table of devices that work with this driver , driver : ttusbir -->
+    <match key="usb_device.product_id" int="0x2003">
+      <merge key="info.category" type="string">input</merge>
+      <append key="info.capabilities" type="strlist">input</append>
+      <append key="info.capabilities" type="strlist">input.remote_control</append>
+    </match>
+  </match>
+  <!-- vendor -->
+  <match key="usb_device.vendor_id" int="0x0bc7">
+    <!--  X10 USB Firecracker Interface , driver : atiusb -->
+    <match key="usb_device.product_id" int="0x0002">
+      <merge key="info.category" type="string">input</merge>
+      <append key="info.capabilities" type="strlist">input</append>
+      <append key="info.capabilities" type="strlist">input.remote_control</append>
+    </match>
+    <!--  X10 VGA Video Sender , driver : atiusb -->
+    <match key="usb_device.product_id" int="0x0003">
+      <merge key="info.category" type="string">input</merge>
+      <append key="info.capabilities" type="strlist">input</append>
+      <append key="info.capabilities" type="strlist">input.remote_control</append>
+    </match>
+    <!--  ATI Wireless Remote Receiver , driver : atiusb -->
+    <match key="usb_device.product_id" int="0x0004">
+      <merge key="info.category" type="string">input</merge>
+      <append key="info.capabilities" type="strlist">input</append>
+      <append key="info.capabilities" type="strlist">input.remote_control</append>
+    </match>
+    <!--  NVIDIA Wireless Remote Receiver , driver : atiusb -->
+    <match key="usb_device.product_id" int="0x0005">
+      <merge key="info.category" type="string">input</merge>
+      <append key="info.capabilities" type="strlist">input</append>
+      <append key="info.capabilities" type="strlist">input.remote_control</append>
+    </match>
+    <!--  ATI Wireless Remote Receiver , driver : atiusb -->
+    <match key="usb_device.product_id" int="0x0006">
+      <merge key="info.category" type="string">input</merge>
+      <append key="info.capabilities" type="strlist">input</append>
+      <append key="info.capabilities" type="strlist">input.remote_control</append>
+    </match>
+    <!--  X10 USB Wireless Transceivers , driver : atiusb -->
+    <match key="usb_device.product_id" int="0x0007">
+      <merge key="info.category" type="string">input</merge>
+      <append key="info.capabilities" type="strlist">input</append>
+      <append key="info.capabilities" type="strlist">input.remote_control</append>
+    </match>
+    <!--  X10 USB Wireless Transceivers , driver : atiusb -->
+    <match key="usb_device.product_id" int="0x0008">
+      <merge key="info.category" type="string">input</merge>
+      <append key="info.capabilities" type="strlist">input</append>
+      <append key="info.capabilities" type="strlist">input.remote_control</append>
+    </match>
+    <!--  X10 USB Wireless Transceivers , driver : atiusb -->
+    <match key="usb_device.product_id" int="0x0009">
+      <merge key="info.category" type="string">input</merge>
+      <append key="info.capabilities" type="strlist">input</append>
+      <append key="info.capabilities" type="strlist">input.remote_control</append>
+    </match>
+    <!--  X10 USB Wireless Transceivers , driver : atiusb -->
+    <match key="usb_device.product_id" int="0x000A">
+      <merge key="info.category" type="string">input</merge>
+      <append key="info.capabilities" type="strlist">input</append>
+      <append key="info.capabilities" type="strlist">input.remote_control</append>
+    </match>
+    <!--  X10 USB Wireless Transceivers , driver : atiusb -->
+    <match key="usb_device.product_id" int="0x000B">
+      <merge key="info.category" type="string">input</merge>
+      <append key="info.capabilities" type="strlist">input</append>
+      <append key="info.capabilities" type="strlist">input.remote_control</append>
+    </match>
+    <!--  X10 USB Wireless Transceivers , driver : atiusb -->
+    <match key="usb_device.product_id" int="0x000C">
+      <merge key="info.category" type="string">input</merge>
+      <append key="info.capabilities" type="strlist">input</append>
+      <append key="info.capabilities" type="strlist">input.remote_control</append>
+    </match>
+    <!--  X10 USB Wireless Transceivers , driver : atiusb -->
+    <match key="usb_device.product_id" int="0x000D">
+      <merge key="info.category" type="string">input</merge>
+      <append key="info.capabilities" type="strlist">input</append>
+      <append key="info.capabilities" type="strlist">input.remote_control</append>
+    </match>
+    <!--  X10 USB Wireless Transceivers , driver : atiusb -->
+    <match key="usb_device.product_id" int="0x000E">
+      <merge key="info.category" type="string">input</merge>
+      <append key="info.capabilities" type="strlist">input</append>
+      <append key="info.capabilities" type="strlist">input.remote_control</append>
+    </match>
+    <!--  X10 USB Wireless Transceivers , driver : atiusb -->
+    <match key="usb_device.product_id" int="0x000F">
+      <merge key="info.category" type="string">input</merge>
+      <append key="info.capabilities" type="strlist">input</append>
+      <append key="info.capabilities" type="strlist">input.remote_control</append>
+    </match>
+  </match>
+  <!-- vendor -->
+  <match key="usb_device.vendor_id" int="0x0e9c">
+    <!--  Use our own dbg macro , driver : streamzap -->
+    <match key="usb_device.product_id" int="0x0000">
+      <merge key="info.category" type="string">input</merge>
+      <append key="info.capabilities" type="strlist">input</append>
+      <append key="info.capabilities" type="strlist">input.remote_control</append>
+    </match>
+  </match>
+  <!-- vendor -->
+  <match key="usb_device.vendor_id" int="0x107b">
+    <!--  Gateway eHome Infrared Transceiver , driver : mceusb2 -->
+    <match key="usb_device.product_id" int="0x3009">
+      <merge key="info.category" type="string">input</merge>
+      <append key="info.capabilities" type="strlist">input</append>
+      <append key="info.capabilities" type="strlist">input.remote_control</append>
+    </match>
+  </match>
+  <!-- vendor -->
+  <match key="usb_device.vendor_id" int="0x10c4">
+    <!--  table of devices that work with this driver , driver :  -->
+    <match key="usb_device.product_id" int="0x0003">
+      <merge key="info.category" type="string">input</merge>
+      <append key="info.capabilities" type="strlist">input</append>
+      <append key="info.capabilities" type="strlist">input.remote_control</append>
+    </match>
+  </match>
+  <!-- vendor -->
+  <match key="usb_device.vendor_id" int="0x11ba">
+    <!--  Sasem       , driver : sasem -->
+    <match key="usb_device.product_id" int="0x0101">
+      <merge key="info.category" type="string">input</merge>
+      <append key="info.capabilities" type="strlist">input</append>
+      <append key="info.capabilities" type="strlist">input.remote_control</append>
+    </match>
+  </match>
+  <!-- vendor -->
+  <match key="usb_device.vendor_id" int="0x1308">
+    <!--  Shuttle eHome Infrared Transceiver , driver : mceusb2 -->
+    <match key="usb_device.product_id" int="0xc001">
+      <merge key="info.category" type="string">input</merge>
+      <append key="info.capabilities" type="strlist">input</append>
+      <append key="info.capabilities" type="strlist">input.remote_control</append>
+    </match>
+  </match>
+  <!-- vendor -->
+  <match key="usb_device.vendor_id" int="0x1460">
+    <!--  Tatung eHome Infrared Transceiver , driver : mceusb2 -->
+    <match key="usb_device.product_id" int="0x9150">
+      <merge key="info.category" type="string">input</merge>
+      <append key="info.capabilities" type="strlist">input</append>
+      <append key="info.capabilities" type="strlist">input.remote_control</append>
+    </match>
+  </match>
+  <!-- vendor -->
+  <match key="usb_device.vendor_id" int="0x147a">
+    <!--  Formosa eHome Infrared Transceiver , driver : mceusb2 -->
+    <match key="usb_device.product_id" int="0xe015">
+      <merge key="info.category" type="string">input</merge>
+      <append key="info.capabilities" type="strlist">input</append>
+      <append key="info.capabilities" type="strlist">input.remote_control</append>
+    </match>
+    <!--  Formosa aim / Trust MCE Infrared Receiver , driver : mceusb2 -->
+    <match key="usb_device.product_id" int="0xe017">
+      <merge key="info.category" type="string">input</merge>
+      <append key="info.capabilities" type="strlist">input</append>
+      <append key="info.capabilities" type="strlist">input.remote_control</append>
+    </match>
+    <!--  Formosa Industrial Computing / Beanbag Emulation Device , driver : mceusb2 -->
+    <match key="usb_device.product_id" int="0xe018">
+      <merge key="info.category" type="string">input</merge>
+      <append key="info.capabilities" type="strlist">input</append>
+      <append key="info.capabilities" type="strlist">input.remote_control</append>
+    </match>
+  </match>
+  <!-- vendor -->
+  <match key="usb_device.vendor_id" int="0x1509">
+    <!--  FIC eHome Infrared Transceiver , driver : mceusb2 -->
+    <match key="usb_device.product_id" int="0x9242">
+      <merge key="info.category" type="string">input</merge>
+      <append key="info.capabilities" type="strlist">input</append>
+      <append key="info.capabilities" type="strlist">input.remote_control</append>
+    </match>
+  </match>
+  <!-- vendor -->
+  <match key="usb_device.vendor_id" int="0x15c2">
+    <!--  IR & VFD    , driver : imon -->
+    <match key="usb_device.product_id" int="0xffda">
+      <merge key="info.category" type="string">input</merge>
+      <append key="info.capabilities" type="strlist">input</append>
+      <append key="info.capabilities" type="strlist">input.remote_control</append>
+    </match>
+    <!--  IR & VFD    , driver : imon -->
+    <match key="usb_device.product_id" int="0xffdc">
+      <merge key="info.category" type="string">input</merge>
+      <append key="info.capabilities" type="strlist">input</append>
+      <append key="info.capabilities" type="strlist">input.remote_control</append>
+    </match>
+  </match>
+  <!-- vendor -->
+  <match key="usb_device.vendor_id" int="0x1784">
+    <!--  Topseed eHome Infrared Transceiver , driver : mceusb2 -->
+    <match key="usb_device.product_id" int="0x0001">
+      <merge key="info.category" type="string">input</merge>
+      <append key="info.capabilities" type="strlist">input</append>
+      <append key="info.capabilities" type="strlist">input.remote_control</append>
+    </match>
+    <!--  Topseed HP eHome Infrared Transceiver , driver : mceusb2 -->
+    <match key="usb_device.product_id" int="0x0006">
+      <merge key="info.category" type="string">input</merge>
+      <append key="info.capabilities" type="strlist">input</append>
+      <append key="info.capabilities" type="strlist">input.remote_control</append>
+    </match>
+    <!--  Topseed eHome Infrared Transceiver , driver : mceusb2 -->
+    <match key="usb_device.product_id" int="0x0007">
+      <merge key="info.category" type="string">input</merge>
+      <append key="info.capabilities" type="strlist">input</append>
+      <append key="info.capabilities" type="strlist">input.remote_control</append>
+    </match>
+    <!--  Topseed eHome Infrared Transceiver , driver : mceusb2 -->
+    <match key="usb_device.product_id" int="0x0008">
+      <merge key="info.category" type="string">input</merge>
+      <append key="info.capabilities" type="strlist">input</append>
+      <append key="info.capabilities" type="strlist">input.remote_control</append>
+    </match>
+  </match>
+  <!-- vendor -->
+  <match key="usb_device.vendor_id" int="0x179d">
+    <!--  Ricavision internal Infrared Transceiver , driver : mceusb2 -->
+    <match key="usb_device.product_id" int="0x0010">
+      <merge key="info.category" type="string">input</merge>
+      <append key="info.capabilities" type="strlist">input</append>
+      <append key="info.capabilities" type="strlist">input.remote_control</append>
+    </match>
+  </match>
+  <!-- vendor -->
+  <match key="usb_device.vendor_id" int="0x1934">
+    <!--  Fintek eHome Infrared Transceiver , driver : mceusb2 -->
+    <match key="usb_device.product_id" int="0x0602">
+      <merge key="info.category" type="string">input</merge>
+      <append key="info.capabilities" type="strlist">input</append>
+      <append key="info.capabilities" type="strlist">input.remote_control</append>
+    </match>
+  </match>
+  <!-- vendor -->
+  <match key="usb_device.vendor_id" int="0x195d">
+    <!--  Itron ione Libra Q-11 , driver : mceusb2 -->
+    <match key="usb_device.product_id" int="0x7002">
+      <merge key="info.category" type="string">input</merge>
+      <append key="info.capabilities" type="strlist">input</append>
+      <append key="info.capabilities" type="strlist">input.remote_control</append>
+    </match>
+  </match>
+  <!-- vendor -->
+  <match key="usb_device.vendor_id" int="0xFFFF">
+    <!--  Microsoft Xbox DVD Movie Playback Kit IR , driver : atiusb -->
+    <match key="usb_device.product_id" int="0xFFFF">
+      <merge key="info.category" type="string">input</merge>
+      <append key="info.capabilities" type="strlist">input</append>
+      <append key="info.capabilities" type="strlist">input.remote_control</append>
+    </match>
+  </match>
+  </match>
+  </device>
+</deviceinfo>
diff -xCVS -Nru lirc/contrib/hal/gen-hal-fdi.pl lirc-aqbak/contrib/hal/gen-hal-fdi.pl
--- lirc/contrib/hal/gen-hal-fdi.pl	1970-01-01 01:00:00.000000000 +0100
+++ lirc-aqbak/contrib/hal/gen-hal-fdi.pl	2008-05-01 22:06:07.000000000 +0200
@@ -0,0 +1,133 @@
+#!/usr/bin/perl
+#   Description: script to extract USB IDS from drivers files and generate
+#                an HAL .fdi file to report connected USB IR controls
+#   Current Version: 0.5
+#   Author: dloic (loic.dardant AT gmail DOT com)
+#
+#	0.5 : hardcode .fdi filename and search path
+#	0.4 : add comment with the name of the driver
+#	0.3 : cleanup a bit the code and add comment for each remote (when it's in the text)
+#	0.2 : add the "grep" unctionnality for constants
+#	0.1 : creation of the script
+#	
+use File::Find;
+use strict;
+
+################# MAIN #################
+
+# path to search
+my 	$path="../../drivers/";
+
+# output file
+my $output="20-ircontrol-lirc.fdi";
+
+# contain for each vendor an array with the different products
+my %vendor;
+
+#parse param, find what we want in the path and generate the output
+&param;
+find(\&find_ub,$path);
+&hal_file;
+
+################# SUB METHOD #################
+sub hal_file
+{
+	#generate the header
+	open my $out, ">$output" || die "error $output : $!";
+	print $out '<?xml version="1.0" encoding="ISO-8859-1"?> <!-- -*- SGML -*- -->'."\n";
+	print $out '<deviceinfo version="0.2">'."\n";
+        print $out '  <device>'."\n";
+        print $out '  <match key="info.bus" string="usb_device">'."\n";
+	
+	#generate the file in alphabetical order (first for vendor, then for product)
+	foreach my $vendorId (sort { lc $a cmp lc $b } keys  %vendor)
+	{
+		print $out "  <!-- vendor -->\n";
+ 		print $out "  <match key=\"usb_device.vendor_id\" int=\"".$vendorId."\">\n";
+	
+		foreach my $productId (sort { lc $a cmp lc $b } keys %{$vendor{$vendorId}})
+		{
+			print $out "    <!-- ".$vendor{$vendorId}{$productId}{"comment"}.", driver : ".$vendor{$vendorId}{$productId}{"driver"}." -->\n";
+			print $out "    <match key=\"usb_device.product_id\" int=\"".$productId."\">\n";
+   			print $out '      <merge key="info.category" type="string">input</merge>'."\n";
+   			print $out '      <append key="info.capabilities" type="strlist">input</append>'."\n";
+   			print $out '      <append key="info.capabilities" type="strlist">input.remote_control</append>'."\n";
+  			print $out '    </match>'."\n";
+		}
+		print $out "  </match>\n";
+	}
+	#generate footer
+	print $out "  </match>\n";
+	print $out "  </device>\n";
+	print $out "</deviceinfo>\n";
+}
+
+sub find_ub
+{
+	my $nameFile=$_;
+	my $lastComment="";
+	
+	open my $file,$nameFile or die "error open file $nameFile";
+	while(my $line=<$file>)
+	{
+		#catch comment (should permit comment on the precedent or on the current line of USB_DEVICE declaration)
+		if($line =~/\s*\/\*(.+)\*\/\s*$/)
+		{
+			$lastComment=$1;
+		}
+
+		if($line =~/^\s*\{\s*USB_DEVICE\((.+)\,(.+)\)\s*\}/) # for example : { USB_DEVICE(VENDOR_ATI1, 0x0002) }
+		{		
+			my $VendorID=trim($1);
+			my $ProductID=trim($2);
+			
+			#special thing if the guy is declaring a #DEFINE
+			if(!($VendorID=~/\dx(\d|\w)+/))
+			{
+				my $data = do { open my $fh, $nameFile or die "error open file $nameFile"; join '', <$fh> };
+				if ($data =~ /(#define|#DEFINE)\s+$VendorID\s+(\dx(\d|\w)+)/)
+				{
+					$VendorID=$2;
+				}
+				else
+				{
+					die "In file $nameFile, for vendor $VendorID, can't find the declaration of the constant";
+				}
+			}
+			if(!($ProductID=~/\dx(\d|\w)+/))
+			{
+				my $data = do { open my $fh, $nameFile or die "error open file $nameFile"; join '', <$fh> };
+				if ($data =~ /(#define|#DEFINE)\s+$ProductID\s+(\dx(\d|\w)+)/)
+				{
+					$ProductID=$2;
+				}
+				else
+				{
+					die "In file $nameFile, for product $ProductID, can't find the declaration of the constant";
+				}
+			}
+			
+			# FIXME: To be optimized for looking in ../../daemons
+			$vendor{$VendorID}{$ProductID}{"comment"}=$lastComment;
+			my $driver="";
+			if($nameFile=~/lirc_(.+)\.c/){ $driver=$1 };
+			$vendor{$VendorID}{$ProductID}{"driver"}=$driver;
+		}
+	}
+}
+
+sub param
+{
+	#useful var
+	my $errorMessage="Usage: gen-hal-fdi.pl pathToScan\n";
+
+	#for parameters
+	# if(scalar(@ARGV)< 1){ die $errorMessage; };
+	# For the moment, we suppose to be in contrib/hal
+}
+
+
+sub trim {
+    my($str) = shift =~ m!^\s*(.+?)\s*$!i;
+    defined $str ? return $str : return '';
+}
diff -xCVS -Nru lirc/doc/html-source/index.html lirc-aqbak/doc/html-source/index.html
--- lirc/doc/html-source/index.html	2008-05-01 22:26:09.000000000 +0200
+++ lirc-aqbak/doc/html-source/index.html	2008-05-01 22:06:05.000000000 +0200
@@ -85,7 +85,8 @@
 	    </UL>
 	  </LI>
 	  <LI><A HREF="technical.html#packagers">Note for packagers</A></LI>
-    <LI><A HREF="technical.html#config">Note for configuration application developers</A></LI>
+	  <LI><A HREF="technical.html#hal">Hardware Abstraction Layer (HAL) integration</A></LI>
+	  <LI><A HREF="technical.html#config">Note for configuration application developers</A></LI>
 	  <LI><A HREF="technical.html#bugs">Known bugs</A></LI>
 	</UL>
 	<BR>
diff -xCVS -Nru lirc/doc/html-source/technical.html lirc-aqbak/doc/html-source/technical.html
--- lirc/doc/html-source/technical.html	2008-05-01 22:26:09.000000000 +0200
+++ lirc-aqbak/doc/html-source/technical.html	2008-05-01 22:06:05.000000000 +0200
@@ -614,10 +614,31 @@
 	<br>Finally, you should consider installing the doc/lirc.hwdb file.
 	This one is a parseable list of LIRC supported devices, which
 	is useful for LIRC configuration applications.<br>
+	You should also have a look at the below HAL integration description.<br>
 	For more information, refer to the next section.
       </dl>
     </P>
 
+    <A NAME="hal"></A><HR>
+    <H1 ALIGN="CENTER">Hardware Abstraction Layer (HAL) integration</H1>
+    <HR WIDTH="70%">
+    
+    <P>
+      If your system support the <a href="http://www.freedesktop.org/wiki/Software/hal";>FreeDesktop Hardware Abstraction Layer (HAL)</a>,
+      you will want to install the file <em>contrib/hal/20-ircontrol-lirc.fdi</em> in
+      <em>${datarootdir}/hal/fdi/information/20thirdparty</em>
+    </P>
+    <P>
+      This file can be generated at will using contrib/hal/gen-hal-fdi.pl.<br>
+      Installing 20-ircontrol-lirc.fdi allow applications developers to detect
+      USB remotes easily by searching for HAL devices with <em>info.capabilities=input.remote_control</em>
+    </P>
+    <P>
+      This is a work in progress. We will also provide more information in the
+      future, such as the driver/manufacturer/device name(s), and possibly
+      event reporting.
+    </P>
+
     <A NAME="config"></A><HR>
     <H1 ALIGN="CENTER">Note for configuration application developers</H1>
     <HR WIDTH="70%">
diff -xCVS -Nru lirc/drivers/lirc_atiusb/lirc_atiusb.c lirc-aqbak/drivers/lirc_atiusb/lirc_atiusb.c
--- lirc/drivers/lirc_atiusb/lirc_atiusb.c	2008-05-01 22:26:10.000000000 +0200
+++ lirc-aqbak/drivers/lirc_atiusb/lirc_atiusb.c	2008-05-01 22:06:06.000000000 +0200
@@ -180,8 +180,8 @@
 	/* Microsoft Xbox DVD Movie Playback Kit IR */
 	{ USB_DEVICE(VENDOR_MS2, 0x0284) },
 
-	/* Some chinese manufacterer -- conflicts with the joystick from the
-	 * same manufacterer */
+	/* Some chinese manufacturer -- conflicts with the joystick from the
+	 * same manufacturer */
 	{ USB_DEVICE(VENDOR_MS3, 0xFFFF) },
 
 	/* Terminating entry */
diff -xCVS -Nru lirc/drivers/lirc_cmdir/commandir.c lirc-aqbak/drivers/lirc_cmdir/commandir.c
--- lirc/drivers/lirc_cmdir/commandir.c	2008-05-01 22:26:11.000000000 +0200
+++ lirc-aqbak/drivers/lirc_cmdir/commandir.c	2008-05-01 22:06:06.000000000 +0200
@@ -54,8 +54,10 @@
 /* table of devices that work with this driver */
 static struct usb_device_id cmdir_table [] =
 {
+	/* COMMANDIR USB Transceiver */
 	{ USB_DEVICE(USB_CMDIR_VENDOR_ID, USB_CMDIR_PRODUCT_ID) },
-	{ }			/* Terminating entry */
+	/* Terminating entry */
+	{ }
 };
 MODULE_DEVICE_TABLE(usb, cmdir_table);
 
diff -xCVS -Nru lirc/drivers/lirc_imon/lirc_imon.c lirc-aqbak/drivers/lirc_imon/lirc_imon.c
--- lirc/drivers/lirc_imon/lirc_imon.c	2008-05-01 22:26:12.000000000 +0200
+++ lirc-aqbak/drivers/lirc_imon/lirc_imon.c	2008-05-01 22:06:06.000000000 +0200
@@ -192,11 +192,16 @@
 
 /* USB Device ID for IMON USB Control Board */
 static struct usb_device_id imon_usb_id_table[] = {
-	{ USB_DEVICE(0x0aa8, 0xffda) },		/* IR & VFD    */
-	{ USB_DEVICE(0x0aa8, 0x8001) },		/* IR only     */
-	{ USB_DEVICE(0x15c2, 0xffda) },		/* IR & VFD    */
-	{ USB_DEVICE(0x15c2, 0xffdc) },		/* IR & VFD    */
-	{ USB_DEVICE(0x04e8, 0xff30) },		/* ext IR only */
+	/* IMON USB Control Board (IR & VFD) */
+	{ USB_DEVICE(0x0aa8, 0xffda) },
+	/* IMON USB Control Board (IR only) */
+	{ USB_DEVICE(0x0aa8, 0x8001) },
+	/* IMON USB Control Board (IR & VFD) */
+	{ USB_DEVICE(0x15c2, 0xffda) },
+	/* IMON USB Control Board (IR & VFD) */
+	{ USB_DEVICE(0x15c2, 0xffdc) },
+	/* IMON USB Control Board (ext IR only) */
+	{ USB_DEVICE(0x04e8, 0xff30) },
 	{}
 };
 
diff -xCVS -Nru lirc/drivers/lirc_mceusb/lirc_mceusb.c lirc-aqbak/drivers/lirc_mceusb/lirc_mceusb.c
--- lirc/drivers/lirc_mceusb/lirc_mceusb.c	2008-05-01 22:26:12.000000000 +0200
+++ lirc-aqbak/drivers/lirc_mceusb/lirc_mceusb.c	2008-05-01 22:06:06.000000000 +0200
@@ -142,8 +142,10 @@
 
 /* table of devices that work with this driver */
 static struct usb_device_id mceusb_table[] = {
+	/* USB Microsoft IR Transceiver */
 	{ USB_DEVICE(USB_MCEUSB_VENDOR_ID, USB_MCEUSB_PRODUCT_ID) },
-	{ }	/* Terminating entry */
+	/* Terminating entry */
+	{ }
 };
 
 /* we can have up to this number of device plugged in at once */
diff -xCVS -Nru lirc/drivers/lirc_sasem/lirc_sasem.c lirc-aqbak/drivers/lirc_sasem/lirc_sasem.c
--- lirc/drivers/lirc_sasem/lirc_sasem.c	2008-05-01 22:26:12.000000000 +0200
+++ lirc-aqbak/drivers/lirc_sasem/lirc_sasem.c	2008-05-01 22:06:06.000000000 +0200
@@ -194,7 +194,9 @@
 
 /* USB Device ID for Sasem USB Control Board */
 static struct usb_device_id sasem_usb_id_table [] = {
-	{ USB_DEVICE(0x11ba, 0x0101) },		/* Sasem       */
+	/* Sasem USB Control Board */
+	{ USB_DEVICE(0x11ba, 0x0101) },
+	/* Terminating entry */
 	{}
 };
 
diff -xCVS -Nru lirc/drivers/lirc_streamzap/lirc_streamzap.c lirc-aqbak/drivers/lirc_streamzap/lirc_streamzap.c
--- lirc/drivers/lirc_streamzap/lirc_streamzap.c	2008-05-01 22:26:12.000000000 +0200
+++ lirc-aqbak/drivers/lirc_streamzap/lirc_streamzap.c	2008-05-01 22:06:06.000000000 +0200
@@ -80,8 +80,10 @@
  * table of devices that work with this driver
  */
 static struct usb_device_id streamzap_table [] = {
+	/* Streamzap Remote Control */
 	{ USB_DEVICE(USB_STREAMZAP_VENDOR_ID, USB_STREAMZAP_PRODUCT_ID) },
-	{ }	/* Terminating entry */
+	/* Terminating entry */
+	{ }
 };
 
 MODULE_DEVICE_TABLE(usb, streamzap_table);
diff -xCVS -Nru lirc/drivers/lirc_ttusbir/lirc_ttusbir.c lirc-aqbak/drivers/lirc_ttusbir/lirc_ttusbir.c
--- lirc/drivers/lirc_ttusbir/lirc_ttusbir.c	2008-05-01 22:26:13.000000000 +0200
+++ lirc-aqbak/drivers/lirc_ttusbir/lirc_ttusbir.c	2008-05-01 22:06:06.000000000 +0200
@@ -73,8 +73,10 @@
 
 /* table of devices that work with this driver */
 static struct usb_device_id device_id_table[] = {
+	/* TechnoTrend USB IR Receiver */
     { USB_DEVICE(0x0B48, 0x2003) },
-    { } /* Terminating entry */
+    /* Terminating entry */
+    { }
 };
 MODULE_DEVICE_TABLE(usb, device_id_table);
 

Reply via email to