Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
May 28, 2024

Conversation

wprzytula
Copy link
Contributor

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.

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.
@PixlOne PixlOne merged commit 237fa5f into PixlOne:main May 28, 2024
@wprzytula wprzytula deleted the fix-uint8_t-cid branch May 28, 2024 04:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[WARN] Error adding device /dev/hidraw2: Device timed out - MX Keys for Business
2 participants