You are not logged in.

#1 2011-05-16 16:57:47

kokoko3k
Member
Registered: 2008-11-14
Posts: 2,393

[SOLVED]udev: execute command on usb unplug (em28xx_dvb WinTV_HVR-900)

Hi all.
I've a known bug with a dvbt usb device.
The problem is that if i unplug and replug it, em28xx_dvb module hangs in dvb_init() and a reboot is needed to use the device again.

A manual workaround exists, it is sufficient to rmmod em28xx_dvb before replug the device again, but if i forgot it, i'm f*****

So here comes a question:
Does udev reacts to the unplug event? and if yes, how can i trigger the action of removing that module?

I'm a little noob with udev rules, so please be patient and thanks!

Last edited by kokoko3k (2011-05-17 11:52:33)


Help me to improve ssh-rdp !
Retroarch User? Try my koko-aio shader !

Online

#2 2011-05-17 11:51:23

kokoko3k
Member
Registered: 2008-11-14
Posts: 2,393

Re: [SOLVED]udev: execute command on usb unplug (em28xx_dvb WinTV_HVR-900)

I got it working; if anyone cares, here's the udev rule:

ACTION=="remove", SUBSYSTEM=="usb", ENV{ID_MODEL}=="WinTV_HVR-900", RUN+="/sbin/rmmod em28xx_dvb"

ENV{ID_MODEL}=="WinTV_HVR-900" is the key, my previous attempts to use ATTR{product}=="WinTV HVR-900" failed because it seems that udev doesn't trig any event on device removal (works on device plug),
while it does using id_model.

-EDIT-
If anyone uses this device, here's other tricks i made to make it work (without ir):

#> cat /etc/modprobe.d/tv.conf
options em28xx disable_ir=1

#> cat /etc/udev/rules.d/50-WinTv.rules 
ACTION=="remove", SUBSYSTEM=="usb", ENV{ID_MODEL}=="WinTV_HVR-900", RUN+="/sbin/rmmod em28xx_dvb""

Before hibernation:

# rmmod em28xx_dvb em28xx dvb_core tuner tvp5150 v4l2_common videodev videobuf_vmalloc videobuf_core tveeprom zl10353 ir_lirc_codec lirc_dev ir_sony_decoder ir_jvc_decoder ir_rc6_decoder ir_rc5_decoder ir_nec_decoder rc_core tuner_xc2028

On resume from hibernation:

# hwdetect --load-modules

...man, it wasnt 'easy'

Last edited by kokoko3k (2011-05-17 12:08:16)


Help me to improve ssh-rdp !
Retroarch User? Try my koko-aio shader !

Online

Board footer

Powered by FluxBB