summaryrefslogtreecommitdiffstats
path: root/examples/small_demos/key.stp
blob: 0489524a7337ad4b2b2a88c368fc1fc32306895c (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")
		else
			system("play click.wav")
	}
}

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

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