summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Härdeman <david@hardeman.nu>2015-08-13 21:58:00 +0200
committerDavid Härdeman <david@hardeman.nu>2015-08-13 21:58:00 +0200
commit4b37e07e7c0ebfee00406617f40dc8bdbb9622f3 (patch)
tree9b9dd8c315c115ddade56f483e6c9870af883b55
parentf1d9e707d0875ef418d2b8c570afcea522101a62 (diff)
Add driver description and dev name to dbus protocol
-rw-r--r--RemoteControlManager.xml2
-rw-r--r--rcm-client-hardware-list.c46
-rw-r--r--rcm-client.ui2
-rw-r--r--rcm-server-evdev.c3
-rw-r--r--rcm-server-main.c11
-rw-r--r--rcm-server-main.h1
6 files changed, 50 insertions, 15 deletions
diff --git a/RemoteControlManager.xml b/RemoteControlManager.xml
index 78cef7a..cc7438c 100644
--- a/RemoteControlManager.xml
+++ b/RemoteControlManager.xml
@@ -31,6 +31,8 @@
<signal name='KeyReleased'>
<arg type='s' name='keycode'/>
</signal>
+ <property name='SysName' type='s' access='read'/>
+ <property name='Description' type='s' access='read'/>
<property name='DriverName' type='s' access='read'/>
<property name='KernelKeymapName' type='s' access='read'/>
<property name='HardwareType' type='s' access='read'/>
diff --git a/rcm-client-hardware-list.c b/rcm-client-hardware-list.c
index 597e26c..12d0052 100644
--- a/rcm-client-hardware-list.c
+++ b/rcm-client-hardware-list.c
@@ -68,29 +68,49 @@ void rcng_client_hardware_list_add(GDBusObject *hw)
gchar *labeltxt;
GtkWidget *hw_list_swin;
GtkWidget *hw_list_box;
+ GDBusInterface *interface;
+ RCDevice *object;
g_print(" - Object at %s\n", g_dbus_object_get_object_path(hw));
interfaces = g_dbus_object_get_interfaces(hw);
for (ll = interfaces; ll != NULL; ll = ll->next) {
- GDBusInterface *interface = G_DBUS_INTERFACE(ll->data);
- g_print (" - Interface %s\n", g_dbus_interface_get_info(interface)->name);
+ GDBusInterface *iface = G_DBUS_INTERFACE(ll->data);
+ g_print (" - Interface %s\n", g_dbus_interface_get_info(iface)->name);
}
- g_list_free_full (interfaces, g_object_unref);
+ g_list_free_full(interfaces, g_object_unref);
+
+ interface = g_dbus_object_get_interface(hw, "org.gnome.RemoteControlManager.Device");
+ if (!interface)
+ return;
+
+ object = RCDEVICE(interface);
+ printf("Name: %s, Desc: %s, Driver: %s, Kernel keymap: %s, HW: %s\n",
+ rcdevice_get_sys_name(object),
+ rcdevice_get_description(object),
+ rcdevice_get_driver_name(object),
+ rcdevice_get_kernel_keymap_name(object),
+ rcdevice_get_hardware_type(object));
row = gtk_list_box_row_new();
- box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
- icon = gtk_image_new_from_icon_name("gtk-harddisk", GTK_ICON_SIZE_DIALOG);
- gtk_widget_set_valign(icon, GTK_ALIGN_START);
+ box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 12);
+ gtk_widget_set_margin_top(box, 6);
+ gtk_widget_set_margin_bottom(box, 6);
+ gtk_widget_set_margin_start(box, 12);
+ gtk_widget_set_margin_end(box, 12);
+ icon = gtk_image_new_from_icon_name("input-dialpad-symbolic", GTK_ICON_SIZE_MENU);
+ gtk_widget_set_valign(icon, GTK_ALIGN_CENTER);
gtk_widget_set_halign(icon, GTK_ALIGN_START);
- gtk_widget_set_margin_start(icon, 12);
- gtk_widget_set_margin_end(icon, 12);
- labeltxt = g_strdup_printf("<b>Hardware</b>\n\ntest\ntest\ntest%s", g_dbus_object_get_object_path(hw));
- label = gtk_label_new(NULL);
- gtk_label_set_markup(GTK_LABEL(label), labeltxt);
+ labeltxt = g_strdup_printf("%s: %s (%s)",
+ rcdevice_get_sys_name(object),
+ rcdevice_get_description(object),
+ rcdevice_get_driver_name(object));
+ label = gtk_label_new(labeltxt);
g_free(labeltxt);
- button = gtk_button_new_from_icon_name("emblem-system-symbolic", GTK_ICON_SIZE_MENU);
- gtk_widget_set_valign(button, GTK_ALIGN_END);
+ gtk_widget_set_valign(label, GTK_ALIGN_CENTER);
+ //button = gtk_button_new_from_icon_name("emblem-system-symbolic", GTK_ICON_SIZE_MENU);
+ button = gtk_button_new_from_icon_name("accessories-calculator-symbolic", GTK_ICON_SIZE_MENU);
+ gtk_widget_set_valign(button, GTK_ALIGN_CENTER);
gtk_widget_set_halign(button, GTK_ALIGN_END);
g_signal_connect(button, "clicked", G_CALLBACK(on_hw_selected), hw);
gtk_box_pack_start(GTK_BOX(box), icon, FALSE, FALSE, 0);
diff --git a/rcm-client.ui b/rcm-client.ui
index a3ed161..5a2495f 100644
--- a/rcm-client.ui
+++ b/rcm-client.ui
@@ -54,7 +54,7 @@
<property name="valign">start</property>
<property name="xalign">0</property>
<property name="yalign">0</property>
- <property name="icon_name">input-keyboard</property>
+ <property name="icon_name">input-dialpad</property>
<property name="icon_size">6</property>
</object>
<packing>
diff --git a/rcm-server-evdev.c b/rcm-server-evdev.c
index afd89f7..1c04864 100644
--- a/rcm-server-evdev.c
+++ b/rcm-server-evdev.c
@@ -265,6 +265,7 @@ evdev_setup(struct device *device, const char *path)
int r;
struct keymap *keymap;
+ /* FIXME: Fixup error handling */
if (!device)
return -EINVAL;
@@ -281,6 +282,8 @@ evdev_setup(struct device *device, const char *path)
return r;
}
+ device->input_name = strdup(libevdev_get_name(device->evdev_dev));
+
printf("Performing evdev setup for device %s (%s)\n",
device->path, libevdev_get_name(device->evdev_dev));
r = evdev_clear_keymap(device);
diff --git a/rcm-server-main.c b/rcm-server-main.c
index bd48c80..65c82f7 100644
--- a/rcm-server-main.c
+++ b/rcm-server-main.c
@@ -44,7 +44,11 @@ property_get(sd_bus *bus, const char *path, const char *interface,
return -EINVAL;
}
- if (!strcmp(property, "DriverName"))
+ if (!strcmp(property, "SysName"))
+ return sd_bus_message_append(reply, "s", dev->name);
+ else if (!strcmp(property, "Description"))
+ return sd_bus_message_append(reply, "s", dev->input_name);
+ else if (!strcmp(property, "DriverName"))
return sd_bus_message_append(reply, "s", dev->driver_name);
else if (!strcmp(property, "KernelKeymapName"))
return sd_bus_message_append(reply, "s", dev->keymap_name);
@@ -645,6 +649,8 @@ out:
static const sd_bus_vtable device_vtable[] = {
SD_BUS_VTABLE_START(0),
+ SD_BUS_PROPERTY("SysName", "s", property_get, 0, 0),
+ SD_BUS_PROPERTY("Description", "s", property_get, 0, 0),
SD_BUS_PROPERTY("DriverName", "s", property_get, 0, 0),
SD_BUS_PROPERTY("KernelKeymapName", "s", property_get, 0, 0),
SD_BUS_PROPERTY("HardwareType", "s", property_get, 0, 0),
@@ -776,6 +782,8 @@ add_device(struct manager *mgr, struct udev_device *udev)
printf("\tSubsystem : %s\n", udev_device_get_subsystem(udev));
printf("\tDevtype : %s\n", udev_device_get_devtype(udev));
printf("\tAction : %s\n", udev_device_get_action(udev));
+ printf("\tName : %s\n", device->name);
+ printf("\tInput name: %s\n", device->input_name);
printf("\tDriver : %s\n", device->driver_name);
printf("\tKernel map: %s\n", device->keymap_name);
printf("\tDevnode fd: %i\n", device->evdev_fd);
@@ -907,6 +915,7 @@ free_manager(struct manager *mgr) {
struct device *dev = list_first_entry(&mgr->devices, typeof(*dev), list);
list_del(&dev->list);
free(dev->path);
+ free(dev->input_name);
free(dev->driver_name);
free(dev->keymap_name);
diff --git a/rcm-server-main.h b/rcm-server-main.h
index 5124d84..0be3bf4 100644
--- a/rcm-server-main.h
+++ b/rcm-server-main.h
@@ -4,6 +4,7 @@
struct device {
char *name;
char *path;
+ char *input_name;
char *driver_name;
char *keymap_name;
int evdev_fd;