Re: help with Focusrite Scarlett 18i6 USB

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jul 12, 2011 at 5:22 PM, Daniel Mack <zonque@xxxxxxxxx> wrote:
> On Tue, Jul 12, 2011 at 12:39 PM, Nicolai Krakowiak
> <nicolai.krakowiak@xxxxxxxxx> wrote:
>> On Mon, Jul 11, 2011 at 3:22 AM, Daniel Mack <zonque@xxxxxxxxx> wrote:
>> I got as far as sound/usb/card.c:514 calling snd_usb_create_mixer().
>> It looks like it is hitting the default clause in check_input_term()
>> and returning -ENODEV.  Another missing case UAC2_EXTENSION_UNIT_V2?
>
> Probably, yes. I just posted a set of patches to alsa-devel which
> should fix this. Would be very helpful if you could give them a try :)

Awesome. Thanks!  Your help has been amazing.  I'm happy to test patches.

There seems to be an issue in continuing along in mixer.c.  I
sprinkled printfs as I'm bad at parsing the kernel trace.  It looks
like the following occurs:

parse_audio_unit() with a subtype == UAC_FEATURE_UNIT
parse_audio_feature_unit() with state->mixer_protocol == UAC_VERSION_1
hdr->bControlSize == 0, divide by zero.

Here's the kernel log:

