@@ -831,26 +831,32 @@ bool usbtmcd_control_xfer_cb(uint8_t rhport, uint8_t stage, tusb_control_request
831831
832832 bTag = request -> wValue & 0x7F ;
833833 TU_VERIFY (request -> bmRequestType == 0xA1 );
834- TU_VERIFY ((request -> wValue & (~0x7F )) == 0u ); // Other bits are required to be zero
834+ TU_VERIFY ((request -> wValue & (~0x7F )) == 0u ); // Other bits are required to be zero (USB488v1.0 Table 11)
835835 TU_VERIFY (bTag >= 0x02 && bTag <= 127 );
836836 TU_VERIFY (request -> wIndex == usbtmc_state .itf_id );
837837 TU_VERIFY (request -> wLength == 0x0003 );
838838 rsp .bTag = (uint8_t )bTag ;
839839 if (usbtmc_state .ep_int_in != 0 )
840840 {
841- rsp .USBTMC_status = USBTMC_STATUS_SUCCESS ;
842- rsp .statusByte = 0x00 ; // Use interrupt endpoint, instead.
843-
844- usbtmc_read_stb_interrupt_488_t intMsg =
841+ rsp .statusByte = 0x00 ; // Use interrupt endpoint, instead. Must be 0x00 (USB488v1.0 4.3.1.2)
842+ if (usbd_edpt_busy (rhport , usbtmc_state .ep_int_in ))
843+ {
844+ rsp .USBTMC_status = USB488_STATUS_INTERRUPT_IN_BUSY ;
845+ }
846+ else
845847 {
846- .bNotify1 = {
847- .one = 1 ,
848- .bTag = bTag & 0x7Fu ,
849- },
850- .StatusByte = tud_usbtmc_get_stb_cb (& (rsp .USBTMC_status ))
851- };
852- // USB488 spec states that transfer must be queued before control request response sent.
853- usbd_edpt_xfer (rhport , usbtmc_state .ep_int_in , (void * )& intMsg , sizeof (intMsg ));
848+ rsp .USBTMC_status = USBTMC_STATUS_SUCCESS ;
849+ usbtmc_read_stb_interrupt_488_t intMsg =
850+ {
851+ .bNotify1 = {
852+ .one = 1 ,
853+ .bTag = bTag & 0x7Fu ,
854+ },
855+ .StatusByte = tud_usbtmc_get_stb_cb (& (rsp .USBTMC_status ))
856+ };
857+ // Must be queued before control request response sent (USB488v1.0 4.3.1.2)
858+ usbd_edpt_xfer (rhport , usbtmc_state .ep_int_in , (void * )& intMsg , sizeof (intMsg ));
859+ }
854860 }
855861 else
856862 {
0 commit comments