@@ -508,6 +508,9 @@ def handle_reset(self):
508
508
# reset by the host. This can happen when the USB device is unplugged,
509
509
# or if the host triggers a reset for some other reason.
510
510
#
511
+ # Override this function to cancel any pending operations specific to
512
+ # the interface (outstanding USB transfers are already cancelled).
513
+ #
511
514
# At this point, no USB functionality is available - handle_open() will
512
515
# be called later if/when the USB host re-enumerates and configures the
513
516
# interface.
@@ -601,3 +604,22 @@ def submit_xfer(self, ep_addr, data, done_cb=None):
601
604
if not self ._open :
602
605
raise RuntimeError ()
603
606
return get_usbdevice ()._submit_xfer (ep_addr , data , done_cb )
607
+
608
+ def set_ep_stall (self , ep_addr , stall ):
609
+ # Set or clear endpoint STALL state, according to the bool "stall" parameter.
610
+ #
611
+ # Generally endpoint STALL is handled automatically by TinyUSB, but
612
+ # there are some device classes that need to explicitly stall or unstall
613
+ # an endpoint under certain conditions.
614
+ if not self ._open or ep_addr not in get_usbdevice ()._eps :
615
+ raise RuntimeError ()
616
+ get_usbdevice ()._usbd .set_ep_stall (ep_addr , stall )
617
+
618
+ def get_ep_stall (self , ep_addr ):
619
+ # Get the current endpoint STALL state.
620
+ #
621
+ # Endpoint can be stalled/unstalled by host, TinyUSB stack, or calls to
622
+ # set_ep_stall().
623
+ if not self ._open or ep_addr not in get_usbdevice ()._eps :
624
+ raise RuntimeError ()
625
+ return get_usbdevice ()._usbd .get_ep_stall (ep_addr )
0 commit comments