Skip to content

Fix printing of uint_16t CIDs#532

Open
waldyrious wants to merge 2 commits intoPixlOne:mainfrom
waldyrious:fix-uint_16t-printing
Open

Fix printing of uint_16t CIDs#532
waldyrious wants to merge 2 commits intoPixlOne:mainfrom
waldyrious:fix-uint_16t-printing

Conversation

@waldyrious
Copy link

@waldyrious waldyrious commented Jan 12, 2026

In #414, @wprzytula changed CIDs from uint8_t to be uint16_t instead, but the code that prints these values was not adapted accordingly. This patch adjust the printing code for CIDs to ensure they consider the wider length of uint_16t's hex representations.

For comparison, here's the output I get with the current v0.3.5 (note the misalignment in the 0x1a0 line of the "remappable buttons" table):

$ sudo logid -v
[DEBUG] Unsupported device /dev/hidraw4 ignored
[DEBUG] Unsupported device /dev/hidraw1 ignored
[DEBUG] Unsupported device /dev/hidraw2 ignored
[DEBUG] Unsupported device /dev/hidraw3 ignored
[DEBUG] Unsupported device /dev/hidraw0 ignored
[INFO] Device found: MX Master 4 on /dev/hidraw5:255
[DEBUG] /dev/hidraw5:255 remappable buttons:
[DEBUG] CID  | reprog? | fn key? | mouse key? | gesture support?
[DEBUG] 0x50 |         |         | YES        | 
[DEBUG] 0x51 |         |         | YES        | 
[DEBUG] 0x52 | YES     |         | YES        | YES
[DEBUG] 0x53 | YES     |         | YES        | YES
[DEBUG] 0x56 | YES     |         | YES        | YES
[DEBUG] 0xc3 | YES     |         | YES        | YES
[DEBUG] 0xc4 | YES     |         | YES        | YES
[DEBUG] 0xd7 | YES     |         |            | YES
[DEBUG] 0x1a0 | YES     |         | YES        | YES
[DEBUG] Thumb wheel detected (0x2150), capabilities:
[DEBUG] timestamp | touch | proximity | single tap
[DEBUG] YES       | YES   | NO        | NO        
[DEBUG] Thumb wheel resolution: native (20), diverted (120)

And here's the output with these changes:

$ cd build/
$ cmake -DCMAKE_BUILD_TYPE=Release ..
$ make
$ sudo ./logid -v
[DEBUG] Unsupported device /dev/hidraw4 ignored
[DEBUG] Unsupported device /dev/hidraw1 ignored
[DEBUG] Unsupported device /dev/hidraw2 ignored
[DEBUG] Unsupported device /dev/hidraw3 ignored
[DEBUG] Unsupported device /dev/hidraw0 ignored
[INFO] Device found: MX Master 4 on /dev/hidraw5:255
[DEBUG] /dev/hidraw5:255 remappable buttons:
[DEBUG] CID   | reprog? | fn key? | mouse key? | gesture support?
[DEBUG] 0x050 |         |         | YES        | 
[DEBUG] 0x051 |         |         | YES        | 
[DEBUG] 0x052 | YES     |         | YES        | YES
[DEBUG] 0x053 | YES     |         | YES        | YES
[DEBUG] 0x056 | YES     |         | YES        | YES
[DEBUG] 0x0c3 | YES     |         | YES        | YES
[DEBUG] 0x0c4 | YES     |         | YES        | YES
[DEBUG] 0x0d7 | YES     |         |            | YES
[DEBUG] 0x1a0 | YES     |         | YES        | YES
[DEBUG] Thumb wheel detected (0x2150), capabilities:
[DEBUG] timestamp | touch | proximity | single tap
[DEBUG] YES       | YES   | NO        | NO        
[DEBUG] Thumb wheel resolution: native (20), diverted (120)

@waldyrious
Copy link
Author

waldyrious commented Jan 12, 2026

Btw, since GitHub's diff rendering is sometimes suboptimal, here's the diff using delta, which makes the changes more evident:

image

@waldyrious
Copy link
Author

Alternatively, we could make CIDs be always printed with 4 hex digits, as used in https://github.com/PixlOne/logiops/wiki/CIDs. Something like this:

$ sudo logid -v
[DEBUG] Unsupported device /dev/hidraw4 ignored
[DEBUG] Unsupported device /dev/hidraw1 ignored
[DEBUG] Unsupported device /dev/hidraw2 ignored
[DEBUG] Unsupported device /dev/hidraw3 ignored
[DEBUG] Unsupported device /dev/hidraw0 ignored
[INFO] Device found: MX Master 4 on /dev/hidraw5:255
[DEBUG] /dev/hidraw5:255 remappable buttons:
[DEBUG] CID    | reprog? | fn key? | mouse key? | gesture support?
[DEBUG] 0x0050 |         |         | YES        | 
[DEBUG] 0x0051 |         |         | YES        | 
[DEBUG] 0x0052 | YES     |         | YES        | YES
[DEBUG] 0x0053 | YES     |         | YES        | YES
[DEBUG] 0x0056 | YES     |         | YES        | YES
[DEBUG] 0x00c3 | YES     |         | YES        | YES
[DEBUG] 0x00c4 | YES     |         | YES        | YES
[DEBUG] 0x00d7 | YES     |         |            | YES
[DEBUG] 0x01a0 | YES     |         | YES        | YES
[DEBUG] Thumb wheel detected (0x2150), capabilities:
[DEBUG] timestamp | touch | proximity | single tap
[DEBUG] YES       | YES   | NO        | NO        
[DEBUG] Thumb wheel resolution: native (20), diverted (120)

That would make the code simpler, and the output more consistent with the existing reference info. Let me know if that would be preferred!

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.

1 participant