summaryrefslogtreecommitdiff
path: root/systemtap/dump-ps2/dump.stap
blob: 26a71c408ff8b5f924e9b326e74cf6c04afb8f6c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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);
}