Re: [PATCH 2/2] HID: redragon Add additional verification to rdesc modification quirk

From: Robert Munteanu
Date: Fri Aug 03 2018 - 09:22:03 EST


On Sat, 2018-07-28 at 15:53 -0400, John S Gruber wrote:
> There are many devices using the vendor_id 0c45 and device_id of 760b
> combination. Also the two bytes 0x81 0x00 aren't rare for a report
> description. For these reasons the report description being altered
> by the quirk should be verified more completely
>
> If I'm understanding this correctly, I believe for an array field the
> report_size should be greater or equal to
> ceil(log2(usage_maximum - usage_minimum + 1)). That's 3 bits for
> these 8
> shift keys, 0xe0-0xe7. Therefore the incorrect report description
> can't
> be valid for any device.
>
> Check the actual count of the rdesc and compare the entire field
> description to reduce the chance of patching the wrong thing by
> inadvertence.
>
> Signed-off-by: John S Gruber <JohnSGruber@xxxxxxxxx>

I tested this on 4.17.11 with 85455dd906d5 and cbe7e3ad0eab from Jiri's
for-4.19/upstream tree and it works just fine.

Feel free to add

Acked-By: Robert Munteanu <rombert@xxxxxxxxxx>

Thanks for looking into this.

Robert