User:Solar.george

From Openmoko

(Difference between revisions)
Jump to: navigation, search
(New page: == O/P from /dev/input/event4 (Aux Button) == <pre> |----- time ------| |type| |code| |-value-| b088 4a43 c952 0000 0001 00a9 00010000 b088 4a43 c988 0000 0000 0000 0000000...)
 

Latest revision as of 20:06, 25 June 2009

[edit] O/P from /dev/input/event4 (Aux Button)

|----- time ------|  |type| |code|  |-value-|
b088 4a43 c952 0000   0001   00a9    00010000
b088 4a43 c988 0000   0000   0000    00000000
b088 4a43 661d 000a   0001   00a9    00000000
b088 4a43 6651 000a   0000   0000    00000000

Event type 0x01 (Keys or Buttons)

from Accelerometer_data_retrieval

  1. int, int, short, short, int

fmt = 'iihhi' # use with struct.unpack

#!/usr/bin/env python
import struct

ev_file = "/dev/input/event4"

#int, int, short, short, int
fmt = 'iihhi'

ev_open = open(ev_file, "rb")

aux = ev_open.read(16)
while aux:
    (time1, time2, ev_type, code, value) = struct.unpack(fmt, aux)
    print [time1,time2,ev_type,code,value]
    aux = ev_open.read(16)

ev_open.close 
Personal tools