@@ -831,26 +831,32 @@ bool usbtmcd_control_xfer_cb(uint8_t rhport, uint8_t stage, tusb_control_request
831
831
832
832
bTag = request -> wValue & 0x7F ;
833
833
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)
835
835
TU_VERIFY (bTag >= 0x02 && bTag <= 127 );
836
836
TU_VERIFY (request -> wIndex == usbtmc_state .itf_id );
837
837
TU_VERIFY (request -> wLength == 0x0003 );
838
838
rsp .bTag = (uint8_t )bTag ;
839
839
if (usbtmc_state .ep_int_in != 0 )
840
840
{
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
845
847
{
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
+ }
854
860
}
855
861
else
856
862
{
0 commit comments