usb/81774: 2nd generation iPod mini cannot be mounted over USB

Anders Nordby anders at FreeBSD.org
Sat Nov 26 15:30:17 GMT 2005


The following reply was made to PR usb/81774; it has been noted by GNATS.

From: Anders Nordby <anders at FreeBSD.org>
To: bug-followup at FreeBSD.org,
	From at totem.fix.no:Toomas Aas <toomas.aas at raad.tartu.ee>
Cc: "Le Capelain, Germain" <germain.lecapelain at scr.siemens.com>,
	Bryan Liesner <bryan at kishka.net>, iedowse at FreeBSD.org
Subject: Re: usb/81774: 2nd generation iPod mini cannot be mounted over USB
Date: Sat, 26 Nov 2005 16:23:58 +0100

 --EeQfGwPcQSOJBaQU
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
 
 Hi,
 
 The patch works fine for me. With it, my iPod Mini appears reliably and
 instantly as a SCSI device. I attach a patch here that makes this a
 sysctl tunable, hw.usb.clearstall (default=1, set it to 0 to disable).
 
 I've been discussing this with Ian Dowse <iedowse at FreeBSD.org>, and he
 seems to think that the code that we are disabling should be disabled
 by default because a number of devices had problems with it. Instead,
 there should be a quirk to make the devices that need it get it.
 
 Running usbdevs -v, I get this information about my iPod:
 
 port 2 addr 2: high speed, power 500 mA, config 1, iPod mini(0x1205),
 Apple(0x05ac), rev 0.01
 
 Cheers,
 
 -- 
 Anders.
 
 --EeQfGwPcQSOJBaQU
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: attachment; filename="usb_subr.c.diff"
 
 --- sys/dev/usb/usb_subr.c.orig	Sat Nov 26 13:59:14 2005
 +++ sys/dev/usb/usb_subr.c	Sat Nov 26 15:26:33 2005
 @@ -64,6 +64,7 @@
  #include <sys/bus.h>
  #endif
  #include <sys/proc.h>
 +#include <sys/sysctl.h>
  
  #include <machine/bus.h>
  
 @@ -747,6 +748,15 @@
  
  /* XXX add function for alternate settings */
  
 +/*
 +** Clear any stall and make sure DATA0 toggle will be used next
 +*/
 +
 +int	clearstall = 1;
 +SYSCTL_INT(_hw_usb, OID_AUTO, clearstall, CTLFLAG_RW,
 +   &clearstall, 1, "clear any stall and make sure data0 toggle will be used next -- breaks some devices");
 +TUNABLE_INT("hw.usb.clearstall", &clearstall);
 +
  usbd_status
  usbd_setup_pipe(usbd_device_handle dev, usbd_interface_handle iface,
  		struct usbd_endpoint *ep, int ival, usbd_pipe_handle *pipe)
 @@ -778,18 +788,20 @@
  		free(p, M_USB);
  		return (err);
  	}
 -	/* Clear any stall and make sure DATA0 toggle will be used next. */
 -	if (UE_GET_ADDR(ep->edesc->bEndpointAddress) != USB_CONTROL_ENDPOINT) {
 -		err = usbd_clear_endpoint_stall(p);
 -		/*
 -		 * Some devices reject this command, so ignore a STALL.
 -		 * Some device just time out on this command, so ignore
 -		 * that too.
 -		 */
 -		if (err && err != USBD_STALLED && err != USBD_TIMEOUT) {
 -			printf("usbd_setup_pipe: failed to start "
 -			    "endpoint, %s\n", usbd_errstr(err));
 -			return (err);
 +	if (clearstall) {
 +		/* Clear any stall and make sure DATA0 toggle will be used next. */
 +		if (UE_GET_ADDR(ep->edesc->bEndpointAddress) != USB_CONTROL_ENDPOINT) {
 +			err = usbd_clear_endpoint_stall(p);
 +			/*
 +			 * Some devices reject this command, so ignore a STALL.
 +			 * Some device just time out on this command, so ignore
 +			 * that too.
 +			 */
 +			if (err && err != USBD_STALLED && err != USBD_TIMEOUT) {
 +				printf("usbd_setup_pipe: failed to start "
 +				    "endpoint, %s\n", usbd_errstr(err));
 +				return (err);
 +			}
  		}
  	}
  	*pipe = p;
 
 --EeQfGwPcQSOJBaQU--


More information about the freebsd-usb mailing list