#include "signal_exit.h"
#include "json_helpers.h"
-static void keys_cb(EV_P_ ev_io *w_, int revents)
+void keys_json_print(int fd, char key)
{
- static char *type = "keys";
+ static const char *type = "keys";
+
+ JSON_START();
+ JSON_STR(type);
+ JSON_NEXT();
+ JSON_CHAR(key);
+ JSON_END();
+}
+static void keys_cb(EV_P_ ev_io *w_, int revents)
+{
ev_io_keys *w = (ev_io_keys *)w_;
int fd = w->fd;
struct input_event ev;
break;
default:
fprintf(stderr, "unsupported event code: %d\n", ev.code);
- return;
+ key = '?';
+ //return;
}
- JSON_START();
- JSON_STR(type);
- JSON_NEXT();
- JSON_CHAR(key);
- JSON_END();
+ keys_json_print(fd, key);
}
}