David Famolari wrote :
> Hi,
>     I've got irda running on my Thinkpad 600 to the point where it will
> discover devices.  And 'cat /proc/net/irda/discovery' will return a
> device name.  I would now like to be able to have that event act as a
> trigger for other events.  For instance I'd like to be able to display a
> welcome message to that device when it is in range.  Anybody have any
> ideas how I can do this?  Or references where I might find what I'm
> looking for?
> 
> thank you
> dave

        In my IrDA patch, you have something to do that. You basically
open a socket and use the IRLMP_WAITDEVICE ioctl to be waken up when a
new device is in range. Then, it's easy to hook up the stuff
displaying a message or setting up the appropriate connection.
        The big advantages are :
                o you get the event as soon as it is produced
                o 0% CPU load (no polling)
        Furthermore, if you use the IRLMP_HINT_MASK_SET ioctl (also in
my IrDA patch), the previous ioctl will trigger only on devices
matching the hint bits you specify. And you also need to use
IRLMP_ENUMDEVICES to get the info about the device discovered.
        One of the catch of the ioctl is that you can't do a "select"
on it, so you have to have a process/thread blocked on it. For that
reason, for IrNET I use a real file descriptor as the event channel (a
much better solution, but work only for IrNET for now).

        My patches are at :
                http://www.hpl.hp.com/personal/Jean_Tourrilhes/IrDA/Java.html
        More recent patches (I'm finishing up 2.3.99-pre8) :
                http://www.hpl.hp.com/personal/Jean_Tourrilhes/IrDA/IrNET.html
        In the Java-IrDA tar file, you will find a sample program on
how to use the functionality...

        As Dag has stated his intention to have a look at my patches,
I would expect this functionality to appear in the future in the
official IrDA stack in some form.

        Happy now ?

        Jean

_______________________________________________
Linux-IrDA mailing list  -  [EMAIL PROTECTED]
http://www4.pasta.cs.UiT.No/mailman/listinfo/linux-irda

Reply via email to