+ int *ival = val;
+ in_dev_t *dev;
+
+ dev = get_dev(dev_id);
+ if (dev == NULL || val == NULL)
+ return -1;
+
+ switch (what) {
+ case IN_CFG_BIND_COUNT:
+ *ival = dev->key_count;
+ break;
+ case IN_CFG_DOES_COMBOS:
+ *ival = dev->does_combos;
+ break;
+ case IN_CFG_BLOCKING:
+ case IN_CFG_KEY_NAMES:
+ return -1; /* not implemented */
+ default:
+ return DRV(dev->drv_id).get_config(dev->drv_data, what, ival);
+ }
+
+ return 0;
+}
+
+static int in_set_blocking(int is_blocking)
+{
+ int i, ret;
+
+ /* have_async_devs means we will have to do all reads async anyway.. */
+ if (!in_have_async_devs) {
+ for (i = 0; i < in_dev_count; i++) {
+ if (in_devices[i].probed)
+ DRV(in_devices[i].drv_id).set_config(in_devices[i].drv_data,
+ IN_CFG_BLOCKING, is_blocking);
+ }
+ }
+
+ menu_key_state = 0;
+
+ /* flush events */
+ do {
+ ret = in_update_keycode(NULL, NULL, NULL, 0);
+ } while (ret >= 0);
+
+ return 0;
+}
+
+int in_set_config(int dev_id, int what, const void *val, int size)
+{
+ const char * const *names;
+ const int *ival = val;
+ in_dev_t *dev;
+ int count;
+
+ if (what == IN_CFG_BLOCKING)
+ return in_set_blocking(*ival);
+
+ dev = get_dev(dev_id);
+ if (dev == NULL)
+ return -1;
+
+ switch (what) {
+ case IN_CFG_KEY_NAMES:
+ names = val;
+ count = size / sizeof(names[0]);
+
+ if (count < dev->key_count) {
+ lprintf("input: set_key_names: not enough keys\n");
+ return -1;
+ }
+
+ dev->key_names = names;
+ return 0;
+ case IN_CFG_DEFAULT_DEV:
+ /* just set last used dev, for now */
+ menu_last_used_dev = dev_id;