nipo / hrdc

HID Report Descriptor Compiler
MIT License
19 stars 5 forks source link

Fix missing LogicalMin/LogicalMax #4

Closed dnaq closed 2 years ago

dnaq commented 2 years ago

The global merge optimization pass initialized LogicalMin/LogicaMax to zero, and thus if the actual value was zero it would be removed from the output hid descriptor. Here we instead initialize it to None causing it to be emitted on first use and then no longer emitted.

This is in accordance with the HID specification that specifies that a LogicalMin/LogicalMax value is mandatory in the descriptor.

dnaq commented 2 years ago

I found this after having used your compiler to generate hid descriptors for a project of mine. I'm not that familiar with your codebase, but it seems like this fix is working.

nipo commented 2 years ago

It seems to make sense, indeed. Nice catch.