Advertisement
Guest User

iconnect-otb-button

a guest
Mar 28th, 2012
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.39 KB | None | 0 0
  1. import struct
  2. import os
  3. inputDevice = "/dev/input/event0"
  4. inputEventFormat = 'iihhi'
  5. inputEventSize = 16
  6.  
  7. file = open(inputDevice, "rb")
  8. event = file.read(inputEventSize)
  9. while event:
  10.   (time1, time2, type, code, value) = struct.unpack(inputEventFormat, event)
  11.   if type == 5 and code == 1 and value == 1:
  12.    os.system("otb-script.sh")
  13.   event = file.read(inputEventSize)
  14. file.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement