Commit graph

5 commits

Author SHA1 Message Date
Peter Wu
a7766cfde9 hidpp: fix K750 battery and luminosity properties
Since commit b1f12feb1f ("Factor out the
Logitech Unifying support to support other devices"), the battery status
would always be reported as 1% for the K750 keyboard. Besides that, the
luminosity level was removed. This patch fixes the battery level and
re-adds the luminosity level.

To avoid negativity issues when reading light level into a double type,
make the HidppMessage params unsigned.

Signed-off-by: Peter Wu <lekensteyn@gmail.com>
2013-09-03 08:31:28 +02:00
Peter Wu
984d88f943 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>
2013-09-03 08:31:27 +02:00
Peter Wu
a802862821 hidpp: fix properties for unreachable devices (v2)
This includes "is-present" and "state" (which will be marked "unknown").
"percentage" is not touched since it is still an indication of the
battery level, changing it to zero is not helpful.

Previously, properties were never updated because the refresh would
fail when the battery refresh request failed.

 - v2: fix invalid return value when an invalid parameter is passed to
   hidpp_device_is_reachable.

Signed-off-by: Peter Wu <lekensteyn@gmail.com>
2013-09-03 08:31:27 +02:00
Arkadiusz Miśkiewicz
d4bec29c82 hid++v1 detection for unreachable devices and features upgrade
We are back to using HIDPP_FEATURE_ROOT_FN_PING for detecting protocol
since it's the official way described in [1].

Unfortunately unreachable devices ("disconnected" in logitech
terminology) don't respond to this v1 ping query as described in docs.
Seems that docs cover only reachable state reply for version checking.
Thus we have to consider HIDPP_ERROR_CODE_UNSUPPORTED to also be v1
(since we actually got some v1 valid answer - error reply).

Introduce HIDPP_REFRESH_FLAGS_FEATURES for checking features provided
by v2 device. This recheck is triggered when we upgrade from any
protocol to v2 in HIDPP_REFRESH_FLAGS_VERSION. This allows us to
properly upgrade from v0/v1 to v2 and also we don't send v2 queries
when we know that the device is v1.

[1] logitech_hidpp10_specification_for_Unifying_Receivers.doc

Signed-off-by: Arkadiusz Miśkiewicz <arekm@maven.pl>
Signed-off-by: Richard Hughes <richard@hughsie.com>
2013-03-28 12:13:31 +00:00
Richard Hughes
b1f12feb1f Factor out the Logitech Unifying support to support other devices 2013-01-10 12:08:46 +00:00