iankelling.org
/
git
/
evhz
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Also show the polling rate for graphics tables
[evhz]
/
evhz.c
diff --git
a/evhz.c
b/evhz.c
index a34fd83277723d9397905669bc8a47451ef10a1b..947ab819be91523433dc38226795fb81f31a24f8 100644
(file)
--- a/
evhz.c
+++ b/
evhz.c
@@
-28,20
+28,27
@@
int main(int argc, char *argv[]) {
int optch;
int i;
event_t events[EVENTS];
int optch;
int i;
event_t events[EVENTS];
- int verbose =
0
;
+ int verbose =
1
;
- while((optch = getopt(argc, argv, "h
v
")) != -1) {
+ while((optch = getopt(argc, argv, "h
n
")) != -1) {
switch(optch) {
case('h'):
switch(optch) {
case('h'):
- printf("Usage: %s [-v|-h]\n", argv[0]);
+ printf("Usage: %s [-n|-h]\n", argv[0]);
+ printf("-n nonverbose\n");
+ printf("-h help\n");
return 0;
break;
return 0;
break;
- case('
v
'):
- verbose =
1
;
+ case('
n
'):
+ verbose =
0
;
break;
}
}
break;
}
}
+ if(geteuid() != 0) {
+ printf("%s must be used as superuser\n", argv[0]);
+ return 1;
+ }
+
signal(SIGINT, sigint);
printf("Press CTRL-C to exit.\n\n");
signal(SIGINT, sigint);
printf("Press CTRL-C to exit.\n\n");
@@
-50,7
+57,7
@@
int main(int argc, char *argv[]) {
// List input devices
for(i = 0; i < EVENTS; i++) {
// List input devices
for(i = 0; i < EVENTS; i++) {
- char device[1
8
];
+ char device[1
9
];
sprintf(device, "/dev/input/event%i", i);
events[i].fd = open(device, O_RDONLY);
sprintf(device, "/dev/input/event%i", i);
events[i].fd = open(device, O_RDONLY);
@@
-87,7
+94,7
@@
int main(int argc, char *argv[]) {
continue;
}
continue;
}
- if(event.type == EV_REL) {
+ if(event.type == EV_REL
|| event.type == EV_ABS
) {
double time;
int hz;
double time;
int hz;