]> git.lizzy.rs Git - plan9front.git/blob - sys/src/cmd/aux/tablet.c
audiohda: fix syntax error
[plan9front.git] / sys / src / cmd / aux / tablet.c
1 #include <u.h>
2 #include <libc.h>
3 #include <bio.h>
4
5 Biobuf *tablet;
6 int mouseout;
7
8 int
9 main()
10 {
11         mouseout = open("/dev/mousein", OWRITE);
12         if(mouseout < 0) sysfatal("%r");
13         tablet = Bopen("/dev/tablet", OREAD);
14         if(tablet == nil) sysfatal("%r");
15         while(1) {
16                 char *line, *p;
17                 int x, y, b;
18                 
19                 line = Brdline(tablet, 10);
20                 if(!line) sysfatal("%r");
21                 p = line;
22                 if(*p++ != 'm') continue;
23                 if(*p++ != ' ') continue;
24                 x = strtol(p, &p, 10);
25                 if(*p++ != ' ') continue;
26                 y = strtol(p, &p, 10);
27                 if(*p++ != ' ') continue;
28                 b = strtol(p, &p, 10);
29                 if(*p++ != ' ') continue;
30                 fprint(mouseout, "A %d %d %d\n", x, y, b);
31         }
32 }