summaryrefslogtreecommitdiff
path: root/systemtap
diff options
context:
space:
mode:
Diffstat (limited to 'systemtap')
-rw-r--r--systemtap/dump-ps2/dump.stap24
1 files changed, 24 insertions, 0 deletions
diff --git a/systemtap/dump-ps2/dump.stap b/systemtap/dump-ps2/dump.stap
new file mode 100644
index 0000000..26a71c4
--- /dev/null
+++ b/systemtap/dump-ps2/dump.stap
@@ -0,0 +1,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);
+}