diff options
-rw-r--r-- | keymaps/default/test.layout | 2 | ||||
-rw-r--r-- | rcm-client-receive.c | 7 | ||||
-rw-r--r-- | rcm-server-keymap.c | 11 | ||||
-rw-r--r-- | rcm-server-main.c | 13 |
4 files changed, 23 insertions, 10 deletions
diff --git a/keymaps/default/test.layout b/keymaps/default/test.layout index bf2ad56..7ec3d84 100644 --- a/keymaps/default/test.layout +++ b/keymaps/default/test.layout @@ -14,7 +14,7 @@ Button=KEY_POWER Button=KEY_POWER Button=KEY_POWER Button=KEY_POWER -Button=KEY_POWER +Button=Blank Button=KEY_POWER Button=KEY_VIDEO Button=KEY_VIDEO diff --git a/rcm-client-receive.c b/rcm-client-receive.c index f88b453..b12b0c2 100644 --- a/rcm-client-receive.c +++ b/rcm-client-receive.c @@ -399,15 +399,18 @@ void rcng_client_receive_init_ui(GDBusObject *new_hw) gtk_container_set_border_width(GTK_CONTAINER(grid), 12); while (g_variant_iter_loop (&iter, "@a{sv}", &item)) { + gchar *type; gchar *protocol; guint64 scancode; gchar *keycode; + g_variant_lookup(item, "type", "s", &type); g_variant_lookup(item, "protocol", "s", &protocol); g_variant_lookup(item, "scancode", "t", &scancode); g_variant_lookup(item, "keycode", "s", &keycode); - new_button_add(GTK_GRID(grid), protocol, scancode, keycode, NULL, col, row, 1, 1); + if (!strcmp(type, "button")) + new_button_add(GTK_GRID(grid), protocol, scancode, keycode, NULL, col, row, 1, 1); col++; if (col >= km_width) { @@ -415,7 +418,7 @@ void rcng_client_receive_init_ui(GDBusObject *new_hw) row++; } - printf("Got a key: %s:0x%08" PRIx64 ":%s\n", protocol, scancode, keycode); + printf("Got a %s: %s:0x%08" PRIx64 ":%s\n", type, protocol, scancode, keycode); } gtk_widget_show_all(scrollda); diff --git a/rcm-server-keymap.c b/rcm-server-keymap.c index 39b4440..af72045 100644 --- a/rcm-server-keymap.c +++ b/rcm-server-keymap.c @@ -233,8 +233,12 @@ keymap_parse(FILE *fp, char **line, size_t *buf_size, struct keymap *keymap, } } else if (!strcasecmp(p, "Button")) { - if (keymap) - keymap->layout[layout_count] = &keymap->keycodes[1]; + if (keymap) { + if (!strcasecmp(tmp, "Blank")) + keymap->layout[layout_count] = NULL; + else + keymap->layout[layout_count] = &keymap->keycodes[1]; + } layout_count++; } else { @@ -270,7 +274,8 @@ keymap_parse(FILE *fp, char **line, size_t *buf_size, struct keymap *keymap, } if (rows * cols != layout_count) { - fprintf(stderr, "Layout does not match rows x cols\n"); + fprintf(stderr, "Layout (%u) does not match rows x cols (%ux%u)\n", + layout_count, rows, cols); return -EINVAL; } diff --git a/rcm-server-main.c b/rcm-server-main.c index 3379697..3d8ceee 100644 --- a/rcm-server-main.c +++ b/rcm-server-main.c @@ -155,10 +155,15 @@ method_getkeymap(sd_bus_message *m, void *userdata, sd_bus_error *error) goto out; for (i = 0; i < (keymap->rows * keymap->cols); i++) { - r = sd_bus_message_append(reply, "a{sv}", 3, - "protocol", "s", keymap->layout[i]->protocol, - "scancode", "t", keymap->layout[i]->scancode, - "keycode", "s", keymap->layout[i]->keycode); + if (!keymap->layout[i]) + r = sd_bus_message_append(reply, "a{sv}", 1, + "type", "s", "blank"); + else + r = sd_bus_message_append(reply, "a{sv}", 4, + "type", "s", "button", + "protocol", "s", keymap->layout[i]->protocol, + "scancode", "t", keymap->layout[i]->scancode, + "keycode", "s", keymap->layout[i]->keycode); if (r < 0) goto out; } |