Loading toolbox/getevent.c +10 −4 Original line number Diff line number Diff line Loading @@ -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]; Loading Loading @@ -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"); Loading Loading @@ -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"); Loading Loading @@ -568,7 +574,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); Loading @@ -580,7 +586,7 @@ int getevent_main(int argc, char *argv[]) optind++; } if (optind != argc) { usage(argc, argv); usage(argv[0]); exit(1); } nfds = 1; Loading Loading
toolbox/getevent.c +10 −4 Original line number Diff line number Diff line Loading @@ -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]; Loading Loading @@ -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"); Loading Loading @@ -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"); Loading Loading @@ -568,7 +574,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); Loading @@ -580,7 +586,7 @@ int getevent_main(int argc, char *argv[]) optind++; } if (optind != argc) { usage(argc, argv); usage(argv[0]); exit(1); } nfds = 1; Loading