+/*
+ * (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 <stdio.h>
#include <stdlib.h>
#include <string.h>
drv = &DRV(in_devices[dev_id].drv_id);
result = drv->update_keycode(in_devices[dev_id].drv_data, &is_down);
-
- /* update_keycode() might return -1 when some not interesting
- * event happened, like sync event for evdev. */
if (result >= 0)
break;
}
}
- if (result == -1)
+ if (result < 0)
return -1;
finish:
/* keep track of menu key state, to allow mixing
return xname;
}
+int in_get_key_code(int dev_id, const char *key_name)
+{
+ in_dev_t *dev;
+ int i;
+
+ if (dev_id < 0) /* want last used dev? */
+ dev_id = menu_last_used_dev;
+
+ if (dev_id < 0 || dev_id >= IN_MAX_DEVS)
+ return -1;
+
+ dev = &in_devices[dev_id];
+ if (dev->key_names == NULL)
+ return -1;
+
+ for (i = 0; i < dev->key_count; i++)
+ if (dev->key_names[i] && strcasecmp(dev->key_names[i], key_name) == 0)
+ return i;
+
+ return -1;
+}
+
int in_bind_key(int dev_id, int keycode, int mask, int bind_type, int force_unbind)
{
int ret, count;