Update of /cvsroot/alsa/alsa-kernel/usb
In directory usw-pr-cvs1:/tmp/cvs-serv11208

Modified Files:
        usbaudio.c 
Log Message:
call usb_set_interface only once when the interface and altset
is reset or changed.



Index: usbaudio.c
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/usb/usbaudio.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- usbaudio.c  4 Oct 2002 16:05:17 -0000       1.17
+++ usbaudio.c  11 Oct 2002 11:31:44 -0000      1.18
@@ -957,6 +957,19 @@
        if (subs->interface >= 0 && subs->interface != fmt->iface) {
                usb_set_interface(subs->dev, subs->interface, 0);
                subs->interface = -1;
+               subs->format = 0;
+       }
+
+       /* set interface */
+       if (subs->interface != fmt->iface || subs->format != fmt->altset_idx) {
+               if (usb_set_interface(dev, fmt->iface, fmt->altset_idx) < 0) {
+                       snd_printk(KERN_ERR "%d:%d:%d: usb_set_interface failed\n",
+                                  dev->devnum, fmt->iface, fmt->altsetting);
+                       return -EIO;
+               }
+               snd_printdd(KERN_INFO "setting usb interface %d:%d\n", fmt->iface, 
+fmt->altset_idx);
+               subs->interface = fmt->iface;
+               subs->format = fmt->altset_idx;
        }
 
        /* create a data pipe */
@@ -965,7 +978,6 @@
                subs->datapipe = usb_sndisocpipe(dev, ep);
        else
                subs->datapipe = usb_rcvisocpipe(dev, ep);
-       subs->format = fmt->altset_idx;
        subs->syncpipe = subs->syncinterval = 0;
        subs->maxpacksize = alts->endpoint[0].wMaxPacketSize;
        subs->maxframesize = bytes_to_frames(runtime, subs->maxpacksize);
@@ -998,15 +1010,6 @@
                subs->syncinterval = alts->endpoint[1].bRefresh;
        }
 
-       /* set interface */
-       if (usb_set_interface(dev, fmt->iface, fmt->altset_idx) < 0) {
-               snd_printk(KERN_ERR "%d:%d:%d: usb_set_interface failed\n",
-                          dev->devnum, fmt->iface, fmt->altsetting);
-               return -EIO;
-       }
-       snd_printdd(KERN_INFO "setting usb interface %d:%d\n", fmt->iface, 
fmt->altset_idx);
-       subs->interface = fmt->iface;
-
        ep = alts->endpoint[0].bEndpointAddress;
        /* if endpoint has pitch control, enable it */
        if (fmt->attributes & EP_CS_ATTR_PITCH_CONTROL) {
@@ -1171,6 +1174,7 @@
        snd_usb_substream_t *subs = &as->substream[direction];
 
        subs->interface = -1;
+       subs->format = 0;
        runtime->hw = *hw;
        runtime->private_data = subs;
        subs->pcm_substream = substream;



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Alsa-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-cvslog

Reply via email to