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

Modified Files:
        usbaudio.inc usbaudio.inc1 usbmidi.c 
Log Message:
adjust usb_set_interface() wrapper for 2.6.5-rc2

Index: usbaudio.inc
===================================================================
RCS file: /cvsroot/alsa/alsa-driver/usb/usbaudio.inc,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- usbaudio.inc        10 Nov 2003 17:32:44 -0000      1.3
+++ usbaudio.inc        23 Mar 2004 12:48:18 -0000      1.4
@@ -1,8 +1,11 @@
 #include <linux/config.h>
 #include <linux/version.h>
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,5)
+#define SND_NEED_USB_SET_INTERFACE
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
 #define SND_NEED_USB_WRAPPER
+#endif
 #include <sound/driver.h>
 #include <linux/usb.h>
 #endif

Index: usbaudio.inc1
===================================================================
RCS file: /cvsroot/alsa/alsa-driver/usb/usbaudio.inc1,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- usbaudio.inc1       24 Sep 2003 16:45:10 -0000      1.4
+++ usbaudio.inc1       23 Mar 2004 12:48:18 -0000      1.5
@@ -84,17 +84,21 @@
                return -EINVAL;
        if (iface->num_altsetting == 1)
                return 0;
-       if (alternate < 0 || alternate >= iface->num_altsetting)
+
+       for (i = 0; i < iface->num_altsetting; ++i)
+               if (get_iface_desc(&iface->altsetting[i])->bAlternateSetting == 
alternate)
+                       break;
+       if (i >= iface->num_altsetting)
                return -EINVAL;
+       iface_as = &iface->altsetting[i];
 
        if ((ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
                                   USB_REQ_SET_INTERFACE, USB_RECIP_INTERFACE,
-                                  iface->altsetting[alternate].bAlternateSetting,
+                                  alternate,
                                   interface, NULL, 0, HZ * 5)) < 0)
                return ret;
 
        iface->act_altsetting = alternate;
-       iface_as = &iface->altsetting[alternate];
        for (i = 0; i < iface_as->bNumEndpoints; i++) {
                u8 ep = iface_as->endpoint[i].bEndpointAddress;
                usb_settoggle(dev, ep&USB_ENDPOINT_NUMBER_MASK, usb_endpoint_out(ep), 
0);
@@ -103,12 +107,30 @@
        return 0;
 }
 
-#endif /* LINUX_VERSION < 2.5.24 */
+#elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 5)
+
+/* map altsetting number to index */
+int snd_hack_usb_set_interface(struct usb_device *dev, int interface, int alternate)
+{
+       struct usb_interface *iface;
+       unsigned int i;
+
+       iface = usb_ifnum_to_if(dev, interface);
+       if (!iface)
+               return -EINVAL;
+       for (i = 0; i < iface->num_altsetting; ++i) {
+               if (get_iface_desc(&iface->altsetting[i])->bAlternateSetting == 
alternate)
+                       return real_usb_set_interface(dev, interface, i);
+       }
+       return -EINVAL;
+}
+
+#endif /* LINUX_VERSION < 2.6.5 */
 
 
 /*
  * symbols
  */
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 24)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 5)
 EXPORT_SYMBOL(snd_hack_usb_set_interface);
 #endif

Index: usbmidi.c
===================================================================
RCS file: /cvsroot/alsa/alsa-driver/usb/usbmidi.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- usbmidi.c   10 Nov 2003 17:32:45 -0000      1.11
+++ usbmidi.c   23 Mar 2004 12:48:18 -0000      1.12
@@ -1,8 +1,11 @@
 #include <linux/config.h>
 #include <linux/version.h>
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,5)
+#define SND_NEED_USB_SET_INTERFACE
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
 #define SND_NEED_USB_WRAPPER
+#endif
 #define __NO_VERSION__
 #include <sound/driver.h>
 #include <linux/usb.h>



-------------------------------------------------------
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