void (*evdev_synch)(Device *d, struct timeval tv);
void (*hiddev_event)(Device *d, const struct hiddev_usage_ref *ur);
int (*hiddev_xflags)(void);
+ void (*opened)(Device *d);
void (*redacted)(Device *d, int nstrs, const char *strs[nstrs], int value);
void (*died)(Device *d, int revents, int readr, int readc, int e)
__attribute__((noreturn));
r= ioctl(d->fd, EVIOCGID, &iid);
if (r) diee("%s: failed to get id",d->path);
-
- printf("device %s bustype ", d->path);
+
+ mode->opened(d);
+ printf(" bustype ");
PR_TABLE_STR(bus, iid.bustype);
DUMP_VPV(iid);
putchar('\n');
r= ioctl(d->fd, HIDIOCGDEVINFO, &di);
if (r) diee("hiddev %s: ioctl HIDIOCGDEVINFO", d->path);
- printf("device %s bustype ", d->path);
+ mode->opened(d);
+ printf(" bustype ");
PR_TABLE_STR(bus, di.bustype);
printf(" bus %d dev %d if %d", di.busnum, di.devnum, di.ifnum);
DUMP_VPV(di);
exit(0);
}
+static void dump_opened(Device *d) {
+ printf("device %s", d->path);
+}
+
static void mainloop(void) {
struct pollfd *polls;
int i, r, npolls;
static const ModeInfo mode_dump= {
evdev_dump, evdev_readable_dump, evdev_synch_dump,
hiddev_dump, hiddev_xflags_dump,
- 0, dump_died, mainloop
+ dump_opened, 0, dump_died, mainloop
};
/*---------- mode redact ----------*/
putchar('\n');
}
+static void redact_opened(Device *d) {
+ printf("%s opened", d->label);
+}
+
static const ModeInfo mode_redact= {
evdev_redact, 0, 0,
hiddev_redact, 0,
- redact_redacted, dump_died, mainloop
+ redact_opened, redact_redacted, dump_died, mainloop
};
static void redaction(const char ***argv) {