From owner-freebsd-usb@freebsd.org Mon Dec 24 23:16:21 2018 Return-Path: Delivered-To: freebsd-usb@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 07EE61351F84 for ; Mon, 24 Dec 2018 23:16:21 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mailman.ysv.freebsd.org (mailman.ysv.freebsd.org [IPv6:2001:1900:2254:206a::50:5]) by mx1.freebsd.org (Postfix) with ESMTP id 96E2670279 for ; Mon, 24 Dec 2018 23:16:20 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: by mailman.ysv.freebsd.org (Postfix) id 56F831351F83; Mon, 24 Dec 2018 23:16:20 +0000 (UTC) Delivered-To: usb@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 345021351F82 for ; Mon, 24 Dec 2018 23:16:20 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.ysv.freebsd.org (mxrelay.ysv.freebsd.org [IPv6:2001:1900:2254:206a::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.ysv.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AA30670278 for ; Mon, 24 Dec 2018 23:16:19 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2001:1900:2254:206a::16:76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.ysv.freebsd.org (Postfix) with ESMTPS id C29E21867 for ; Mon, 24 Dec 2018 23:16:18 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.118]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id wBONGIeU005266 for ; Mon, 24 Dec 2018 23:16:18 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id wBONGIxg005264 for usb@FreeBSD.org; Mon, 24 Dec 2018 23:16:18 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: usb@FreeBSD.org Subject: [Bug 234380] [snd_uaudio] Sample rate detection fails for SPL Crimson Rev 1 Date: Mon, 24 Dec 2018 23:16:18 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: usb X-Bugzilla-Version: 12.0-RELEASE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: dev@submerge.ch X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: usb@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Dec 2018 23:16:21 -0000 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D234380 Bug ID: 234380 Summary: [snd_uaudio] Sample rate detection fails for SPL Crimson Rev 1 Product: Base System Version: 12.0-RELEASE Hardware: amd64 OS: Any Status: New Severity: Affects Only Me Priority: --- Component: usb Assignee: usb@FreeBSD.org Reporter: dev@submerge.ch Created attachment 200478 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D200478&action= =3Dedit Implement sample rate table requests in two steps. The SPL Crimson Revision 1 is a (mostly) class compliant USB 2.0 audio interface for musicians. Due to a firmware bug the device will not return a sample rate table on request when using the current implementation in the snd_uaudio module. How to reproduce: 1. Set a quirk for the device to use the second USB configuration, which provides the full USB 2.0 audio interface: usbconfig add_dev_quirk_vplh 0x0a4a 0xc150 0x0000 0xffff UQ_CFG_INDEX_1 2. Plug the SPL Crimson into a USB 2.0 port. Results: The snd_uaudio module takes very long to attach to the device (some minutes= ). No playback or recording channels are found since the sample rates are miss= ing. Expected: Creation of a 6 in 6 out pcm device for up to 96kHz sample rate within seco= nds. Hard- and Software: SPL Crimson Revision 1 at firmware 1.0.9, the newest available on their website. FreeBSD 11.2-RELEASE and 12.0-RELEASE for amd64. Analysis: For USB 2.0 audio devices, snd_uaudio sends a request to get a table of the supported sample rates, possibly multiple times. Since the length of this table is not known, it requests 255 bytes of sample rate table regardless of its actual length. Due to the firmware bug the SPL Crimson only answers requests for up to about 100 bytes length. The unanswered requests for 255 bytes will result in USB timeouts and missing sample rates. When plugged into macOS (High Sierra), the device works as expected and the sample rates are detected correctly. This is because macOS requests only one row of sample rates at first. The table header indicates the actual length, which is then used for a second request. Both approaches should be valid according to the USB 2.0 audio specs. Proposed solution: The patch provided implements exactly the behavior of macOS. It sends one short request first for the header and one table row (2 + 1 * 12 bytes). If answered, a second request is sent using the actual length derived from the header (2 + n * 12 bytes). What is not implemented yet is a wrap-up into an optional USB quirk. But it may also prove beneficial to adopt the macOS behavior in general, many class compliant devices are explicitly tested against Apple software. --=20 You are receiving this mail because: You are the assignee for the bug.=