Skip to content

Commit ce24010

Browse files
spbnickJiri Kosina
authored andcommitted
HID: uclogic: Specify total report size to buttonpad macro
Simplify the UCLOGIC_RDESC_BUTTONPAD_BYTES macro by passing as param the size of the report to pad to in bytes. Signed-off-by: Nikolai Kondrashov <spbnick@gmail.com> Signed-off-by: José Expósito <jose.exposito89@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
1 parent e6be956 commit ce24010

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

drivers/hid/hid-uclogic-rdesc.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -654,10 +654,9 @@ const size_t uclogic_rdesc_pen_v2_template_size =
654654
/*
655655
* Expand to the contents of a generic buttonpad report descriptor.
656656
*
657-
* @_padding: Padding from the end of button bits at bit 44, until
658-
* the end of the report, in bits.
657+
* @_size: Size of the report to pad to, including report ID, bytes.
659658
*/
660-
#define UCLOGIC_RDESC_BUTTONPAD_BYTES(_padding) \
659+
#define UCLOGIC_RDESC_BUTTONPAD_BYTES(_size) \
661660
0x05, 0x01, /* Usage Page (Desktop), */ \
662661
0x09, 0x07, /* Usage (Keypad), */ \
663662
0xA1, 0x01, /* Collection (Application), */ \
@@ -692,21 +691,22 @@ const size_t uclogic_rdesc_pen_v2_template_size =
692691
0x29, 0x03, /* Usage Maximum (03h), */ \
693692
0x95, 0x03, /* Report Count (3), */ \
694693
0x81, 0x02, /* Input (Variable), */ \
695-
0x95, _padding, /* Report Count (_padding), */ \
694+
0x95, ((_size) * 8 - 45), \
695+
/* Report Count (padding), */ \
696696
0x81, 0x01, /* Input (Constant), */ \
697697
0xC0, /* End Collection, */ \
698698
0xC0 /* End Collection */
699699

700700
/* Fixed report descriptor for (tweaked) v1 buttonpad reports */
701701
const __u8 uclogic_rdesc_buttonpad_v1_arr[] = {
702-
UCLOGIC_RDESC_BUTTONPAD_BYTES(19)
702+
UCLOGIC_RDESC_BUTTONPAD_BYTES(8)
703703
};
704704
const size_t uclogic_rdesc_buttonpad_v1_size =
705705
sizeof(uclogic_rdesc_buttonpad_v1_arr);
706706

707707
/* Fixed report descriptor for (tweaked) v2 buttonpad reports */
708708
const __u8 uclogic_rdesc_buttonpad_v2_arr[] = {
709-
UCLOGIC_RDESC_BUTTONPAD_BYTES(51)
709+
UCLOGIC_RDESC_BUTTONPAD_BYTES(12)
710710
};
711711
const size_t uclogic_rdesc_buttonpad_v2_size =
712712
sizeof(uclogic_rdesc_buttonpad_v2_arr);

0 commit comments

Comments
 (0)