[  252.320033] usb 1-8: new high speed USB device number 8 using ehci_hcd
[  252.731689] ALSA sound/usb/endpoint.c:434: 8:1:1: add audio endpoint 0x1
[  253.188429] ALSA sound/usb/endpoint.c:434: 8:2:1: add audio endpoint 0x82
[  253.645042] ALSA sound/usb/endpoint.c:434: 8:2:2: add audio endpoint 0x82
[  254.101432] ALSA sound/usb/mixer.c:1907: Ignoring UAC2_EXTENSION_UNIT
[  254.101436] ALSA sound/usb/mixer.c:1991: Unable to parse terminal
with bSourceID 10
[  254.101899] ALSA sound/usb/mixer.c:1858: [40] SU [Scarlett 18i6
USB-Sync] items = 3
[  254.101905] ALSA sound/usb/mixer.c:1907: Ignoring UAC2_EXTENSION_UNIT
[  254.101908] ALSA sound/usb/mixer.c:1991: Unable to parse terminal
with bSourceID 11
[  254.102335] ALSA sound/usb/card.c:152: 8:3:1: skipping, already claimed
[  254.102356] divide error: 0000 [#1] SMP
[  254.102360] last sysfs file:
/sys/devices/pci0000:00/0000:00:0b.1/usb1/idVendor
[  254.102363] CPU 0
[  254.102364] Modules linked in: snd_usb_audio(+) snd_usbmidi_lib
snd_hrtimer binfmt_misc vboxnetadp vboxnetflt vboxdrv kvm_intel kvm
dm_crypt snd_hda_codec_realtek tuner_simple tuner_types wm8775 tea5767
snd_hda_intel snd_hda_codec tuner snd_hwdep snd_pcm cx25840 nvidia(P)
snd_seq_midi snd_rawmidi ivtv adt7475 snd_seq_midi_event snd_seq
coretemp cx2341x i2c_algo_bit it87 snd_timer snd_seq_device hwmon_vid
v4l2_common firewire_sbp2 videodev snd ppdev nv_tco parport_pc
v4l2_compat_ioctl32 lp i2c_nforce2 soundcore tveeprom snd_page_alloc
shpchp psmouse parport serio_raw usbhid hid raid10 raid456 async_pq
async_xor xor async_memcpy async_raid6_recov raid6_pq async_tx raid1
raid0 multipath linear firewire_ohci firewire_core sky2 ahci
pata_jmicron libahci crc_itu_t forcedeth sata_nv pata_amd
[  254.102423]
[  254.102426] Pid: 3499, comm: modprobe Tainted: P
2.6.39-ngk.20110712 #1    /GA-N680SLI-DQ6
[  254.102431] RIP: 0010:[<ffffffffa102b7e7>]  [<ffffffffa102b7e7>]
parse_audio_unit+0x137/0xd70 [snd_usb_audio]
[  254.102445] RSP: 0018:ffff880037bcdaf8  EFLAGS: 00010256
[  254.102448] RAX: 000000000000001b RBX: 0000000000000000 RCX: 0000000000000024
[  254.102451] RDX: 0000000000000000 RSI: ffff8800b4c25544 RDI: ffff8800b4c25466
[  254.102453] RBP: ffff880037bcdbc8 R08: ffff8800b4c25488 R09: 0000000000000006
[  254.102456] R10: ffff8800b4c2546c R11: 0000000000000000 R12: 0000000000000000
[  254.102458] R13: ffff880037bcdbd8 R14: ffff8800b4c25466 R15: ffff880037bcdbd8
[  254.102461] FS:  00007ff7cdbbd720(0000) GS:ffff88013fc00000(0000)
knlGS:0000000000000000
[  254.102464] CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
[  254.102466] CR2: 00007f7862d91000 CR3: 0000000037aad000 CR4: 00000000000006f0
[  254.102469] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[  254.102472] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
[  254.102474] Process modprobe (pid: 3499, threadinfo
ffff880037bcc000, task ffff8801057816e0)
[  254.102477] Stack:
[  254.102478]  ffff880037bcdb18 ffffffff00016373 0000000000000000
0000000000000021
[  254.102483]  0000000000000001 ffffffff81c27581 ffff880037bcdb78
0044b82fa09b5a53
[  254.102487]  ffff880037bcdbe8 0000000000000246 0000000000000000
0000000000000246
[  254.102492] Call Trace:
[  254.102500]  [<ffffffff815be719>] ? printk+0x6c/0x73
[  254.102508]  [<ffffffffa102c4e0>] snd_usb_mixer_controls+0xc0/0x210
[snd_usb_audio]
[  254.102516]  [<ffffffffa102cba4>] snd_usb_create_mixer+0xc4/0x2b0
[snd_usb_audio]
[  254.102523]  [<ffffffffa1028359>] ?
snd_usb_create_stream+0x119/0x200 [snd_usb_audio]
[  254.102530]  [<ffffffffa1028804>] usb_audio_probe+0x224/0x9c0 [snd_usb_audio]
[  254.102536]  [<ffffffff81036e39>] ? default_spin_lock_flags+0x9/0x10
[  254.102541]  [<ffffffff81437dd9>] usb_probe_interface+0x109/0x200
[  254.102546]  [<ffffffff813b4656>] driver_probe_device+0x96/0x1c0
[  254.102549]  [<ffffffff813b482b>] __driver_attach+0xab/0xb0
[  254.102552]  [<ffffffff813b4780>] ? driver_probe_device+0x1c0/0x1c0
[  254.102556]  [<ffffffff813b360e>] bus_for_each_dev+0x5e/0x90
[  254.102559]  [<ffffffff813b42de>] driver_attach+0x1e/0x20
[  254.102563]  [<ffffffff813b3e45>] bus_add_driver+0xc5/0x280
[  254.102566]  [<ffffffff813b4e16>] driver_register+0x76/0x140
[  254.102570]  [<ffffffff815c563d>] ? notifier_call_chain+0x4d/0x70
[  254.102574]  [<ffffffff81436a08>] usb_register_driver+0xb8/0x170
[  254.102579]  [<ffffffffa1056000>] ? 0xffffffffa1055fff
[  254.102586]  [<ffffffffa105604e>] snd_usb_audio_init+0x4e/0x1000
[snd_usb_audio]
[  254.102591]  [<ffffffff81002165>] do_one_initcall+0x45/0x190
[  254.102596]  [<ffffffff810a1d1b>] sys_init_module+0xfb/0x250
[  254.102600]  [<ffffffff815c9942>] system_call_fastpath+0x16/0x1b
[  254.102603] Code: c8 49 8b 47 08 44 8b 58 30 45 85 db 0f 85 a2 03
00 00 41 0f b6 06 45 0f b6 66 05 4d 8d 56 06 4c 89 55 a8 83 e8 07 89
c2 c1 fa 1f
[  254.102628]  f7 fc 44 8d 68 ff 45 85 e4 41 0f b6 06 0f 84 86 0a 00 00 3c
[  254.102641] RIP  [<ffffffffa102b7e7>] parse_audio_unit+0x137/0xd70
[snd_usb_audio]
[  254.102650]  RSP <ffff880037bcdaf8>
[  254.102654] ---[ end trace f53ab11e07fff821 ]---

If I apply the trivial hacky workaround (attached), I can play sound
out the device again.  Here's the initialization output with the
bControlSize hack applied.

[ 1295.331769] ALSA sound/usb/endpoint.c:434: 8:1:1: add audio endpoint 0x1
[ 1295.789150] ALSA sound/usb/endpoint.c:434: 8:2:1: add audio endpoint 0x82
[ 1296.245842] ALSA sound/usb/endpoint.c:434: 8:2:2: add audio endpoint 0x82
[ 1296.702343] ALSA sound/usb/mixer.c:1887: hack: subtype = 6, unitid = 10
[ 1296.702346] ALSA sound/usb/mixer.c:1887: hack: subtype = 9, unitid = 51
[ 1296.702348] ALSA sound/usb/mixer.c:1912: Ignoring UAC2_EXTENSION_UNIT
[ 1296.702351] ALSA sound/usb/mixer.c:1996: Unable to parse terminal
with bSourceID 10
[ 1296.702353] ALSA sound/usb/mixer.c:1887: hack: subtype = 11, unitid = 40
[ 1296.702355] ALSA sound/usb/mixer.c:1887: hack: subtype = 10, unitid = 41
[ 1296.702357] ALSA sound/usb/mixer.c:1887: hack: subtype = 10, unitid = 42
[ 1296.702359] ALSA sound/usb/mixer.c:1887: hack: subtype = 10, unitid = 43
[ 1296.702811] ALSA sound/usb/mixer.c:1862: [40] SU [Scarlett 18i6
USB-Sync] items = 3
[ 1296.702816] ALSA sound/usb/mixer.c:1887: hack: subtype = 6, unitid = 11
[ 1296.702818] ALSA sound/usb/mixer.c:1887: hack: subtype = 9, unitid = 52
[ 1296.702820] ALSA sound/usb/mixer.c:1912: Ignoring UAC2_EXTENSION_UNIT
[ 1296.702822] ALSA sound/usb/mixer.c:1996: Unable to parse terminal
with bSourceID 11
[ 1296.703000] ALSA sound/usb/card.c:152: 8:3:1: skipping, already claimed
[ 1296.703003] ALSA sound/usb/mixer.c:1887: hack: subtype = 6, unitid = 10
[ 1296.703005] ALSA sound/usb/mixer.c:1199: invalid bControlSize == 0, id = 10
[ 1296.703007] ALSA sound/usb/mixer.c:1983: Unable to parse terminal
with bSourceID 10
[ 1296.703010] ALSA sound/usb/mixer.c:1887: hack: subtype = 6, unitid = 11
[ 1296.703012] ALSA sound/usb/mixer.c:1199: invalid bControlSize == 0, id = 11
[ 1296.703014] ALSA sound/usb/mixer.c:1983: Unable to parse terminal
with bSourceID 11
[ 1296.703024] ALSA sound/usb/midi.c:1687: MIDIStreaming version 01.00
[ 1296.703026] ALSA sound/usb/midi.c:1722: EP 02: 1 jack(s)
[ 1296.703028] ALSA sound/usb/midi.c:1737: EP 83: 1 jack(s)
[ 1296.703038] ALSA sound/usb/midi.c:1657: created 1 output and 1 input ports
[ 1296.703089] usbcore: registered new interface driver snd-usb-audio

nicolai
diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
index e7fce4b..748b9b1 100644
--- a/sound/usb/mixer.c
+++ b/sound/usb/mixer.c
@@ -1195,6 +1195,10 @@ static int parse_audio_feature_unit(struct mixer_build *state, int unitid, void
 
 	if (state->mixer->protocol == UAC_VERSION_1) {
 		csize = hdr->bControlSize;
+		if (!csize) {
+		    snd_printdd(KERN_WARNING "invalid bControlSize == 0, id = %d\n", unitid);
+		    return -EINVAL;
+		}
 		channels = (hdr->bLength - 7) / csize - 1;
 		bmaControls = hdr->bmaControls;
 	} else {
@@ -1880,6 +1884,7 @@ static int parse_audio_unit(struct mixer_build *state, int unitid)
 		return -EINVAL;
 	}
 
+	snd_printdd(KERN_WARNING "hack: subtype = %d, unitid = %d\n", p1[2], unitid);
 	switch (p1[2]) {
 	case UAC_INPUT_TERMINAL:
 	case UAC2_CLOCK_SOURCE:
------------------------------------------------------------------------------
AppSumo Presents a FREE Video for the SourceForge Community by Eric 
Ries, the creator of the Lean Startup Methodology on "Lean Startup 
Secrets Revealed." This video shows you how to validate your ideas, 
optimize your ideas and identify your business strategy.
http://p.sf.net/sfu/appsumosfdev2dev
_______________________________________________
Alsa-user mailing list
Alsa-user@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/alsa-user

[Index of Archives]     [ALSA Devel]     [Linux Audio Users]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]

  Powered by Linux