I'm on a basic device and not having access to X or ... so event.py doesn't works.
So here's my simpler decode code part to interpret from "deprecated" '/dev/input/mice':
import struct
file = open( "/dev/input/mice", "rb" );
def getMouseEvent():
buf = file.read(3);
button = ord( buf[0] );
bLeft = button & 0x1;
bMiddle = ( button & 0x4 ) > 0;
bRight = ( button & 0x2 ) > 0;
x,y = struct.unpack( "bb", buf[1:] );
print ("L:%d, M: %d, R: %d, x: %d, y: %d
" % (bLeft,bMiddle,bRight, x, y) );
# return stuffs
while( 1 ):
getMouseEvent();
file.close();
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…