X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=linux%2Fin_evdev.c;h=e6bdad1567203d2b2163c60b9bda85bd731d1899;hb=4ec1acc11b956edc554c72a5ee4e7d875d188ee6;hp=edfa6ef5f7f6dbefc65e83e17dfc01aa2defc6f3;hpb=e9b2926437ccf6b630cf79e00ed98f7934201c20;p=libpicofe.git diff --git a/linux/in_evdev.c b/linux/in_evdev.c index edfa6ef..e6bdad1 100644 --- a/linux/in_evdev.c +++ b/linux/in_evdev.c @@ -1,3 +1,13 @@ +/* + * (C) Gražvydas "notaz" Ignotas, 2008-2010 + * + * This work is licensed under the terms of any of these licenses + * (at your option): + * - GNU GPL, version 2 or later. + * - GNU LGPL, version 2.1 or later. + * See the COPYING file in the top-level directory. + */ + #include #include #include @@ -392,6 +402,8 @@ static int in_evdev_update_keycode(void *data, int *is_down) struct input_event ev; int rd; + /* do single event, the caller sometimes wants + * to do select() in blocking mode */ rd = read(dev->fd, &ev, sizeof(ev)); if (rd < (int) sizeof(ev)) { if (errno != EAGAIN) { @@ -517,6 +529,8 @@ static int in_evdev_menu_translate(void *drv_data, int keycode) return 0; } +/* FIXME: move to plat */ +#if 0 static const struct { short code; char btype; @@ -550,16 +564,18 @@ static const struct { { BTN_PINKIE, IN_BINDTYPE_EMU, PEVB_STATE_LOAD }, { BTN_BASE, IN_BINDTYPE_EMU, PEVB_MENU }, }; - -#define DEF_BIND_COUNT (sizeof(in_evdev_def_binds) / sizeof(in_evdev_def_binds[0])) +#endif static void in_evdev_get_def_binds(int *binds) { int i; - for (i = 0; i < DEF_BIND_COUNT; i++) - binds[IN_BIND_OFFS(in_evdev_def_binds[i].code, in_evdev_def_binds[i].btype)] = - 1 << in_evdev_def_binds[i].bit; + for (i = 0; ; i++) { + if (in_evdev_defbinds[i].bit == 0 && in_evdev_defbinds[i].code == 0) + break; + binds[IN_BIND_OFFS(in_evdev_defbinds[i].code, in_evdev_defbinds[i].btype)] = + 1 << in_evdev_defbinds[i].bit; + } } /* remove binds of missing keys, count remaining ones */