Merge "Getevent: make sure the monotonic timestamp is displayed; warning cleanup."
This commit is contained in:
commit
1dd77487ab
|
@ -295,6 +295,7 @@ static int open_device(const char *device, int print_flags)
|
|||
{
|
||||
int version;
|
||||
int fd;
|
||||
int clkid = CLOCK_MONOTONIC;
|
||||
struct pollfd *new_ufds;
|
||||
char **new_device_names;
|
||||
char name[80];
|
||||
|
@ -335,6 +336,11 @@ static int open_device(const char *device, int print_flags)
|
|||
idstr[0] = '\0';
|
||||
}
|
||||
|
||||
if (ioctl(fd, EVIOCSCLOCKID, &clkid) != 0) {
|
||||
fprintf(stderr, "Can't enable monotonic clock reporting: %s\n", strerror(errno));
|
||||
// a non-fatal error
|
||||
}
|
||||
|
||||
new_ufds = realloc(ufds, sizeof(ufds[0]) * (nfds + 1));
|
||||
if(new_ufds == NULL) {
|
||||
fprintf(stderr, "out of memory\n");
|
||||
|
@ -470,9 +476,9 @@ static int scan_dir(const char *dirname, int print_flags)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void usage(int argc, char *argv[])
|
||||
static void usage(char *name)
|
||||
{
|
||||
fprintf(stderr, "Usage: %s [-t] [-n] [-s switchmask] [-S] [-v [mask]] [-d] [-p] [-i] [-l] [-q] [-c count] [-r] [device]\n", argv[0]);
|
||||
fprintf(stderr, "Usage: %s [-t] [-n] [-s switchmask] [-S] [-v [mask]] [-d] [-p] [-i] [-l] [-q] [-c count] [-r] [device]\n", name);
|
||||
fprintf(stderr, " -t: show time stamps\n");
|
||||
fprintf(stderr, " -n: don't print newlines\n");
|
||||
fprintf(stderr, " -s: print switch states for given bits\n");
|
||||
|
@ -570,7 +576,7 @@ int getevent_main(int argc, char *argv[])
|
|||
fprintf(stderr, "%s: invalid option -%c\n",
|
||||
argv[0], optopt);
|
||||
case 'h':
|
||||
usage(argc, argv);
|
||||
usage(argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
} while (1);
|
||||
|
@ -582,7 +588,7 @@ int getevent_main(int argc, char *argv[])
|
|||
optind++;
|
||||
}
|
||||
if (optind != argc) {
|
||||
usage(argc, argv);
|
||||
usage(argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
nfds = 1;
|
||||
|
|
Loading…
Reference in New Issue