#! /usr/bin/env python2.5 # -*- coding: utf-8 -*- import pygtk import gtk from gtk import Window, Button, Widget import hildon import time import os import gobject, dbus from dbus.mainloop.glib import DBusGMainLoop vibrator=0 def connect_call(message, actor, memberids): #print 'message = %s' % message #print '\n actor = %s' % actor #print '\n memberids = %s' % memberids global vibrator if actor==1 and message==0: vibrator=1 return if actor==1 and message==1 and vibrator==1: os.system('echo 100 > /sys/class/leds/twl4030\:vibrator/brightness') time.sleep(1) os.system('echo 0 > /sys/class/leds/twl4030\:vibrator/brightness') vibrator=0 return DBusGMainLoop(set_as_default=True) bus = dbus.SystemBus() bus.add_signal_receiver(connect_call, path='/com/nokia/csd/call/1', dbus_interface='com.nokia.csd.Call.Instance', signal_name='AudioConnect') gobject.MainLoop().run() if __name__ == '__main__': gtk.main()
sudo gainroot cd /sys/class/leds/twl4030\:vibrator chmod 666 brightness