Closed reinderien closed 10 months ago
HID doesn't have the idea of 'fixed constants' (e.g. C++ const
). 'Constant' in HID means that the value can't be modified by the Host (so, only interesting when applied to Feature Reports), not that the value can't change over subsequent reports sent from Device->Host
From the HID spec
"Indicates whether the item is data or a constant value. Data indicates the item is defining report fields that contain modifiable device data. Constant indicates the item is a static read-only field in a report and cannot be modified (written) by the host."
To be able to "tell the truth" better in the descriptor, and also to potentially increase performance, it would be very valuable to be able to set constants in the report.
Currently, the only time I see
Kind.Constant
being used is for padding. We should be able to assignConstant
to selected fields such as fixed device attribute/feature reports, and in the TOML provide the fixed value to be assigned to thestruct
field in C++ generation.The closest I can current get to communicating this intent in a
variableItem
is to set alogicalValueRange
with the lower and upper bound equal, but this still producesVariable
.Interestingly, if I setCaused by contiguous attribute optimization; bit size is still correctly 1LogicalMinimum(0), LogicalMaximum(0)
then Waratah completely omits aReportSize
- seemingly assumingsizeInBits = 0
, even though if I write the latter explicitly it's rejected.