summaryrefslogtreecommitdiff
path: root/src/linux/up-device-unifying.c
diff options
context:
space:
mode:
authorPeter Wu <lekensteyn@gmail.com>2013-08-19 12:46:48 +0200
committerMartin Pitt <martinpitt@gnome.org>2013-09-03 08:31:27 +0200
commit984d88f9437c1e1a3e5397829051eedb6564270e (patch)
tree4b20d729cdc874da78499965e7384ec1f5041cfd /src/linux/up-device-unifying.c
parent81ea62d8e1b4fba22f1c8cb921320a83d96a50c7 (diff)
downloadupower-984d88f9437c1e1a3e5397829051eedb6564270e.tar.gz
hidpp: retrieve serial number for devices (v2)
Before this, history files were saved as history-rate-M525.dat. Since multiple devices of the same model might be connected, this name is not unique enough. The serial number gives a more reliable path for the history files and allows clients to distinguish their devices (an object path like /org/freedesktop/UPower/devices/mouse_0003o046DoC52Bx0018 does not stay the same). Note: if a serial number cannot be read, instead of reverting this patch, consider splitting the serial refresh from the version, kind and model refresh. - v2: Fix invalid return value when an invalid parameter is passed to hidpp_device_get_serial. Signed-off-by: Peter Wu <lekensteyn@gmail.com>
Diffstat (limited to 'src/linux/up-device-unifying.c')
-rw-r--r--src/linux/up-device-unifying.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/linux/up-device-unifying.c b/src/linux/up-device-unifying.c
index 989ac48..8ebf946 100644
--- a/src/linux/up-device-unifying.c
+++ b/src/linux/up-device-unifying.c
@@ -246,6 +246,7 @@ up_device_unifying_coldplug (UpDevice *device)
ret = hidpp_device_refresh (unifying->priv->hidpp_device,
HIDPP_REFRESH_FLAGS_VERSION |
HIDPP_REFRESH_FLAGS_KIND |
+ HIDPP_REFRESH_FLAGS_SERIAL |
HIDPP_REFRESH_FLAGS_MODEL,
&error);
if (!ret) {
@@ -264,6 +265,7 @@ up_device_unifying_coldplug (UpDevice *device)
"vendor", vendor,
"type", up_device_unifying_get_device_kind (unifying),
"model", hidpp_device_get_model (unifying->priv->hidpp_device),
+ "serial", hidpp_device_get_serial (unifying->priv->hidpp_device),
"has-history", TRUE,
"is-rechargeable", TRUE,
"power-supply", FALSE,