This commit is contained in:
tTh 2024-03-31 21:25:19 +02:00
parent 7879c84020
commit 593eeeddc9

View File

@ -28,6 +28,7 @@ else {
} }
return "???"; return "???";
} }
/* ----------------------------------------------------------------- */
void dump_my_joystick(char *joy_device) void dump_my_joystick(char *joy_device)
{ {
int joy_fd, foo; int joy_fd, foo;
@ -47,23 +48,19 @@ fprintf(stderr, "Name: \"%s\"\n", joy_name);
for (;;) { for (;;) {
foo = read(joy_fd, &js, sizeof(struct js_event)); foo = read(joy_fd, &js, sizeof(struct js_event));
if ( ! flag ) {
debut = js.time;
flag = 1;
}
if (8 != foo) { if (8 != foo) {
fprintf(stderr, "%s: err reading joy\n", __func__); fprintf(stderr, "%s: err reading joy\n", __func__);
exit(1); exit(1);
} }
if ( ! flag ) {
printf("%8lu %4d / %-8s %2d %7d\n", debut = js.time;
flag = 1;
}
printf("%8lu %4d %-8s %3d %7d\n",
js.time-debut, js.time-debut,
js.type, type2txt(js.type), js.type, type2txt(js.type),
js.number, js.value); js.number, js.value);
} }
} }
/* ----------------------------------------------------------------- */ /* ----------------------------------------------------------------- */