Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 210489
b: refs/heads/master
c: a2acad8
h: refs/heads/master
i:
  210487: 809ea68
v: v3
  • Loading branch information
Clemens Ladisch authored and Takashi Iwai committed Sep 3, 2010
1 parent 4339c1c commit b8e8e32
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 27 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 7b6717e144de6592e614fd7fc3b914b6bf686a9d
refs/heads/master: a2acad8298a42b7be684a32fafaf83332bba9c2b
9 changes: 5 additions & 4 deletions trunk/sound/usb/card.c
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,11 @@ static int snd_usb_create_streams(struct snd_usb_audio *chip, int ctrlif)
}

switch (protocol) {
default:
snd_printdd(KERN_WARNING "unknown interface protocol %#02x, assuming v1\n",
protocol);
/* fall through */

case UAC_VERSION_1: {
struct uac1_ac_header_descriptor *h1 = control_header;

Expand Down Expand Up @@ -253,10 +258,6 @@ static int snd_usb_create_streams(struct snd_usb_audio *chip, int ctrlif)

break;
}

default:
snd_printk(KERN_ERR "unknown protocol version 0x%02x\n", protocol);
return -EINVAL;
}

return 0;
Expand Down
3 changes: 1 addition & 2 deletions trunk/sound/usb/clock.c
Original file line number Diff line number Diff line change
Expand Up @@ -295,12 +295,11 @@ int snd_usb_init_sample_rate(struct snd_usb_audio *chip, int iface,

switch (altsd->bInterfaceProtocol) {
case UAC_VERSION_1:
default:
return set_sample_rate_v1(chip, iface, alts, fmt, rate);

case UAC_VERSION_2:
return set_sample_rate_v2(chip, iface, alts, fmt, rate);
}

return -EINVAL;
}

11 changes: 6 additions & 5 deletions trunk/sound/usb/endpoint.c
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,12 @@ int snd_usb_parse_audio_endpoints(struct snd_usb_audio *chip, int iface_no)

/* get audio formats */
switch (protocol) {
default:
snd_printdd(KERN_WARNING "%d:%u:%d: unknown interface protocol %#02x, assuming v1\n",
dev->devnum, iface_no, altno, protocol);
protocol = UAC_VERSION_1;
/* fall through */

case UAC_VERSION_1: {
struct uac1_as_header_descriptor *as =
snd_usb_find_csint_desc(alts->extra, alts->extralen, NULL, UAC_AS_GENERAL);
Expand Down Expand Up @@ -336,11 +342,6 @@ int snd_usb_parse_audio_endpoints(struct snd_usb_audio *chip, int iface_no)
dev->devnum, iface_no, altno, as->bTerminalLink);
continue;
}

default:
snd_printk(KERN_ERR "%d:%u:%d : unknown interface protocol %04x\n",
dev->devnum, iface_no, altno, protocol);
continue;
}

/* get format type */
Expand Down
22 changes: 10 additions & 12 deletions trunk/sound/usb/format.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ static u64 parse_audio_format_i_type(struct snd_usb_audio *chip,
u64 pcm_formats;

switch (protocol) {
case UAC_VERSION_1: {
case UAC_VERSION_1:
default: {
struct uac_format_type_i_discrete_descriptor *fmt = _fmt;
sample_width = fmt->bBitResolution;
sample_bytes = fmt->bSubframeSize;
Expand All @@ -64,9 +65,6 @@ static u64 parse_audio_format_i_type(struct snd_usb_audio *chip,
format <<= 1;
break;
}

default:
return -EINVAL;
}

pcm_formats = 0;
Expand Down Expand Up @@ -384,6 +382,10 @@ static int parse_audio_format_i(struct snd_usb_audio *chip,
* audio class v2 uses class specific EP0 range requests for that.
*/
switch (protocol) {
default:
snd_printdd(KERN_WARNING "%d:%u:%d : invalid protocol version %d, assuming v1\n",
chip->dev->devnum, fp->iface, fp->altsetting, protocol);
/* fall through */
case UAC_VERSION_1:
fp->channels = fmt->bNrChannels;
ret = parse_audio_format_rates_v1(chip, fp, (unsigned char *) fmt, 7);
Expand All @@ -392,10 +394,6 @@ static int parse_audio_format_i(struct snd_usb_audio *chip,
/* fp->channels is already set in this case */
ret = parse_audio_format_rates_v2(chip, fp);
break;
default:
snd_printk(KERN_ERR "%d:%u:%d : invalid protocol version %d\n",
chip->dev->devnum, fp->iface, fp->altsetting, protocol);
return -EINVAL;
}

if (fp->channels < 1) {
Expand Down Expand Up @@ -438,6 +436,10 @@ static int parse_audio_format_ii(struct snd_usb_audio *chip,
fp->channels = 1;

switch (protocol) {
default:
snd_printdd(KERN_WARNING "%d:%u:%d : invalid protocol version %d, assuming v1\n",
chip->dev->devnum, fp->iface, fp->altsetting, protocol);
/* fall through */
case UAC_VERSION_1: {
struct uac_format_type_ii_discrete_descriptor *fmt = _fmt;
brate = le16_to_cpu(fmt->wMaxBitRate);
Expand All @@ -456,10 +458,6 @@ static int parse_audio_format_ii(struct snd_usb_audio *chip,
ret = parse_audio_format_rates_v2(chip, fp);
break;
}
default:
snd_printk(KERN_ERR "%d:%u:%d : invalid protocol version %d\n",
chip->dev->devnum, fp->iface, fp->altsetting, protocol);
return -EINVAL;
}

return ret;
Expand Down
10 changes: 9 additions & 1 deletion trunk/sound/usb/mixer.c
Original file line number Diff line number Diff line change
Expand Up @@ -2175,7 +2175,15 @@ int snd_usb_create_mixer(struct snd_usb_audio *chip, int ctrlif,
}

host_iface = &usb_ifnum_to_if(chip->dev, ctrlif)->altsetting[0];
mixer->protocol = get_iface_desc(host_iface)->bInterfaceProtocol;
switch (get_iface_desc(host_iface)->bInterfaceProtocol) {
case UAC_VERSION_1:
default:
mixer->protocol = UAC_VERSION_1;
break;
case UAC_VERSION_2:
mixer->protocol = UAC_VERSION_2;
break;
}

if ((err = snd_usb_mixer_controls(mixer)) < 0 ||
(err = snd_usb_mixer_status_create(mixer)) < 0)
Expand Down
3 changes: 1 addition & 2 deletions trunk/sound/usb/pcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,13 +173,12 @@ int snd_usb_init_pitch(struct snd_usb_audio *chip, int iface,

switch (altsd->bInterfaceProtocol) {
case UAC_VERSION_1:
default:
return init_pitch_v1(chip, iface, alts, fmt);

case UAC_VERSION_2:
return init_pitch_v2(chip, iface, alts, fmt);
}

return -EINVAL;
}

/*
Expand Down

0 comments on commit b8e8e32

Please sign in to comment.