1 from struct import pack
2 from Components.Sources.Source import Source
3 from Tools.HardwareInfo import HardwareInfo
5 class RemoteControl(Source):
6 def __init__(self, session):
10 self.res = [ False, "Missing or wrong argument" ]
12 def handleCommand(self, cmd):
14 self.res = self.sendEvent()
17 if self.cmd == "" or self.cmd is None:
18 print "[RemoteControl.py] cmd is empty or None"
23 print "[RemoteControl.py] command <= 0 (%s)" % type
24 return [ False, "the command was not > 0" ]
26 dataon = pack('iiHHi', 0, 0, 1, type, 1)
27 dataoff = pack('iiHHi', 0, 0, 1, type, 0)
29 if HardwareInfo.device_name == "dm8000":
30 fp = open("/dev/input/event2", 'wb')
32 fp = open("/dev/input/event1", 'wb')
37 print "[RemoteControl.py] command was was sent (%s)" % type
38 return [ True, "command was was sent" ]
44 result = property(getResult)