abend0c1 / hidrdd

USB Human Interface Device (HID) Report Descriptor Decoder. This will convert a binary or printable hex report descriptor into a C header file. The printable hex can, for example, be an existing C header file - so it can be used to mechanically document an existing report descriptor declaration. The binary report descriptor could, for example, have been extracted from a Wireshark trace of a USB device handshake.
96 stars 15 forks source link

Contradicting data in rd.rex #1

Closed Elmue closed 6 years ago

Elmue commented 6 years ago

k.0UNIT.0000E121 = 'Energy in joules [0.1 μJ units],-7 J' k.0UNIT.0000E121 = 'Moment of force in newton metres [0.1 μN m units],-7 N m' k.0UNIT.0000E121 = 'Surface tension in newton per metre [1 g/s² units],-3 kg/s²' three times the same value for 3 different things ?

k.0UNIT.010000E1 = 'Luminance [1 cd/cm² units],4 cd/m²' is assigned twice

abend0c1 commented 6 years ago

Nice pick up...the Surface tension unit was incorrect - it should be 0000E101, and I accidentally duplicated Luminance.

As for the "Moment of force" and "Energy" units - they actually have the same underlying units - so I will keep Energy and discard the "Moment of force" as it is less intuitive. There are quite a few SI derived units that have the same underlying units - so when they are decoded there is no way to determine which one the original author intended, so I just decode one of them.

Elmue commented 6 years ago

I have never seen such a STUPID thing as the USB Unit system. It is the biggest design error. Why did they not use a simple enumeration for the Units? For example: 01 = meter 02 = inch 03 = miles 04 = radians 05 = angular velocity 06 = Pascal 07 = Newton 08 = Ampere 09 = Volt etc... This would fit into one byte as there are less than 255 uints. The nonsense with SI and english systems would not be necessary anymore. With an additional exponent they could have easily added milli, micro, kilo, Mega, Giga etc... It could be so simple. Instead of using the base units (meter) they use centimeter! What morons invented this? Instead of kilogram they use gram! The current stupid unit system does not allow to distingush between Hertz and Bequerel which both have the same unit. I have never seen such a stupid thing as the highly complicated unit for voltage (Volt = kg·m2/(s3·A)) which even measures in units of 0,1µV. And they even need 4 Bytes for that unit.