[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: udev / hotplug question, actions on plug-in a usb device?



Schlueri wrote:
> Hi there, 
> 
> i have brought a hauppauge nova-t dvb-t usb stick. Working fine. After
> compiling the latest v4l-dvb, actually the remote control is working,
> too.
> 
> Now i want start lircd and irexec daemon on plug-in the usb stick and
> stop these daemons on plug-out. I think i can do this with udev?
> 
> Is there any way to fixing the input device? Seems like it changing from
> time to time. 
> 
> input: IR-receiver inside an USB DVB receiver as /class/input/input8
> 
> Or read the actual input device on usb plug-in to start lircd with the
> correct parameters? (i.e. -H dev/input -d /dev/input/event8")
> 
> I've searching around, but it would be fine, to get some help or
> directions.
> 
> Thanks
> Dirk
> 
Yes, udev can be set to do this. What you would want to do is create
a set of local rules for the device that create consistent symlinks
and then access the symlinks instead of the kernel names. You can
also have the rules launch a program. The rules for when you insert
the device should probably match idVendor and idProduct. (I think I
spelled them correctly.) The rules on removal get a bit more
complicated. At least when I was testing things, there is not an
idVendor and idProduct to match on when removing the device. I
solved that by setting a ENV value for the device.

Here is what I did for a USB GPS device.

KERNEL=="ttyUSB*", SUBSYSTEM=="tty", SYSFS{idVendor}=="0403",
SYSFS{idProduct}=="6001", ENV{GPS_DEV}="true",
RUN+="/etc/udev/scripts/gpsd.dev"

ACTION=="remove", KERNEL=="ttyUSB*", SUBSYSTEM=="tty",
ENV{GPS_DEV}=="true", RUN+="/etc/udev/scripts/gpsd.dev"

You can read the udev docs, and look at the existing rules for more
ideas. Let us know if you need mre help.

Mikkel
-- 

  Do not meddle in the affairs of dragons,
for thou art crunchy and taste good with Ketchup!

Attachment: signature.asc
Description: OpenPGP digital signature


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]