summaryrefslogtreecommitdiffstats
path: root/testsuite/systemtap.examples/general/key.stp
blob: 8d2c866cdc2c0d7191d8a01b200c31ba8353b395 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#! /usr/bin/env stap

# Useless, but amusing. Based on an idea I saw on a
# dtrace site. (wav files are from emacs).

// KEY_ENTER = 28
probe kernel.function("kbd_event") {
  if ($event_type == 1 && $value) {
    if ($event_code == 28)
      system("play return.wav &> /dev/null")
    else
      system("play click.wav &> /dev/null")
  }
}

probe begin {
  printf("TYPEWRITER ON\n")
}

probe end {
  printf("DONE\n")
}