Update of /cvsroot/alsa/alsa-kernel/usb
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3902

Modified Files:
        usbaudio.c 
Log Message:
fixes for broken SB Audigy 2 NX descriptors

Index: usbaudio.c
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/usb/usbaudio.c,v
retrieving revision 1.83
retrieving revision 1.84
diff -u -r1.83 -r1.84
--- usbaudio.c  2 Mar 2004 17:01:17 -0000       1.83
+++ usbaudio.c  4 Mar 2004 13:20:24 -0000       1.84
@@ -1129,15 +1129,20 @@
             (! is_playback && attr == EP_ATTR_ADAPTIVE)) &&
            altsd->bNumEndpoints >= 2) {
                /* check sync-pipe endpoint */
-               if (get_endpoint(alts, 1)->bmAttributes != 0x01 ||
-                   get_endpoint(alts, 1)->bSynchAddress != 0) {
+               /* ... and check descriptor size before accessing bSynchAddress
+                  because there is a version of the SB Audigy 2 NX firmware lacking
+                  the audio fields in the endpoint descriptors */
+               if ((get_endpoint(alts, 1)->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) 
!= 0x01 ||
+                   (get_endpoint(alts, 1)->bLength >= USB_DT_ENDPOINT_AUDIO_SIZE &&
+                    get_endpoint(alts, 1)->bSynchAddress != 0)) {
                        snd_printk(KERN_ERR "%d:%d:%d : invalid synch pipe\n",
                                   dev->devnum, fmt->iface, fmt->altsetting);
                        return -EINVAL;
                }
                ep = get_endpoint(alts, 1)->bEndpointAddress;
-               if ((is_playback && ep != (unsigned int)(get_endpoint(alts, 
0)->bSynchAddress | USB_DIR_IN)) ||
-                   (! is_playback && ep != (unsigned int)(get_endpoint(alts, 
0)->bSynchAddress & ~USB_DIR_IN))) {
+               if (get_endpoint(alts, 0)->bLength >= USB_DT_ENDPOINT_AUDIO_SIZE &&
+                   (( is_playback && ep != (unsigned int)(get_endpoint(alts, 
0)->bSynchAddress | USB_DIR_IN)) ||
+                    (!is_playback && ep != (unsigned int)(get_endpoint(alts, 
0)->bSynchAddress & ~USB_DIR_IN)))) {
                        snd_printk(KERN_ERR "%d:%d:%d : invalid synch pipe\n",
                                   dev->devnum, fmt->iface, fmt->altsetting);
                        return -EINVAL;



-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
Alsa-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-cvslog

Reply via email to