summaryrefslogtreecommitdiff
path: root/systemtap/dump-ps2/dump.stap
diff options
context:
space:
mode:
authorYves Fischer <yvesf-git@xapek.org>2013-01-16 14:37:47 +0100
committerYves Fischer <yvesf-git@xapek.org>2013-01-16 14:37:47 +0100
commit2d11a259569dd510123f726b862edcbe2b3c6e93 (patch)
tree208514bc5e274946f7e8e8c3998757b4c1706649 /systemtap/dump-ps2/dump.stap
parentdeb03a6a5058d85ee314c91ac6d23cd334357762 (diff)
downloadscripts-2d11a259569dd510123f726b862edcbe2b3c6e93.tar.gz
scripts-2d11a259569dd510123f726b862edcbe2b3c6e93.zip
ps2
Diffstat (limited to 'systemtap/dump-ps2/dump.stap')
-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);
+}