Another discovery and a temporary solution that works for me, at least.. snd_usb_audio_probe() gets called twice, I'm guessing first for the audio interface and second for the midi interface. I found that if snd-usb-audio is not loaded and I plug in the Audiophile and let hotplug take care of loading the modules (the only way audio will work), then usb_set_configuration() fails during the second call to snd_usb_audio_probe(), causing the probe to abort. So no midi.
This patch causes usb_set_configuration() to be called only during the first probe. I have no idea what's really causing the problem, but for now this gives me audio and midi at the same time. :) Ben On Thursday 17 July 2003 1:47 am, Ben Saylor wrote: > I know you developers are overloaded, but here are a few things I've > discovered as I attempt to diagnose the problem.. > > After installing the Audiophile once on a Windows machine, MIDI works > with 0.9.5, even if I power off and unplug the unit from USB and AC. > It seems that the firmware only has to be loaded once. > > I get sound (but always at 48khz) with 0.9.5 iff I do the following: > 1. make sure ALSA modules are unloaded > 2. unplug the audiophile from the computer > 3. plug the audiophile into the computer > snd-usb-audio and other modules are loaded automatically. > --However, MIDI doesn't work if I do this. > > If I load the ALSA modules any other way than the above, MIDI works, > but audio is either static or distorted. I also get a bunch of these > in /var/log/debug when I play a sound file (44100 Hz, 16 bit, stereo) > with aplay: > > Jul 17 01:14:32 purebox kernel: usb.c: usb-check-bandwidth would have > FAILED: was 938, would be 940, bustime = 2 us > Jul 17 01:14:32 purebox kernel: usb.c: usb-check-bandwidth would have > FAILED: was 826, would be 940, bustime = 114 us > Jul 17 01:14:32 purebox kernel: usb.c: usb-check-bandwidth would have > FAILED: was 938, would be 940, bustime = 2 us > Jul 17 01:14:33 purebox kernel: usb.c: usb-check-bandwidth would have > FAILED: was 483, would be 940, bustime = 457 us > Jul 17 01:14:33 purebox kernel: usb.c: usb-check-bandwidth would have > FAILED: was 938, would be 940, bustime = 2 us > Jul 17 01:14:33 purebox kernel: usb.c: usb-check-bandwidth would have > FAILED: was 826, would be 940, bustime = 114 us > > etc. running tail -f /var/log/debug shows that 10 of these lines are > spit out per second during playback. They don't appear if I let the > modules load automatically. > > Ben
--- alsa-driver-0.9.5/alsa-kernel/usb/usbaudio.c 2003-06-23 04:41:36.000000000 -0800 +++ alsa-driver-0.9.5-apusbhack/alsa-kernel/usb/usbaudio.c 2003-07-18 00:51:07.000000000 -0800 @@ -2599,6 +2599,7 @@ static snd_device_ops_t ops = { .dev_free = snd_usb_audio_dev_free, }; +snd_printd(KERN_INFO ">>snd_usb_audio_create\n"); *rchip = NULL; chip = snd_magic_kcalloc(snd_usb_audio_t, 0, GFP_KERNEL); @@ -2688,17 +2689,53 @@ snd_usb_audio_t *chip; struct usb_host_interface *alts; int ifnum; +snd_printd(KERN_INFO ">>snd_usb_audio_probe\n"); +snd_printd(KERN_INFO "\ + match_flags = %x\n\ + idVendor = %x\n\ + idProduct = %x\n\ + bcdDevice_lo = %x\n\ + bcdDevice_hi = %x\n\ + bDeviceClass = %x\n\ + bDeviceSubClass = %x\n\ + bDeviceProtocol = %x\n\ + bInterfaceClass = %x\n\ + bInterfaceSubClass = %x\n\ + bInterfaceProtocol = %x\n\ +", +usb_id->match_flags, +usb_id->idVendor, +usb_id->idProduct, +usb_id->bcdDevice_lo, +usb_id->bcdDevice_hi, +usb_id->bDeviceClass, +usb_id->bDeviceSubClass, +usb_id->bDeviceProtocol, +usb_id->bInterfaceClass, +usb_id->bInterfaceSubClass, +usb_id->bInterfaceProtocol +); + + static int frogbreath = 0; alts = &intf->altsetting[0]; ifnum = get_iface_desc(alts)->bInterfaceNumber; +snd_printd(KERN_INFO "check1\n"); if (quirk && quirk->ifnum != QUIRK_ANY_INTERFACE && ifnum != quirk->ifnum) goto __err_val; +snd_printd(KERN_INFO "check2\n"); - if (usb_set_configuration(dev, get_cfg_desc(config)->bConfigurationValue) < 0) { - snd_printk(KERN_ERR "cannot set configuration (value 0x%x)\n", get_cfg_desc(config)->bConfigurationValue); - goto __err_val; + if (!frogbreath) { + // if the audiophile is hotplugged and snd-usb-audio wasn't already loaded, usb_set_configuration fails on the 2nd probe (midi interface) + if (usb_set_configuration(dev, get_cfg_desc(config)->bConfigurationValue) < 0) { + snd_printk(KERN_ERR "cannot set configuration (value 0x%x)\n", get_cfg_desc(config)->bConfigurationValue); + snd_printd(KERN_INFO "cannot set configuration (value 0x%x)\n", get_cfg_desc(config)->bConfigurationValue); + goto __err_val; + } + frogbreath++; } +snd_printd(KERN_INFO "check3\n"); /* SB Extigy needs special boot-up sequence */ /* if more models come, this will go to the quirk list. */ @@ -2754,6 +2791,7 @@ err = 1; /* continue */ if (quirk) { +snd_printd(KERN_INFO ">> ******* [snd_usb_audio_probe] if (quirk) { ..\n"); /* need some special handlings */ if ((err = snd_usb_create_quirk(chip, intf, quirk)) < 0) goto __error; @@ -2793,6 +2831,7 @@ snd_usb_audio_t *chip; snd_card_t *card; struct list_head *p; +//snd_printd(KERN_INFO ">>snd_usb_audio_disconnect\n"); if (ptr == (void *)-1L) return; @@ -2836,6 +2875,7 @@ const struct usb_device_id *id) { void *chip; +snd_printd(KERN_INFO ">>usb_audio_probe\n"); chip = snd_usb_audio_probe(interface_to_usbdev(intf), intf, id); if (chip) { dev_set_drvdata(&intf->dev, chip);