From owner-freebsd-usb@FreeBSD.ORG Sun Oct 28 15:50:05 2007 Return-Path: Delivered-To: freebsd-usb@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 116F816A41B for ; Sun, 28 Oct 2007 15:50:05 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id F413F13C48A for ; Sun, 28 Oct 2007 15:50:04 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.1/8.14.1) with ESMTP id l9SFo4PH004321 for ; Sun, 28 Oct 2007 15:50:04 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.1/8.14.1/Submit) id l9SFo499004320; Sun, 28 Oct 2007 15:50:04 GMT (envelope-from gnats) Date: Sun, 28 Oct 2007 15:50:04 GMT Message-Id: <200710281550.l9SFo499004320@freefall.freebsd.org> To: freebsd-usb@FreeBSD.org From: Henrik Gulbrandsen Cc: Subject: Re: usb/117598: [patch] Not possible to record with Plantronics DSP-400 USB headset X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Henrik Gulbrandsen List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 28 Oct 2007 15:50:05 -0000 The following reply was made to PR usb/117598; it has been noted by GNATS. From: Henrik Gulbrandsen To: "M. Warner Losh" Cc: hselasky@c2i.net, freebsd-gnats-submit@FreeBSD.org Subject: Re: usb/117598: [patch] Not possible to record with Plantronics DSP-400 USB headset Date: Sun, 28 Oct 2007 16:45:46 +0100 --=-58217vnrXX1U7ux/YEJl Content-Type: text/plain Content-Transfer-Encoding: 7bit On Sun, 2007-10-28 at 07:50 -0600, M. Warner Losh wrote: > If the patch is reliable (eg, we get no false positives from the > printf), then we should eliminate the quirk. True, but this would require at least a small leap of faith, since I haven't analyzed the consequences in detail. All I know is that we are currently handling this as an error situation and return USBD_INVAL. Assuming an asynchronous endpoint and continuing will work around the problem if this is indeed what the device expects, but it may lead to other bugs if the core problem is something else. My qualified guess is that this will probably help more often than it hurts, so I enabled UAUDIO_ASSUME_ASYNC by default. If we check this in and nobody complains in the near future, then it's probably safe to do as you say and eliminate the quirk (and the printf) in a later version. /Henrik P.S. The patch is virtually unreadable in the web version, so I'm attaching it again, hoping to get better formatting this time. --=-58217vnrXX1U7ux/YEJl Content-Disposition: attachment; filename=dsp-400.diff Content-Type: text/x-patch; name=dsp-400.diff; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit --- dev/sound/usb/uaudio.c.orig 2007-06-20 07:11:37.000000000 +0200 +++ dev/sound/usb/uaudio.c 2007-10-27 21:50:10.000000000 +0200 @@ -116,7 +116,11 @@ #else /* #define USB_DEBUG */ #endif + +/* A few knobs to enable/disable features... */ /* #define UAUDIO_MULTIPLE_ENDPOINTS */ +#define UAUDIO_ASSUME_ASYNC + #ifdef USB_DEBUG #define DPRINTF(x) do { if (uaudiodebug) printf x; } while (0) #define DPRINTFN(n,x) do { if (uaudiodebug>(n)) printf x; } while (0) @@ -2018,6 +2022,12 @@ dir == UE_DIR_IN && type == UE_ISO_ADAPT) type = UE_ISO_ASYNC; +#ifdef UAUDIO_ASSUME_ASYNC + /* Dammit! The spec doesn't allow this, so why not assume a quirk? */ + if (dir == UE_DIR_IN && type == UE_ISO_ADAPT && id->bNumEndpoints == 1) + type = UE_ISO_ASYNC; +#endif + /* We can't handle endpoints that need a sync pipe yet. */ sync = FALSE; if (dir == UE_DIR_IN && type == UE_ISO_ADAPT) { @@ -2050,9 +2060,18 @@ if (sync && id->bNumEndpoints <= 1) { printf("%s: a sync-pipe endpoint but no other endpoint\n", device_get_nameunit(sc->sc_dev)); +#ifndef UAUDIO_ASSUME_ASYNC + if (dir != UE_DIR_IN) + return USBD_INVAL; + printf("This device may need a UQ_AU_INP_ASYNC quirk flag.\n"); + printf("Consider adding it in sys/dev/usb/usb_quirks.c !!!\n"); + printf("vendor: 0x%04x; product: 0x%04x; release: 0x%04x\n", + sc->sc_vendor, sc->sc_product, sc->sc_release); +#endif /* UAUDIO_ASSUME_ASYNC */ return USBD_INVAL; } -#endif +#endif /* UAUDIO_MULTIPLE_ENDPOINTS */ + if (!sync && id->bNumEndpoints > 1) { printf("%s: non sync-pipe endpoint but multiple endpoints\n", device_get_nameunit(sc->sc_dev)); --- dev/usb/usb_quirks.c.orig 2007-07-22 17:59:45.000000000 +0200 +++ dev/usb/usb_quirks.c 2007-10-27 12:53:02.000000000 +0200 @@ -74,6 +74,8 @@ { USB_VENDOR_TELEX, USB_PRODUCT_TELEX_MIC1, 0x009, { UQ_AU_NO_FRAC }}, { USB_VENDOR_SILICONPORTALS, USB_PRODUCT_SILICONPORTALS_YAPPHONE, 0x100, { UQ_AU_INP_ASYNC }}, + { USB_VENDOR_PLANTRONICS, USB_PRODUCT_PLANTRONICS_DSP400, + 0x004, { UQ_AU_INP_ASYNC }}, { USB_VENDOR_LOGITECH, USB_PRODUCT_LOGITECH_UN53B, ANY, { UQ_NO_STRINGS }}, /* XXX These should have a revision number, but I don't know what they are. */ { USB_VENDOR_HP, USB_PRODUCT_HP_895C, ANY, { UQ_BROKEN_BIDIR }}, --- dev/usb/usbdevs.orig 2007-10-05 09:26:39.000000000 +0200 +++ dev/usb/usbdevs 2007-10-27 12:53:06.000000000 +0200 @@ -1851,6 +1851,9 @@ product PLANEX3 GU1000T 0xab11 GU-1000T product PLANEX3 GWUS54MINI 0xab13 GW-US54Mini +/* Plantronics products */ +product PLANTRONICS DSP400 0x0ca1 DSP-400 Foldable PC Headset + /* Plextor Corp. */ product PLEXTOR 40_12_40U 0x0011 PlexWriter 40/12/40U --=-58217vnrXX1U7ux/YEJl--