From owner-freebsd-usb@FreeBSD.ORG Sun Aug 17 17:24:56 2014 Return-Path: Delivered-To: freebsd-usb@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8295A46C for ; Sun, 17 Aug 2014 17:24:56 +0000 (UTC) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2001:1900:2254:206a::16:76]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4FECB20FA for ; Sun, 17 Aug 2014 17:24:56 +0000 (UTC) Received: from bugs.freebsd.org ([127.0.1.118]) by kenobi.freebsd.org (8.14.9/8.14.9) with ESMTP id s7HHOuMW084130 for ; Sun, 17 Aug 2014 17:24:56 GMT (envelope-from bugzilla-noreply@freebsd.org) From: bugzilla-noreply@freebsd.org To: freebsd-usb@FreeBSD.org Subject: [Bug 192755] New: snd_uaudio incorrect handling of version 1 audio format type descriptor Date: Sun, 17 Aug 2014 17:24:56 +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: 10.0-STABLE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: juanmasf2@ono.com X-Bugzilla-Status: Needs Triage X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: freebsd-usb@FreeBSD.org X-Bugzilla-Target-Milestone: --- 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 Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit 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.18-1 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Aug 2014 17:24:56 -0000 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=192755 Bug ID: 192755 Summary: snd_uaudio incorrect handling of version 1 audio format type descriptor Product: Base System Version: 10.0-STABLE Hardware: amd64 OS: Any Status: Needs Triage Severity: Affects Only Me Priority: --- Component: usb Assignee: freebsd-usb@FreeBSD.org Reporter: juanmasf2@ono.com For USB audio 1.0 formats the code in uaudio.c uses the value of bBitResolution from the descriptor directly to choose and internal audio format from the array uaudio10_formats. It should use the value from bSubFrameSize instead. It is clearly specified in the official USB document for audio data formats, page 9 under the section "2.2.2 Audio Subframe" that the endpoint must be handled using bSubFramSize*8 bits per sample from which the device will take the number of bits it actually uses. In my particular case I own a device reporting bBitResolution of 24 and bSubFrameSize of 4. An unpatched driver will be sending 3-byte subframes to the endpoint resulting in pure noise :) For USB 2.0 formats the code already does some conversion to avoid this same problem, using the equivalent bSubslotSize in the function uaudio_chan_fill_info_sub: /* Map 4-byte aligned 24-bit samples into 32-bit */ if (bBitResolution == 24 && bSubslotSize == 4) bBitResolution = 32; if (bBitResolution != (bSubslotSize * 8)) { DPRINTF("Invalid bSubslotSize\n"); goto next_ep; } -- You are receiving this mail because: You are the assignee for the bug.