function timestamp:string() { printf("[%012ld]\t", jiffies()); } probe module("psmouse").function("psmouse_process_byte") { timestamp(); for (i=0; i < $psmouse->pktsize; i++) { printf("%02x ", $psmouse->packet[i]); } btnLeft = ($psmouse->packet[0] >> 0) & 1; btnRight = ($psmouse->packet[0] >> 1) & 1; btnMiddle = ($psmouse->packet[0] >> 2) & 1; yOver = ($psmouse->packet[0] >> 7) & 1; xOver = ($psmouse->packet[0] >> 6) & 1; moveX = (($psmouse->packet[0] >> 4) & 1) ? -1*(255-$psmouse->packet[1]) : $psmouse->packet[1]; moveY = (($psmouse->packet[0] >> 5) & 1) ? -1*(255-$psmouse->packet[2]) : $psmouse->packet[2]; printf(" moveX=%04d moveY=%04d yOver=%d xOver=%d", moveX, moveY, yOver, xOver); printf(" btnLeft=%d btnRight=%d btnMiddle=%d\n", btnLeft, btnRight, btnMiddle); }