From owner-freebsd-usb@FreeBSD.ORG Sun Oct 28 11:10:01 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 B59BB16A421 for ; Sun, 28 Oct 2007 11:10:01 +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 91CAC13C4A5 for ; Sun, 28 Oct 2007 11:10:01 +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 l9SBA1g6085990 for ; Sun, 28 Oct 2007 11:10:01 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.1/8.14.1/Submit) id l9SBA1p1085989; Sun, 28 Oct 2007 11:10:01 GMT (envelope-from gnats) Resent-Date: Sun, 28 Oct 2007 11:10:01 GMT Resent-Message-Id: <200710281110.l9SBA1p1085989@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-usb@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Henrik Gulbrandsen Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9AAA916A46D for ; Sun, 28 Oct 2007 11:00:28 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21]) by mx1.freebsd.org (Postfix) with ESMTP id 8A9BB13C4A3 for ; Sun, 28 Oct 2007 11:00:28 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.14.1/8.14.1) with ESMTP id l9SAxrnt023979 for ; Sun, 28 Oct 2007 10:59:53 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.14.1/8.14.1/Submit) id l9SAxrIp023978; Sun, 28 Oct 2007 10:59:53 GMT (envelope-from nobody) Message-Id: <200710281059.l9SAxrIp023978@www.freebsd.org> Date: Sun, 28 Oct 2007 10:59:53 GMT From: Henrik Gulbrandsen To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: 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 List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 28 Oct 2007 11:10:01 -0000 >Number: 117598 >Category: usb >Synopsis: [patch] Not possible to record with Plantronics DSP-400 USB headset >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-usb >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sun Oct 28 11:10:01 UTC 2007 >Closed-Date: >Last-Modified: >Originator: Henrik Gulbrandsen >Release: FreeBSD 7.0-BETA1.5 i386 >Organization: >Environment: FreeBSD Test 7.0-BETA1.5 FreeBSD 7.0-BETA1.5 #2 Sat Oct 27 12:53:33 CEST 2007 tester@Test:/usr/src/sys/i386/compile/GENERIC i386 (uname -a after patching) >Description: The Plantronics DSP-400 USB headset works fine for playback, but recording fails. A look at /dev/sndstat indicated that there were no recording channels available, and the relevant lines from /var/log/messages are as follows: Oct 25 17:37:43 root: Unknown USB device: vendor 0x047f product 0x0ca1 bus uhub2 Oct 25 17:37:43 kernel: uaudio0: on uhub2 Oct 25 17:37:43 kernel: uaudio0: ignored input endpoint of type adaptive Oct 25 17:37:43 last message repeated 2 times Oct 25 17:37:43 kernel: uaudio0: audio rev 1.00 Oct 25 17:37:43 kernel: pcm0: on uaudio0 Apparently, the headset reports using an adaptive audio source endpoint for data from the microphone. According to the USB specs, such endpoints need an explicit synch pipe to specify the wanted sample rate [See USB Spec rev 2.0, sec. 5.12.4.2 "Feedback" and the USB Device Class Definition for Audio Devices, sec. 3.7.2.2 "Isochronous Synch Endpoint"]. Unfortunately, FreeBSD currently doesn't support these synch endpoints. Fortunately, neither does the DSP-400 :-) The rest of the story follows in the fix description... >How-To-Repeat: Plug in your Plantronics DSP-400 headset and make sure that the snd_uaudio kernel module is loaded. Verify that playback works and recording fails. >Fix: Recompiling sys/dev/sound/usb/uaudio.c with defined UAUDIO_MULTIPLE_ENDPOINTS revealed that that the required synch endpoint didn't exist. There is already a USB quirk flag UQ_AU_INP_ASYNC, which specifies that a claimed adaptive input is in fact not adaptive at all, but better handled as asynchronous. After setting the flag for the DSP-400 headset, recording seems to work without obvious flaws. I'm attaching a patch that adds this to the set of known quirks. Since this has happened at least twice, I'm also adding some optional code that assumes that all cases with a mysteriously missing sync endpoint should be handled similarly. This may help to save some debugging time for other problem devices out there... Patch attached with submission follows: --- 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 >Release-Note: >Audit-Trail: >Unformatted: