From owner-freebsd-usb@FreeBSD.ORG Sat Nov 26 15:30:17 2005 Return-Path: X-Original-To: freebsd-usb@hub.freebsd.org Delivered-To: freebsd-usb@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4937F16A41F for ; Sat, 26 Nov 2005 15:30:17 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1959C43D79 for ; Sat, 26 Nov 2005 15:30:12 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.3/8.13.3) with ESMTP id jAQFU8Le094384 for ; Sat, 26 Nov 2005 15:30:08 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.3/8.13.1/Submit) id jAQFU8oo094383; Sat, 26 Nov 2005 15:30:08 GMT (envelope-from gnats) Date: Sat, 26 Nov 2005 15:30:08 GMT Message-Id: <200511261530.jAQFU8oo094383@freefall.freebsd.org> To: freebsd-usb@FreeBSD.org From: Anders Nordby Cc: Subject: Re: usb/81774: 2nd generation iPod mini cannot be mounted over USB X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Anders Nordby List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Nov 2005 15:30:17 -0000 The following reply was made to PR usb/81774; it has been noted by GNATS. From: Anders Nordby To: bug-followup@FreeBSD.org, From@totem.fix.no:Toomas Aas Cc: "Le Capelain, Germain" , Bryan Liesner , iedowse@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 , 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 #endif #include +#include #include @@ -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--