hello
I have a usb soundcard (audigy 2 nx) and I tried out the remote control with 
lirc. yes, with a new linux (kubuntu 6.10) it works out of the box!

but when I unfortuenately pressed the power button, the soundcard shuts down 
and lircd do not release the device /dev/lircd, thus also alsa hangs and even 
repowering the soundcard do not help!

I wrote then a small python script using dbus, its my first deamon, shuting 
down lircd if a signal on the dbus arrives... so I can repower the soundcard, 
restart lircd and also alsa is automaticly available again!

maybe there would be a better solution, more easy to configure? on the other 
hand am I able now to use the power button as normal event button, and I am 
very happy!

Andreas

>>>> dbus_watch.py <<<<
#!/usr/bin/python
import gobject
import dbus
import dbus.glib
import os

def device_removed_callback(udi):
  if udi \ 
== '/org/freedesktop/Hal/devices/usb_device_41e_3020_noserial_if0_oss_pcm_0_0':
    os.system('/etc/lirc/lirc.stop')
    print '\7' # beep

def device_added_callback(udi):
  if udi \ 
== '/org/freedesktop/Hal/devices/usb_device_41e_3020_noserial_usbraw':
    os.system('/etc/lirc/lirc.start')
    print '\7' # beep

bus = dbus.SystemBus()
hal_manager_obj = \
bus.get_object('org.freedesktop.Hal', '/org/freedesktop/Hal/Manager')
hal_manager = dbus.Interface(hal_manager_obj, 'org.freedesktop.Hal.Manager')

hal_manager.connect_to_signal('DeviceAdded', device_added_callback)
hal_manager.connect_to_signal('DeviceRemoved', device_removed_callback)

mainloop = gobject.MainLoop()
mainloop.run()
>>>> end of code <<<<

replace the dbus string (like /usb_device_41e_3020_noserial_if0_oss_pcm_0_0) 
with a one you observed while watching the dbus with lshal --monitor


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Freevo-users mailing list
Freevo-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freevo-users

Reply via email to