From owner-freebsd-current@FreeBSD.ORG Wed Apr 22 07:39:29 2015 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A7E34BD7 for ; Wed, 22 Apr 2015 07:39:29 +0000 (UTC) Received: from mail.turbocat.net (mail.turbocat.net [IPv6:2a01:4f8:d16:4514::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 336CE1BB4 for ; Wed, 22 Apr 2015 07:39:29 +0000 (UTC) Received: from laptop015.home.selasky.org (cm-176.74.213.204.customer.telag.net [176.74.213.204]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 5481C1FE023; Wed, 22 Apr 2015 09:39:27 +0200 (CEST) Message-ID: <55375060.2060705@selasky.org> Date: Wed, 22 Apr 2015 09:40:16 +0200 From: Hans Petter Selasky User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: "Ranjan1018 ." <214748mv@gmail.com>, FreeBSD CURRENT Subject: Re: CM6206 USB Audio is mute. References: In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Apr 2015 07:39:29 -0000 On 04/21/15 21:30, Ranjan1018 . wrote: > Connecting the USB cable the item is recognized: > ugen0.5: at usbus0 > uaudio0: > on usbus0 > uaudio0: Play: 48000 Hz, 4 ch, 16-bit S-LE PCM format, 2x8ms buffer. > uaudio0: Play: 44100 Hz, 4 ch, 16-bit S-LE PCM format, 2x8ms buffer. > uaudio0: Record: 48000 Hz, 2 ch, 16-bit S-LE PCM format, 2x8ms buffer. > uaudio0: Record: 44100 Hz, 2 ch, 16-bit S-LE PCM format, 2x8ms buffer. > uaudio0: No MIDI sequencer. > pcm1: on uaudio0 > uaudio0: HID volume keys found. > Hi, Did you check: mixer -f /dev/mixerX that sound volume is OK? > Setting it as default unit > # sysctl hw.snd.default_unit=1 > and playing a song the interrupts count increase: Some volume knobs might be hidden. Try to get all: sysctl -a | grep pcm > But the output is mute. > > In Debian Linux it works: > # lsusb > Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub > Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub > Bus 002 Device 014: ID 0d8c:0102 C-Media Electronics, Inc. CM106 Like Sound > Device > # aplay -l > **** List of PLAYBACK Hardware Devices **** > card 1: Device [USB Sound Device], device 0: USB Audio [USB Audio] > Subdevices: 0/1 > Subdevice #0: subdevice #0 > > Looking at http://lxr.free-electrons.com/source/sound/usb/quirks.c I have > found this code: > /* > 632 * C-Media CM106/CM106+ have four 16-bit internal registers that are > nicely > 633 * documented in the device's data sheet. > 634 */ > 635 static int snd_usb_cm106_write_int_reg(struct usb_device *dev, int reg, > u16 value) > 636 { > 637 u8 buf[4]; > 638 buf[0] = 0x20; > 639 buf[1] = value & 0xff; > 640 buf[2] = (value >> 8) & 0xff; > 641 buf[3] = reg; > 642 return snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), > USB_REQ_SET_CONFIGURATION, > 643 USB_DIR_OUT | USB_TYPE_CLASS | > USB_RECIP_ENDPOINT, > 644 0, 0, &buf, 4); > 645 } This USB control request can be issued from userspace like this (you need to convert all variables below into constants): usbconfig -d X.Y do_request "USB_DIR_OUT | USB_TYPE_CLASS | > USB_RECIP_ENDPOINT" "USB_REQ_SET_CONFIGURATION" 0 0 4 0x20 "(value & 0xff)" "(value >> 8) & 0xff" "reg" Such a command can easily be added like a devd script to run automatically during device attach. > 646 > 647 static int snd_usb_cm106_boot_quirk(struct usb_device *dev) > 648 { > 649 /* > 650 * Enable line-out driver mode, set headphone source to front > 651 * channels, enable stereo mic. > 652 */ > 653 return snd_usb_cm106_write_int_reg(dev, 2, 0x8004); > 654 } > 655 > 656 /* > 657 * C-Media CM6206 is based on CM106 with two additional > 658 * registers that are not documented in the data sheet. > 659 * Values here are chosen based on sniffing USB traffic > 660 * under Windows. > 661 */ > 662 static int snd_usb_cm6206_boot_quirk(struct usb_device *dev) > 663 { > 664 int err = 0, reg; > 665 int val[] = {0x2004, 0x3000, 0xf800, 0x143f, 0x0000, 0x3000}; > 666 > 667 for (reg = 0; reg < ARRAY_SIZE(val); reg++) { > 668 err = snd_usb_cm106_write_int_reg(dev, reg, val[reg]); > 669 if (err < 0) > 670 return err; > 671 } > 672 > 673 return err; > 674 } > 675 > > How can I test this code in FreeBSD ? > See answer above. Please also use -stable or -current when testing. --HPS