From a7e36ed8af7229f80c4669105ec507aec5e9c192 Mon Sep 17 00:00:00 2001 From: sakumisu <1203593632@qq.com> Date: Wed, 11 Mar 2026 21:25:51 +0800 Subject: fix(class/gamepad): fix input size Signed-off-by: sakumisu <1203593632@qq.com> --- class/gamepad/usbd_gamepad.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/class/gamepad/usbd_gamepad.c b/class/gamepad/usbd_gamepad.c index 8ffbfda8..37eb040c 100644 --- a/class/gamepad/usbd_gamepad.c +++ b/class/gamepad/usbd_gamepad.c @@ -13,11 +13,11 @@ static int xinput_vendor_class_request_handler(uint8_t busid, struct usb_setup_p { struct xinput_in_report xinput_report; - memset(&xinput_report, 0, sizeof(xinput_report)); + memset(&xinput_report, 0, sizeof(struct xinput_in_report)); xinput_report.report_size = 20; - memcpy(*data, &xinput_report, sizeof(xinput_report)); - *len = sizeof(xinput_report); + memcpy(*data, &xinput_report, sizeof(struct xinput_in_report)); + *len = sizeof(struct xinput_in_report); return 0; } @@ -26,7 +26,7 @@ int usbd_gamepad_xinput_send_report(uint8_t ep, struct usb_gamepad_report *repor struct xinput_in_report *xinput_report; xinput_report = (struct xinput_in_report *)gamepad_report_buffer; - memset(xinput_report, 0, sizeof(xinput_report)); + memset(xinput_report, 0, sizeof(struct xinput_in_report)); xinput_report->report_size = 20; if (report->buttons & USB_GAMEPAD_BUTTON_DU) @@ -105,7 +105,7 @@ int usbd_gamepad_switch_send_report(uint8_t ep, struct usb_gamepad_report *repor struct switch_in_report *switch_report; switch_report = (struct switch_in_report *)gamepad_report_buffer; - memset(switch_report, 0, sizeof(switch_report)); + memset(switch_report, 0, sizeof(struct switch_in_report)); if (report->buttons & USB_GAMEPAD_BUTTON_S1) switch_report->buttons |= SWITCH_MASK_MINUS; -- cgit v1.3.1