Update of /cvsroot/alsa/alsa-kernel/usb
In directory sc8-pr-cvs1:/tmp/cvs-serv28157

Modified Files:
        usbaudio.c usbaudio.h usbquirks.h 
Log Message:
Show proper ID for Creative Sound Blaster MP3+

Index: usbaudio.c
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/usb/usbaudio.c,v
retrieving revision 1.74
retrieving revision 1.75
diff -u -r1.74 -r1.75
--- usbaudio.c  19 Dec 2003 09:20:40 -0000      1.74
+++ usbaudio.c  19 Jan 2004 19:33:45 -0000      1.75
@@ -2717,6 +2717,7 @@
 {
        snd_usb_audio_t *chip;
        int err, len;
+       char component[14];
        static snd_device_ops_t ops = {
                .dev_free =     snd_usb_audio_dev_free,
        };
@@ -2737,46 +2738,42 @@
        }
 
        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 */
-       if (dev->descriptor.iProduct)
-               len = usb_string(dev, dev->descriptor.iProduct,
-                                card->shortname, sizeof(card->shortname));
-       else
-               len = 0;
+       if (quirk && quirk->product_name) {
+               len = strlcpy(card->shortname, quirk->product_name, 
sizeof(card->shortname));
+       } else {
+               if (dev->descriptor.iProduct)
+                       len = usb_string(dev, dev->descriptor.iProduct,
+                                        card->shortname, sizeof(card->shortname));
+               else
+                       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",
-                               dev->descriptor.idVendor, dev->descriptor.idProduct);
-               }
+               sprintf(card->shortname, "USB Device %#04x:%#04x",
+                       dev->descriptor.idVendor, dev->descriptor.idProduct);
        }
 
        /* retrieve the vendor and device strings as longname */
-       if (dev->descriptor.iManufacturer)
-               len = usb_string(dev, dev->descriptor.iManufacturer,
-                                card->longname, sizeof(card->longname));
-       else
-               len = 0;
-       if (len <= 0) {
-               if (quirk && quirk->vendor_name) {
-                       len = strlcpy(card->longname, quirk->vendor_name, 
sizeof(card->longname));
-               } else {
+       if (quirk && quirk->vendor_name) {
+               len = strlcpy(card->longname, quirk->vendor_name, 
sizeof(card->longname));
+       } else {
+               if (dev->descriptor.iManufacturer)
+                       len = usb_string(dev, dev->descriptor.iManufacturer,
+                                        card->longname, sizeof(card->longname));
+               else
                        len = 0;
-               }
        }
        if (len > 0)
                strlcat(card->longname, " ", sizeof(card->longname));
 
        len = strlen(card->longname);
 
-       if ((!dev->descriptor.iProduct
-            || usb_string(dev, dev->descriptor.iProduct,
-                          card->longname + len, sizeof(card->longname) - len) <= 0)
-           && quirk && quirk->product_name) {
+       if (quirk && quirk->product_name)
                strlcat(card->longname, quirk->product_name, sizeof(card->longname));
-       }
 
        len = strlcat(card->longname, " at ", sizeof(card->longname));
 
@@ -2815,7 +2812,7 @@
        alts = &intf->altsetting[0];
        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;
 
        /* SB Extigy needs special boot-up sequence */
@@ -2876,7 +2873,7 @@
        }
 
        err = 1; /* continue */
-       if (quirk) {
+       if (quirk && quirk->ifnum != QUIRK_NO_INTERFACE) {
                /* need some special handlings */
                if ((err = snd_usb_create_quirk(chip, intf, quirk)) < 0)
                        goto __error;

Index: usbaudio.h
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/usb/usbaudio.h,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- usbaudio.h  30 Dec 2003 10:09:37 -0000      1.22
+++ usbaudio.h  19 Jan 2004 19:33:46 -0000      1.23
@@ -142,7 +142,8 @@
  * Information about devices with broken descriptors
  */
 
-#define QUIRK_ANY_INTERFACE -1
+#define QUIRK_NO_INTERFACE             -2
+#define QUIRK_ANY_INTERFACE            -1
 
 #define QUIRK_MIDI_FIXED_ENDPOINT      0
 #define QUIRK_MIDI_YAMAHA              1

Index: usbquirks.h
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/usb/usbquirks.h,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- usbquirks.h 9 Oct 2003 11:05:34 -0000       1.24
+++ usbquirks.h 19 Jan 2004 19:33:46 -0000      1.25
@@ -668,4 +668,15 @@
        }
 },
 
+{
+       /* 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



-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
Alsa-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-cvslog

Reply via email to