Skip to content

Instantly share code, notes, and snippets.

@lstoll
Created January 28, 2010 19:45
Show Gist options
  • Save lstoll/289070 to your computer and use it in GitHub Desktop.
Save lstoll/289070 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
class HeadsetButtonMonitor:
def __init__(self):
self.bus = dbus.SystemBus()
obj = self.bus.get_object('org.freedesktop.Hal',
'/org/freedesktop/Hal/devices/computer_logicaldev_input_1')
iface = dbus.Interface(obj, 'org.freedesktop.Hal.Device')
iface.connect_to_signal("Condition", self.handler)
def handler(self,arg1,arg2):
print "HeadsetButtonMonitor: got headset switch (%s, %s)" % (arg1, arg2)
hbm = HeadsetButtonMonitor()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment