PixlOne / logiops

An unofficial userspace driver for HID++ Logitech devices
GNU General Public License v3.0
3.31k stars 263 forks source link

fix bug: represent cid as `uint16_t`, not `uint8_t` #414

Closed wprzytula closed 3 months ago

wprzytula commented 10 months ago

Fixes: #406 The problem description is in the referenced issue.

Diagnosis

The function ReprogControlsV4::setControlReporting() erroneously took cid as uint8_t. Because of that, reports contained only lower byte of any cid, so any ReprogControls request for such cid resulted in error response. Lack of error response handling in this library led to timeout.

E.g.:

[DEBUG] Configuring button: 0x103
[RAWREPORT] /dev/hidraw1 OUT: 11 ff 08 32 00 03 22 01 03 00 00 00 00 00 00 00 00 00 00 00
[RAWREPORT] /dev/hidraw1 IN:  11 ff ff 08 32 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00

We can see only lower byte (03) of cid present. Thus we get an error response (with feature id ff), but the logiops keeps waiting for response with feature id 08 and hence eventually timeouts.

Solution

ReprogControlsV4::setControlReporting() was modified to take cid as uint16_t.