diff options
| author | sakumisu <[email protected]> | 2026-03-11 21:25:51 +0800 |
|---|---|---|
| committer | sakumisu <[email protected]> | 2026-03-11 21:26:18 +0800 |
| commit | a7e36ed8af7229f80c4669105ec507aec5e9c192 (patch) | |
| tree | 65695e2fd8f125cd2316f16a2095f95e6c7b592b | |
| parent | f9fe00d6023aaba3228ee0ad272d3e3f6d9b3b34 (diff) | |
fix(class/gamepad): fix input size
Signed-off-by: sakumisu <[email protected]>
| -rw-r--r-- | class/gamepad/usbd_gamepad.c | 10 |
1 files 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; |
