Skip to content

Commit fb27602

Browse files
committed
Fix USBTMC status byte interrupt buffer
Copy the READ_STATUS_BYTE interrupt payload into the class endpoint buffer before queuing the interrupt IN transfer. This keeps the buffer valid until the asynchronous transfer completes. Fixes hathach#2928 Generated-by: OpenAI Codex Signed-off-by: aineoae86-sys <ai.neo.ae86@gmail.com>
1 parent 41b8ad2 commit fb27602

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

‎src/class/usbtmc/usbtmc_device.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -822,8 +822,9 @@ bool usbtmcd_control_xfer_cb(uint8_t rhport, uint8_t stage, tusb_control_request
822822
.bTag = bTag & 0x7Fu,
823823
},
824824
.StatusByte = tud_usbtmc_get_stb_cb(&(rsp.USBTMC_status))};
825+
memcpy(usbtmc_epbuf.epnotif, &intMsg, sizeof(intMsg));
825826
// Must be queued before control request response sent (USB488v1.0 4.3.1.2)
826-
usbd_edpt_xfer(rhport, usbtmc_state.ep_int_in, (void *) &intMsg, sizeof(intMsg), false);
827+
usbd_edpt_xfer(rhport, usbtmc_state.ep_int_in, usbtmc_epbuf.epnotif, sizeof(intMsg), false);
827828
}
828829
} else {
829830
rsp.statusByte = tud_usbtmc_get_stb_cb(&(rsp.USBTMC_status));

0 commit comments

Comments
 (0)