From owner-freebsd-usb@FreeBSD.ORG Wed Apr 24 01:20:35 2013 Return-Path: Delivered-To: freebsd-usb@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 2D32D412 for ; Wed, 24 Apr 2013 01:20:35 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-ob0-x229.google.com (mail-ob0-x229.google.com [IPv6:2607:f8b0:4003:c01::229]) by mx1.freebsd.org (Postfix) with ESMTP id 00D1B1804 for ; Wed, 24 Apr 2013 01:20:34 +0000 (UTC) Received: by mail-ob0-f169.google.com with SMTP id tb18so1039780obb.28 for ; Tue, 23 Apr 2013 18:20:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:sender:date:x-google-sender-auth:message-id :subject:from:to:content-type; bh=bDF5d7gVrw/W6/+jJtq/qtghkHsWJGQSpuyYGWn9GAA=; b=jlnyNLpe+1hGe+FF8Qe29q6HBSQa/sCkDiD+U+Dq29DWk55w0xN/SDG7bUWM/06+jW cdRfsmYPviOgUKdDuHISnGE7qrIMN1tJWdSAOZk6zslBsr4xpCZNDwMnV+Se5LlnXY/v g/iZEFKH6rouG5IlpJmCGrCSUTQRR8azyW3Irw64dTkuwitAeJtc1HbUK7glsW2pfS9D /LIA1qSG/eejmfw7A3NlBHtUvaz23spyRV3RRobjJNGCU+EXmQds4POZzOkBhIPKkpLp iSkoiuKFCy1MP9zA04Tj9sLZ6Gg6ohVitCvzlE/FydmJs5A+6tCfmhoQKaKx21orTh/U 9BbQ== MIME-Version: 1.0 X-Received: by 10.60.101.137 with SMTP id fg9mr13532766oeb.60.1366766434530; Tue, 23 Apr 2013 18:20:34 -0700 (PDT) Sender: carpeddiem@gmail.com Received: by 10.60.132.204 with HTTP; Tue, 23 Apr 2013 18:20:34 -0700 (PDT) Date: Tue, 23 Apr 2013 21:20:34 -0400 X-Google-Sender-Auth: VVJ8KsdRmeUJIHPsAaQ6MuuJBgA Message-ID: Subject: snd_uaudio 2.0 class support for 24-bit samples with bSubslotSize=4 From: Ed Maste To: freebsd-usb@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Apr 2013 01:20:35 -0000 I have a Focusrite Scarlett 2i2 USB recording interface. It's a USB audio 2.0 class device but unfortunately doesn't work with snd_uaudio. As it turns out, it's a 24-bit device (as reported in bBitResolution) but uses 4 bytes per sample (bSubslotSize) and thus falls to the "Invalid bSubslotSize" case in uaudio_chan_fill_info_sub(). I'm not sure how common this is, but it is allowed by the spec. With the hackish patch below the device works well for playback (I haven't tested recording), with the side effect of falsely claiming to be a 32-bit device in dmesg and elsewhere. Index: uaudio.c =================================================================== --- uaudio.c (revision 249781) +++ uaudio.c (working copy) @@ -1413,9 +1414,12 @@ bChannels = asid.v2->bNrChannels; bBitResolution = asf1d.v2->bBitResolution; bSubslotSize = asf1d.v2->bSubslotSize; + if (bBitResolution == 24 && bSubslotSize == 4) + bBitResolution = 32; if (bBitResolution != (bSubslotSize * 8)) {