[PATCH 0/9] HID++ (Logitech Unifying) protocol fixes

Peter Wu lekensteyn at gmail.com
Wed Aug 7 15:13:35 PDT 2013


Hi,

After upgrading to 0.9.21 on Arch Linux, I found the following log
messages in my journal:

    UPower-Linux-WARNING **: failed to coldplug unifying device: invalid response from device: 7

It turns out that the current implementation is very naive when reading
messages. The hidraw responses queue is not flushed when writing new
requests, therefore upower may retrieve older responses.

Worse, the responses are not checked for a match with the request.
Between writing a request and reading a response, a lot of new messages
could appear (think of mouse motion reports).

The following patches tries to address these shortcomings by:

 - flushing any unread responses before writing a new request. This is
   possible since upower does currently not consider HID++
   notifications, only direct feature reports (HID++ 2.0) or register
   reads (HID++ 1.0).
 - validating the response and retry reading a new response if
   necessary. This logic is based on ltunify[1].

Furthermore, the patches:

 - Detect when an attached device is not reachable and instead of
   printing a scary warning, show it only in verbose mode.
 - Support an alternative battery register as found in the K800 (and
   some other HID++ 1.0 devices).
 - Delay the initial probe to allow newly paired devices to get
   recognized (paired using ltunify or Solaar)

These patches can also be found on
https://git.lekensteyn.nl/upower/log/?h=hidpp-rework

Tested with a M525 (HID++ 2.0) and K800 (HID++ 1.0, 07 battery
register).

Regards,
Peter

 [1]: https://lekensteyn.nl/logitech-unifying.html#ltunify

Peter Wu (9):
  hidpp: refactor to introduce structure in protocol
  hidpp: validate messages, retry if invalid
  hidpp: clear message queue before initiating new requests
  hidpp: recognise HID++ 1.0 ping response again
  hidpp: do not print warnings if device is offline
  hidpp: support battery register 0x07
  hidpp: test only once for d7 register
  hidpp: assume HID++ 1.0 for unreachable devices
  hidpp: pick up devices that just got paired

 src/linux/hidpp-device.c       | 525 ++++++++++++++++++++++++++---------------
 src/linux/up-device-unifying.c |  19 +-
 2 files changed, 353 insertions(+), 191 deletions(-)

-- 
1.8.3.4



More information about the devkit-devel mailing list