View Single Post
Posts: 24 | Thanked: 10 times | Joined on Jun 2010
#29
PYTHON SCRIPT:

Code:
#! /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()
before run this script,you need to do these steps

Code:
sudo gainroot
cd /sys/class/leds/twl4030\:vibrator
chmod 666 brightness

Last edited by colakang; 2010-07-09 at 09:20.
 

The Following User Says Thank You to colakang For This Useful Post: