winebus.sys: Always add padding after button blocks.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
593c4d5149
commit
8221229498
|
@ -422,13 +422,6 @@ static NTSTATUS build_mapped_report_descriptor(struct platform_private *ext)
|
|||
if (!hid_descriptor_add_buttons(&ext->desc, HID_USAGE_PAGE_BUTTON, 1, CONTROLLER_NUM_BUTTONS))
|
||||
return STATUS_NO_MEMORY;
|
||||
|
||||
if (BUTTON_BIT_COUNT % 8 != 0)
|
||||
{
|
||||
/* unused bits between hatswitch and following constant */
|
||||
if (!hid_descriptor_add_padding(&ext->desc, 8 - (BUTTON_BIT_COUNT % 8)))
|
||||
return STATUS_NO_MEMORY;
|
||||
}
|
||||
|
||||
if (!descriptor_add_haptic(ext))
|
||||
return STATUS_NO_MEMORY;
|
||||
|
||||
|
|
|
@ -521,13 +521,6 @@ static NTSTATUS build_report_descriptor(struct wine_input_private *ext, struct u
|
|||
if (!hid_descriptor_add_buttons(&ext->desc, HID_USAGE_PAGE_BUTTON, 1, button_count))
|
||||
return STATUS_NO_MEMORY;
|
||||
|
||||
if (button_count % 8)
|
||||
{
|
||||
BYTE padding = 8 - (button_count % 8);
|
||||
if (!hid_descriptor_add_padding(&ext->desc, padding))
|
||||
return STATUS_NO_MEMORY;
|
||||
}
|
||||
|
||||
report_size += (button_count + 7) / 8;
|
||||
}
|
||||
|
||||
|
|
|
@ -99,6 +99,7 @@ void hid_descriptor_free(struct hid_descriptor *desc)
|
|||
BOOL hid_descriptor_add_buttons(struct hid_descriptor *desc, USAGE usage_page,
|
||||
USAGE usage_min, USAGE usage_max)
|
||||
{
|
||||
const USHORT count = usage_max - usage_min + 1;
|
||||
const BYTE template[] =
|
||||
{
|
||||
USAGE_PAGE(2, usage_page),
|
||||
|
@ -108,24 +109,24 @@ BOOL hid_descriptor_add_buttons(struct hid_descriptor *desc, USAGE usage_page,
|
|||
LOGICAL_MAXIMUM(1, 1),
|
||||
PHYSICAL_MINIMUM(1, 0),
|
||||
PHYSICAL_MAXIMUM(1, 1),
|
||||
REPORT_COUNT(2, usage_max - usage_min + 1),
|
||||
REPORT_COUNT(2, count),
|
||||
REPORT_SIZE(1, 1),
|
||||
INPUT(1, Data|Var|Abs),
|
||||
};
|
||||
|
||||
return hid_descriptor_append(desc, template, sizeof(template));
|
||||
}
|
||||
|
||||
BOOL hid_descriptor_add_padding(struct hid_descriptor *desc, BYTE bitcount)
|
||||
const BYTE template_pad[] =
|
||||
{
|
||||
const BYTE template[] =
|
||||
{
|
||||
REPORT_COUNT(1, bitcount),
|
||||
REPORT_COUNT(1, 8 - (count % 8)),
|
||||
REPORT_SIZE(1, 1),
|
||||
INPUT(1, Cnst|Var|Abs),
|
||||
};
|
||||
|
||||
return hid_descriptor_append(desc, template, sizeof(template));
|
||||
if (!hid_descriptor_append(desc, template, sizeof(template)))
|
||||
return FALSE;
|
||||
|
||||
if ((count % 8) && !hid_descriptor_append(desc, template_pad, sizeof(template_pad)))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL hid_descriptor_add_hatswitch(struct hid_descriptor *desc, INT count)
|
||||
|
|
|
@ -82,7 +82,6 @@ extern void hid_descriptor_free(struct hid_descriptor *desc) DECLSPEC_HIDDEN;
|
|||
|
||||
extern BOOL hid_descriptor_add_buttons(struct hid_descriptor *desc, USAGE usage_page,
|
||||
USAGE usage_min, USAGE usage_max) DECLSPEC_HIDDEN;
|
||||
extern BOOL hid_descriptor_add_padding(struct hid_descriptor *desc, BYTE bitcount) DECLSPEC_HIDDEN;
|
||||
extern BOOL hid_descriptor_add_hatswitch(struct hid_descriptor *desc, INT count) DECLSPEC_HIDDEN;
|
||||
extern BOOL hid_descriptor_add_axes(struct hid_descriptor *desc, BYTE count, USAGE usage_page,
|
||||
const USAGE *usages, BOOL rel, LONG min, LONG max) DECLSPEC_HIDDEN;
|
||||
|
|
Loading…
Reference in New Issue