Update of /cvsroot/alsa/alsa-driver/usb
In directory sc8-pr-cvs1:/tmp/cvs-serv501
Modified Files:
.cvsignore Makefile
Added Files:
usbaudio.inc usbaudio.inc1 usbaudio.patch
Removed Files:
usbaudio.c
Log Message:
2.5 cleanups
--- NEW FILE: usbaudio.inc ---
#define SND_NEED_USB_WRAPPER
#include <sound/driver.h>
#include <linux/usb.h>
#ifdef OLD_USB
#define snd_usb_complete_callback(x) __old_ ## x
static void __old_snd_complete_urb(struct urb *urb);
static void __old_snd_complete_sync_urb(struct urb *urb);
static void * usb_audio_probe(struct usb_device *dev, unsigned int ifnum,
const struct usb_device_id *id);
static void usb_audio_disconnect(struct usb_device *dev, void *ptr);
#endif
--- NEW FILE: usbaudio.inc1 ---
#ifdef OLD_USB
/*
* 2.4 USB kernel API
*/
static void *usb_audio_probe(struct usb_device *dev, unsigned int ifnum,
const struct usb_device_id *id)
{
return snd_usb_audio_probe(dev, usb_ifnum_to_if(dev, ifnum), id);
}
static void usb_audio_disconnect(struct usb_device *dev, void *ptr)
{
snd_usb_audio_disconnect(dev, ptr);
}
static void __old_snd_complete_urb(struct urb *urb)
{
snd_complete_urb(urb, NULL);
}
static void __old_snd_complete_sync_urb(struct urb *urb)
{
snd_complete_sync_urb(urb, NULL);
}
#endif
/*
* workarounds / hacks for the older kernels follow below
*/
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 24)
/* M-Audio Quattro has weird alternate settings. the altsetting jumps
* from 0 to 4 or 3 insuccessively, and this screws up
* usb_set_interface() (at least on 2.4.18/19 and 2.4.21).
*/
/*
* the following is a stripped version of usb_set_interface() with the fix
* for insuccessive altsetting numbers.
*/
/* stripped version for isochronos only */
static void hack_usb_set_maxpacket(struct usb_device *dev)
{
int i, b;
for (i=0; i<dev->actconfig->bNumInterfaces; i++) {
struct usb_interface *ifp = dev->actconfig->interface + i;
struct usb_interface_descriptor *as = ifp->altsetting +
ifp->act_altsetting;
struct usb_endpoint_descriptor *ep = as->endpoint;
int e;
for (e=0; e<as->bNumEndpoints; e++) {
b = ep[e].bEndpointAddress & USB_ENDPOINT_NUMBER_MASK;
if (usb_endpoint_out(ep[e].bEndpointAddress)) {
if (ep[e].wMaxPacketSize > dev->epmaxpacketout[b])
dev->epmaxpacketout[b] = ep[e].wMaxPacketSize;
}
else {
if (ep[e].wMaxPacketSize > dev->epmaxpacketin [b])
dev->epmaxpacketin [b] = ep[e].wMaxPacketSize;
}
}
}
}
/* stripped version */
int snd_hack_usb_set_interface(struct usb_device *dev, int interface, int alternate)
{
struct usb_interface *iface;
struct usb_interface_descriptor *iface_as;
int i, ret;
iface = usb_ifnum_to_if(dev, interface);
if (!iface)
return -EINVAL;
if (iface->num_altsetting == 1)
return 0;
if (alternate < 0 || alternate >= iface->num_altsetting)
return -EINVAL;
if ((ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
USB_REQ_SET_INTERFACE, USB_RECIP_INTERFACE,
iface->altsetting[alternate].bAlternateSetting,
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);
}
hack_usb_set_maxpacket(dev);
return 0;
}
#endif /* LINUX_VERSION < 2.5.24 */
/*
* symbols
*/
EXPORT_NO_SYMBOLS;
--- NEW FILE: usbaudio.patch ---
--- usbaudio.c 2003-06-01 20:32:24.000000000 +0200
+++ usbaudio.c.old 2003-06-01 20:32:42.000000000 +0200
@@ -1,3 +1,4 @@
+#include "usbaudio.inc"
/*
* (Tentative) USB Audio Driver for ALSA
*
@@ -1656,9 +1657,11 @@
* entry point for linux usb interface
*/
+#ifndef OLD_USB
static int usb_audio_probe(struct usb_interface *intf,
const struct usb_device_id *id);
static void usb_audio_disconnect(struct usb_interface *intf);
+#endif
static struct usb_device_id usb_audio_ids [] = {
#include "usbquirks.h"
@@ -1671,10 +1674,15 @@
MODULE_DEVICE_TABLE (usb, usb_audio_ids);
static struct usb_driver usb_audio_driver = {
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 70) /* FIXME: find right number */
.owner = THIS_MODULE,
+#endif
.name = "snd-usb-audio",
.probe = usb_audio_probe,
.disconnect = usb_audio_disconnect,
+#ifdef OLD_USB
+ .driver_list = LIST_HEAD_INIT(usb_audio_driver.driver_list),
+#endif
.id_table = usb_audio_ids,
};
@@ -2744,6 +2752,7 @@
}
}
+#ifndef OLD_USB
/*
* new 2.5 USB kernel API
*/
@@ -2764,6 +2773,8 @@
snd_usb_audio_disconnect(interface_to_usbdev(intf),
dev_get_drvdata(&intf->dev));
}
+#endif
+
static int __init snd_usb_audio_init(void)
@@ -2803,3 +2814,5 @@
__setup("snd-usb-audio=", snd_usb_audio_module_setup);
#endif /* !MODULE */
+
+#include "usbaudio.inc1"
Index: .cvsignore
===================================================================
RCS file: /cvsroot/alsa/alsa-driver/usb/.cvsignore,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- .cvsignore 4 Jun 2002 15:49:13 -0000 1.1
+++ .cvsignore 1 Jun 2003 18:37:45 -0000 1.2
@@ -1 +1,2 @@
.depend
+usbaudio.c
Index: Makefile
===================================================================
RCS file: /cvsroot/alsa/alsa-driver/usb/Makefile,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- Makefile 8 Mar 2003 14:23:04 -0000 1.7
+++ Makefile 1 Jun 2003 18:37:45 -0000 1.8
@@ -3,6 +3,8 @@
include $(TOPDIR)/toplevel.config
include $(TOPDIR)/Makefile.conf
+EXTRA_CLEAN = usbaudio.c
+
TOPDIR = $(MAINSRCDIR)
# for compatibility
@@ -10,4 +12,8 @@
include $(TOPDIR)/alsa-kernel/usb/Makefile
+EXTRA_CFLAGS = -I$(TOPDIR)/alsa-kernel/usb
+
include $(TOPDIR)/Rules.make
+
+usbaudio.c: usbaudio.patch usbaudio.inc usbaudio.inc1
$(TOPDIR)/alsa-kernel/usb/usbaudio.c
--- usbaudio.c DELETED ---
-------------------------------------------------------
This SF.net email is sponsored by: eBay
Get office equipment for less on eBay!
http://adfarm.mediaplex.com/ad/ck/711-11697-6916-5
_______________________________________________
Alsa-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-cvslog