View | Details | Raw Unified | Return to bug 81774 | Differences between
and this patch

Collapse All | Expand All

(-)sys/dev/usb/usb_subr.c (-12 / +24 lines)
Lines 64-69 Link Here
64
#include <sys/bus.h>
64
#include <sys/bus.h>
65
#endif
65
#endif
66
#include <sys/proc.h>
66
#include <sys/proc.h>
67
#include <sys/sysctl.h>
67
68
68
#include <machine/bus.h>
69
#include <machine/bus.h>
69
70
Lines 747-752 Link Here
747
748
748
/* XXX add function for alternate settings */
749
/* XXX add function for alternate settings */
749
750
751
/*
752
** Clear any stall and make sure DATA0 toggle will be used next
753
*/
754
755
int	clearstall = 1;
756
SYSCTL_INT(_hw_usb, OID_AUTO, clearstall, CTLFLAG_RW,
757
   &clearstall, 1, "clear any stall and make sure data0 toggle will be used next -- breaks some devices");
758
TUNABLE_INT("hw.usb.clearstall", &clearstall);
759
750
usbd_status
760
usbd_status
751
usbd_setup_pipe(usbd_device_handle dev, usbd_interface_handle iface,
761
usbd_setup_pipe(usbd_device_handle dev, usbd_interface_handle iface,
752
		struct usbd_endpoint *ep, int ival, usbd_pipe_handle *pipe)
762
		struct usbd_endpoint *ep, int ival, usbd_pipe_handle *pipe)
Lines 778-795 Link Here
778
		free(p, M_USB);
788
		free(p, M_USB);
779
		return (err);
789
		return (err);
780
	}
790
	}
781
	/* Clear any stall and make sure DATA0 toggle will be used next. */
791
	if (clearstall) {
782
	if (UE_GET_ADDR(ep->edesc->bEndpointAddress) != USB_CONTROL_ENDPOINT) {
792
		/* Clear any stall and make sure DATA0 toggle will be used next. */
783
		err = usbd_clear_endpoint_stall(p);
793
		if (UE_GET_ADDR(ep->edesc->bEndpointAddress) != USB_CONTROL_ENDPOINT) {
784
		/*
794
			err = usbd_clear_endpoint_stall(p);
785
		 * Some devices reject this command, so ignore a STALL.
795
			/*
786
		 * Some device just time out on this command, so ignore
796
			 * Some devices reject this command, so ignore a STALL.
787
		 * that too.
797
			 * Some device just time out on this command, so ignore
788
		 */
798
			 * that too.
789
		if (err && err != USBD_STALLED && err != USBD_TIMEOUT) {
799
			 */
790
			printf("usbd_setup_pipe: failed to start "
800
			if (err && err != USBD_STALLED && err != USBD_TIMEOUT) {
791
			    "endpoint, %s\n", usbd_errstr(err));
801
				printf("usbd_setup_pipe: failed to start "
792
			return (err);
802
				    "endpoint, %s\n", usbd_errstr(err));
803
				return (err);
804
			}
793
		}
805
		}
794
	}
806
	}
795
	*pipe = p;
807
	*pipe = p;

Return to bug 81774