Commit 2fe12282 authored by Jaroslav Kysela's avatar Jaroslav Kysela

ALSA CVS update - Jaroslav Kysela <perex@suse.cz>

USB generic driver
Show proper ID for Creative Sound Blaster MP3+
parent a6f4b5b2
...@@ -2717,6 +2717,7 @@ static int snd_usb_audio_create(snd_card_t *card, struct usb_device *dev, ...@@ -2717,6 +2717,7 @@ static int snd_usb_audio_create(snd_card_t *card, struct usb_device *dev,
{ {
snd_usb_audio_t *chip; snd_usb_audio_t *chip;
int err, len; int err, len;
char component[14];
static snd_device_ops_t ops = { static snd_device_ops_t ops = {
.dev_free = snd_usb_audio_dev_free, .dev_free = snd_usb_audio_dev_free,
}; };
...@@ -2737,46 +2738,42 @@ static int snd_usb_audio_create(snd_card_t *card, struct usb_device *dev, ...@@ -2737,46 +2738,42 @@ static int snd_usb_audio_create(snd_card_t *card, struct usb_device *dev,
} }
strcpy(card->driver, "USB-Audio"); strcpy(card->driver, "USB-Audio");
sprintf(component, "USB%#04x:%#04x",
dev->descriptor.idVendor, dev->descriptor.idProduct);
snd_component_add(card, component);
/* retrieve the device string as shortname */ /* retrieve the device string as shortname */
if (quirk && quirk->product_name) {
len = strlcpy(card->shortname, quirk->product_name, sizeof(card->shortname));
} else {
if (dev->descriptor.iProduct) if (dev->descriptor.iProduct)
len = usb_string(dev, dev->descriptor.iProduct, len = usb_string(dev, dev->descriptor.iProduct,
card->shortname, sizeof(card->shortname)); card->shortname, sizeof(card->shortname));
else else
len = 0; len = 0;
}
if (len <= 0) { if (len <= 0) {
if (quirk && quirk->product_name) {
strlcpy(card->shortname, quirk->product_name, sizeof(card->shortname));
} else {
sprintf(card->shortname, "USB Device %#04x:%#04x", sprintf(card->shortname, "USB Device %#04x:%#04x",
dev->descriptor.idVendor, dev->descriptor.idProduct); dev->descriptor.idVendor, dev->descriptor.idProduct);
} }
}
/* retrieve the vendor and device strings as longname */ /* retrieve the vendor and device strings as longname */
if (quirk && quirk->vendor_name) {
len = strlcpy(card->longname, quirk->vendor_name, sizeof(card->longname));
} else {
if (dev->descriptor.iManufacturer) if (dev->descriptor.iManufacturer)
len = usb_string(dev, dev->descriptor.iManufacturer, len = usb_string(dev, dev->descriptor.iManufacturer,
card->longname, sizeof(card->longname)); card->longname, sizeof(card->longname));
else else
len = 0; len = 0;
if (len <= 0) {
if (quirk && quirk->vendor_name) {
len = strlcpy(card->longname, quirk->vendor_name, sizeof(card->longname));
} else {
len = 0;
}
} }
if (len > 0) if (len > 0)
strlcat(card->longname, " ", sizeof(card->longname)); strlcat(card->longname, " ", sizeof(card->longname));
len = strlen(card->longname); len = strlen(card->longname);
if ((!dev->descriptor.iProduct if (quirk && quirk->product_name)
|| usb_string(dev, dev->descriptor.iProduct,
card->longname + len, sizeof(card->longname) - len) <= 0)
&& quirk && quirk->product_name) {
strlcat(card->longname, quirk->product_name, sizeof(card->longname)); strlcat(card->longname, quirk->product_name, sizeof(card->longname));
}
len = strlcat(card->longname, " at ", sizeof(card->longname)); len = strlcat(card->longname, " at ", sizeof(card->longname));
...@@ -2815,7 +2812,7 @@ static void *snd_usb_audio_probe(struct usb_device *dev, ...@@ -2815,7 +2812,7 @@ static void *snd_usb_audio_probe(struct usb_device *dev,
alts = &intf->altsetting[0]; alts = &intf->altsetting[0];
ifnum = get_iface_desc(alts)->bInterfaceNumber; ifnum = get_iface_desc(alts)->bInterfaceNumber;
if (quirk && quirk->ifnum != QUIRK_ANY_INTERFACE && ifnum != quirk->ifnum) if (quirk && quirk->ifnum >= 0 && ifnum != quirk->ifnum)
goto __err_val; goto __err_val;
/* SB Extigy needs special boot-up sequence */ /* SB Extigy needs special boot-up sequence */
...@@ -2876,7 +2873,7 @@ static void *snd_usb_audio_probe(struct usb_device *dev, ...@@ -2876,7 +2873,7 @@ static void *snd_usb_audio_probe(struct usb_device *dev,
} }
err = 1; /* continue */ err = 1; /* continue */
if (quirk) { if (quirk && quirk->ifnum != QUIRK_NO_INTERFACE) {
/* need some special handlings */ /* need some special handlings */
if ((err = snd_usb_create_quirk(chip, intf, quirk)) < 0) if ((err = snd_usb_create_quirk(chip, intf, quirk)) < 0)
goto __error; goto __error;
......
...@@ -142,6 +142,7 @@ struct snd_usb_audio { ...@@ -142,6 +142,7 @@ struct snd_usb_audio {
* Information about devices with broken descriptors * Information about devices with broken descriptors
*/ */
#define QUIRK_NO_INTERFACE -2
#define QUIRK_ANY_INTERFACE -1 #define QUIRK_ANY_INTERFACE -1
#define QUIRK_MIDI_FIXED_ENDPOINT 0 #define QUIRK_MIDI_FIXED_ENDPOINT 0
......
...@@ -668,4 +668,15 @@ YAMAHA_DEVICE(0x5008, "01V96"), ...@@ -668,4 +668,15 @@ YAMAHA_DEVICE(0x5008, "01V96"),
} }
}, },
{
/* Creative Sound Blaster MP3+ */
USB_DEVICE(0x041e, 0x3010),
.driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) {
.vendor_name = "Creative Labs",
.product_name = "Sound Blaster MP3+",
.ifnum = QUIRK_NO_INTERFACE
}
},
#undef USB_DEVICE_VENDOR_SPEC #undef USB_DEVICE_VENDOR_SPEC
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment