diff --git a/usb/mixer.c b/usb/mixer.c index 3d70245..4e42458 100644 --- a/usb/mixer.c +++ b/usb/mixer.c @@ -702,7 +702,8 @@ static int check_input_term(struct mixer_build *state, int id, struct usb_audio_ struct uac_processing_unit_descriptor *d = p1; if (d->bNrInPins) { id = d->baSourceID[0]; - break; /* continue to parse */ + //break; /* continue to parse */ + return 0; } term->type = d->bDescriptorSubtype << 16; /* virtual type */ term->channels = uac_processing_unit_bNrChannels(d); diff --git a/usb/mixer_quirks.c b/usb/mixer_quirks.c index 12125ca..a2a1ef5 100644 --- a/usb/mixer_quirks.c +++ b/usb/mixer_quirks.c @@ -925,6 +925,53 @@ static int snd_ftu_create_mixer(struct usb_mixer_interface *mixer) } +/* Try to create mixer controls for M-Audio C400 */ +static int snd_c400_create_vol_ctls(struct usb_mixer_interface *mixer) +{ + char name[64]; + unsigned int cmask; + int in, out, err; + + const unsigned int id = 0x40; + const int val_type = USB_MIXER_S16; + const control = 1; + + for (in = 0; in < 10; in++) { + for (out = 0; out < 6; out++) { + /* Give it a name */ + if(in < 6) { + snprintf(name, sizeof(name), + "DIn%d - Out%d Playback Volume", + in + 1, out + 1); + } else { + snprintf(name, sizeof(name), + "AIn%d - Out%d Playback Volume", + in - 6, out + 1); + } + /* Create as many controls as possible a.t.m. */ + if (in * 6 + out < MAX_CHANNELS) { + cmask = 1 << (in * 6 + out); + printk(KERN_DEBUG "out = %d, in = %d, cmask=%x\n", out, in, cmask); + err = snd_create_std_mono_ctl(mixer, id, control, + cmask, val_type, name, + &snd_usb_mixer_vol_tlv); + if (err < 0) + return err; + } + } + } + + return 0; +} + +static int snd_c400_create_mixer(struct usb_mixer_interface *mixer) +{ + int err = 0; + err = snd_c400_create_vol_ctls(mixer); + + return err; +} + /* * Create mixer for Electrix Ebox-44 * @@ -1025,6 +1072,10 @@ int snd_usb_mixer_apply_create_quirk(struct usb_mixer_interface *mixer) err = snd_ftu_create_mixer(mixer); break; + case USB_ID(0x0763, 0x2030): /* M-Audio C400 */ + err = snd_c400_create_mixer(mixer); + break; + case USB_ID(0x0b05, 0x1739): case USB_ID(0x0b05, 0x1743): err = snd_xonar_u1_controls_create(mixer); diff --git a/usb/quirks-table.h b/usb/quirks-table.h index d89ab4c..9114f8c 100644 --- a/usb/quirks-table.h +++ b/usb/quirks-table.h @@ -2266,7 +2266,73 @@ YAMAHA_DEVICE(0x7010, "UB99"), } } }, - +{ + USB_DEVICE_VENDOR_SPEC(0x0763, 0x2030), + .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { + /* .vendor_name = "M-Audio", */ + /* .product_name = "Fast Track C400", */ + .ifnum = QUIRK_ANY_INTERFACE, + .type = QUIRK_COMPOSITE, + .data = & (const struct snd_usb_audio_quirk[]) { + { + .ifnum = 1, + .type = QUIRK_AUDIO_STANDARD_MIXER, + }, + { + .ifnum = 2, + .type = QUIRK_AUDIO_FIXED_ENDPOINT, + .data = & (const struct audioformat) { + .formats = SNDRV_PCM_FMTBIT_S24_3LE, + .channels = 4, + .iface = 2, + .altsetting = 1, + .altset_idx = 1, + .attributes = UAC_EP_CS_ATTR_SAMPLE_RATE, + .endpoint = 0x01, + .ep_attr = 0x09, + .rates = SNDRV_PCM_RATE_44100 | + SNDRV_PCM_RATE_48000 | + SNDRV_PCM_RATE_88200 | + SNDRV_PCM_RATE_96000, + .rate_min = 44100, + .rate_max = 96000, + .nr_rates = 4, + .rate_table = (unsigned int[]) { + 44100, 48000, 88200, 96000 + } + } + }, + { + .ifnum = 3, + .type = QUIRK_AUDIO_FIXED_ENDPOINT, + .data = & (const struct audioformat) { + .formats = SNDRV_PCM_FMTBIT_S24_3LE, + .channels = 6, + .iface = 3, + .altsetting = 1, + .altset_idx = 1, + .attributes = UAC_EP_CS_ATTR_SAMPLE_RATE, + .endpoint = 0x81, + .ep_attr = 0x05, + .rates = SNDRV_PCM_RATE_44100 | + SNDRV_PCM_RATE_48000 | + SNDRV_PCM_RATE_88200 | + SNDRV_PCM_RATE_96000, + .rate_min = 44100, + .rate_max = 96000, + .nr_rates = 4, + .rate_table = (unsigned int[]) { + 44100, 48000, 88200, 96000 + } + } + }, + /* interface 4 (MIDI) is standard compliant */ + { + .ifnum = -1 + } + } + } +}, /* Casio devices */ { USB_DEVICE(0x07cf, 0x6801),