aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgermeier <germeier>2003-03-22 15:09:14 +0000
committergermeier <germeier>2003-03-22 15:09:14 +0000
commitfdb8ac63647bcb08a7c5cce12cb075c0a1b1db8b (patch)
tree0aa4720d5fbcc769bd5cd6c577852d4132722e67
parent3bb2564b5112878aff0ea4de28b1ecbddce6cbad (diff)
downloadmpiosh-fdb8ac63647bcb08a7c5cce12cb075c0a1b1db8b.tar.gz
mpiosh-fdb8ac63647bcb08a7c5cce12cb075c0a1b1db8b.tar.bz2
mpiosh-fdb8ac63647bcb08a7c5cce12cb075c0a1b1db8b.zip
automagically find USB bulk endpoints in kernel driver
-rw-r--r--ChangeLog5
-rw-r--r--kernel/mpio.c40
2 files changed, 40 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 43de53c..d03dfb6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2003-03-22 Markus Germeier <mager@tzi.de>
+
+ * kernel/mpio.c (probe_mpio, write_mpio, read_mpio):
+ automagically find USB bulk endpoints and use them
+
2003-03-15 Markus Germeier <mager@tzi.de>
* libmpio/mpio.c (mpio_init_internal): detect up to four
diff --git a/kernel/mpio.c b/kernel/mpio.c
index dedc4ca..d1e5440 100644
--- a/kernel/mpio.c
+++ b/kernel/mpio.c
@@ -5,8 +5,9 @@
*
* Yuji Touya (salmoon@users.sourceforge.net)
*
- * small adaptions for Kernel 2.4.x support by
- * Markus Germeier (mager@tzi.de)
+ * additions by Markus Germeier (mager@tzi.de):
+ * - small adaptions for Kernel 2.4.x support
+ * - find endpoints automagically (needed for newer players)
*
* based on rio500.c by Cesar Miquel (miquel@df.uba.ar)
*
@@ -57,7 +58,7 @@
/*
* Version Information
*/
-#define DRIVER_VERSION "0.0.2"
+#define DRIVER_VERSION "0.0.3"
#define DRIVER_AUTHOR "Yuji Touya <salmoon@users.sourceforge.net>"
#define DRIVER_DESC "USB MPIO driver"
@@ -165,7 +166,8 @@ write_mpio(struct file *file, const char *buffer, size_t count, loff_t * ppos)
result =
usb_bulk_msg(mpio->mpio_dev,
- usb_sndbulkpipe(mpio->mpio_dev, 1),
+ usb_sndbulkpipe(mpio->mpio_dev,
+ mpio->bulk_out_ep),
obuf, thistime, &partial, 5 * HZ);
dbg("write stats: result:%d thistime:%lu partial:%u",
@@ -236,7 +238,8 @@ read_mpio(struct file *file, char *buffer, size_t count, loff_t * ppos)
this_read = (count >= IBUF_SIZE) ? IBUF_SIZE : count;
result = usb_bulk_msg(mpio->mpio_dev,
- usb_rcvbulkpipe(mpio->mpio_dev, 2),
+ usb_rcvbulkpipe(mpio->mpio_dev,
+ mpio->bulk_in_ep),
ibuf, this_read, &partial,
(int) (HZ * 8));
@@ -296,6 +299,9 @@ static void *probe_mpio(struct usb_device *dev, unsigned int ifnum)
#endif
{
struct mpio_usb_data *mpio = &mpio_instance;
+ struct usb_interface_descriptor *as;
+ struct usb_endpoint_descriptor *ep;
+ int i;
if (dev->descriptor.idVendor != 0x2735 /* Digit@lway */ ) {
return NULL;
@@ -307,6 +313,30 @@ static void *probe_mpio(struct usb_device *dev, unsigned int ifnum)
}
info("USB MPIO found at address %d", dev->devnum);
+
+ as = dev->config->interface->altsetting;
+ mpio->bulk_in_ep = mpio->bulk_out_ep = 0;
+
+ for (i = 0 ; i < as->bNumEndpoints; i++) {
+ ep = &as->endpoint[i];
+ info("USB endpoint #%d (Addr:%02x, Attr:%02x)", i,
+ ep->bEndpointAddress, ep->bmAttributes);
+ if (ep->bmAttributes == 2) {
+ if (ep->bEndpointAddress & USB_DIR_IN) {
+ info("FOUND incoming USB endpoint (%02x)", ep->bEndpointAddress);
+ mpio->bulk_in_ep = ep->bEndpointAddress & ~(USB_DIR_IN);
+ } else {
+ info("FOUND outgoing USB endpoint (%02x)", ep->bEndpointAddress);
+ mpio->bulk_out_ep = ep->bEndpointAddress;
+ }
+ }
+ }
+
+ if (!(mpio->bulk_out_ep && mpio->bulk_in_ep)) {
+ info("Did not find USB bulk endpoints");
+ return NULL;
+ }
+
#ifdef DEBUG
usb_show_device(dev); /* Show device info */
#endif