diff options
| author | hathach <[email protected]> | 2024-11-22 20:21:12 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2024-11-22 20:21:12 +0700 |
| commit | 07d47ba4876dbb07ba9fd9ee19eca11a7ccd467d (patch) | |
| tree | 1a173d6feda70d13ed88ca8fcea42f57f19abde9 /src/class/net | |
| parent | 5c18a32aaa5f1b71af584c04197573261ecc64c3 (diff) | |
fix ncm incorrect length for notify connection
Diffstat (limited to 'src/class/net')
| -rw-r--r-- | src/class/net/ncm_device.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/class/net/ncm_device.c b/src/class/net/ncm_device.c index aeb2c3cf1..c97c66a4e 100644 --- a/src/class/net/ncm_device.c +++ b/src/class/net/ncm_device.c @@ -202,8 +202,9 @@ static void notification_xmit(uint8_t rhport, bool force_next) { notify_speed_change.uplink = 12000000; } + uint16_t notif_len = sizeof(notify_speed_change.header) + notify_speed_change.header.wLength; ncm_epbuf.epnotif = notify_speed_change; - usbd_edpt_xfer(rhport, ncm_interface.ep_notif, (uint8_t*) &ncm_epbuf.epnotif, sizeof(ncm_notify_t)); + usbd_edpt_xfer(rhport, ncm_interface.ep_notif, (uint8_t*) &ncm_epbuf.epnotif, notif_len); ncm_interface.notification_xmit_state = NOTIFICATION_CONNECTED; ncm_interface.notification_xmit_is_running = true; @@ -223,8 +224,9 @@ static void notification_xmit(uint8_t rhport, bool force_next) { }, }; + uint16_t notif_len = sizeof(notify_connected.header) + notify_connected.header.wLength; ncm_epbuf.epnotif = notify_connected; - usbd_edpt_xfer(rhport, ncm_interface.ep_notif, (uint8_t *) &ncm_epbuf.epnotif, sizeof(ncm_notify_t)); + usbd_edpt_xfer(rhport, ncm_interface.ep_notif, (uint8_t *) &ncm_epbuf.epnotif, notif_len); ncm_interface.notification_xmit_state = NOTIFICATION_DONE; ncm_interface.notification_xmit_is_running = true; |
