diff options
Diffstat (limited to 'rcm-server-keymap.c')
-rw-r--r-- | rcm-server-keymap.c | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/rcm-server-keymap.c b/rcm-server-keymap.c index 8a4fa3e..3231ed2 100644 --- a/rcm-server-keymap.c +++ b/rcm-server-keymap.c @@ -207,9 +207,6 @@ keymap_parse(FILE *fp, char **line, size_t *buf_size, struct keymap *keymap, keymap->keycodes[keycode_count].protocol = strdup(protocol); keymap->keycodes[keycode_count].scancode = scancode; keymap->keycodes[keycode_count].keycode = strdup(keycode); - printf("\tMapping: protocol %s scancode 0x%08" PRIx64 " keycode %s\n", - protocol, scancode, keycode); - } keycode_count++; } else { @@ -341,12 +338,10 @@ keymap_read(int dfd, const char *name) return NULL; fd = -1; - printf("Parsing keymap %s\n", name); + printf("Parsing keymap %s...\n", name); r = keymap_parse(fp, &line, &buf_size, NULL, &rows, &cols, &keycode_count); - if (r < 0) { - fprintf(stderr, "Invalid keymap: %s\n", name); + if (r < 0) return NULL; - } keymap = zmalloc(sizeof(*keymap) + sizeof(struct keycode) * keycode_count); if (!keymap) @@ -360,11 +355,15 @@ keymap_read(int dfd, const char *name) r = keymap_parse(fp, &line, &buf_size, keymap, NULL, NULL, NULL); if (r < 0) { - fprintf(stderr, "Invalid keymap: %s\n", name); free(keymap->layout); free(keymap); return NULL; } + + printf("\tKeymap added\n"); + printf("\tDescription: %s\n", keymap->desc); + printf("\tName: %s\n", keymap->name); + printf("\tMappings: %u entries\n", keycode_count); printf("\tLayout: %u rows x %u cols = %u entries\n", rows, cols, rows * cols); return keymap; } @@ -394,12 +393,8 @@ keymaps_load_dir(struct device *device, const char *path) if (keymap) continue; keymap = keymap_read(dfd, dent->d_name); - if (keymap) { - printf("Keymap added (0x%p)\n", keymap); - printf("\tDescription: %s\n", keymap->desc); - printf("\tName: %s\n", keymap->name); + if (keymap) list_add(&keymap->list, &device->keymaps); - } break; default: break; |