[packages/upower] - detect lg-wireless devices by looking for usbmisc/hiddev entries
arekm
arekm at pld-linux.org
Thu Mar 28 09:35:30 CET 2013
commit 8103521f2645b505820afe4e3546e9df8b75cdaf
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date: Thu Mar 28 09:35:27 2013 +0100
- detect lg-wireless devices by looking for usbmisc/hiddev entries
upower-fixes.patch | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 51 insertions(+)
---
diff --git a/upower-fixes.patch b/upower-fixes.patch
index a58a3e3..90daf04 100644
--- a/upower-fixes.patch
+++ b/upower-fixes.patch
@@ -641,3 +641,54 @@ index 935cd07..3f249a8 100644
GType hidpp_device_get_type (void);
+diff --git a/src/linux/up-device-unifying.c b/src/linux/up-device-unifying.c
+index ea8b0b3..9023ac2 100644
+--- a/src/linux/up-device-unifying.c
++++ b/src/linux/up-device-unifying.c
+@@ -183,11 +188,32 @@ up_device_unifying_coldplug (UpDevice *device)
+ hidraw_list = g_udev_client_query_by_subsystem (client, "hidraw");
+ for (l = hidraw_list; l != NULL; l = l->next) {
+ if (g_strcmp0 (type, "lg-wireless") == 0) {
++ gboolean receiver_found = FALSE;
++ const gchar *filename;
++ GDir* dir;
++
+ if (g_strcmp0 (g_udev_device_get_sysfs_path (native),
+ g_udev_device_get_sysfs_path(g_udev_device_get_parent(l->data))) != 0)
+ continue;
+- // Ugly way to distinguish receiver itself from mouse/keyboard etc for non-unifying dongles
+- if (g_strcmp0(g_udev_device_get_property(g_udev_device_get_parent (native), "INTERFACE"), "3/0/0") != 0)
++
++ /* hidraw device which exposes hiddev interface is our receiver */
++ tmp = g_build_filename(g_udev_device_get_sysfs_path (g_udev_device_get_parent(native)),
++ "usbmisc", NULL);
++ dir = g_dir_open (tmp, 0, &error);
++ g_free(tmp);
++ if (error) {
++ g_clear_error(&error);
++ continue;
++ }
++ while ( (filename = g_dir_read_name(dir)) ) {
++ if (g_ascii_strncasecmp(filename, "hiddev", 6) == 0) {
++ receiver_found = TRUE;
++ break;
++ }
++ }
++ g_dir_close(dir);
++
++ if (!receiver_found)
+ continue;
+ } else {
+ if (g_strcmp0 (g_udev_device_get_sysfs_path (parent),
+
+diff --git a/rules/95-upower-csr.rules b/rules/95-upower-csr.rules
+index b476660..ffd55b2 100644
+--- a/rules/95-upower-csr.rules
++++ b/rules/95-upower-csr.rules
+@@ -25,5 +25,6 @@ SUBSYSTEM!="hid", GOTO="up_unifying_end"
+ ATTRS{idVendor}=="046d", ENV{UPOWER_VENDOR}="Logitech, Inc."
+ ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c52b", DRIVER=="logitech-djdevice", ENV{UPOWER_BATTERY_TYPE}="unifying"
+ ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c532", DRIVER=="logitech-djdevice", ENV{UPOWER_BATTERY_TYPE}="unifying"
++ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c52e", ENV{UPOWER_BATTERY_TYPE}="lg-wireless"
+ ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c52f", ENV{UPOWER_BATTERY_TYPE}="lg-wireless"
+ LABEL="up_unifying_end"
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/upower.git/commitdiff/8103521f2645b505820afe4e3546e9df8b75cdaf
More information about the pld-cvs-commit
mailing list