Hi, apologies for dropping a random question on you, but David Eriksson thought you may be able to give us a pointer about this.
We'd observed a few devices giving -100 errors on connection with the usb-rndis-lite module, and John Carr came up with the attached patch by comparing -lite to -ng. This seems to be very effective, but none of us are really device side developers, and John was never completely convinced this was correct. Quoting him from a while back.... "The reason I consider it dirty is that it needs the rndis_get_in_endpoint function which is called every time something calls rndis_command. Ideally that should run once when the driver loads for a given device, but i felt like i was being too invasive when I started doing that and whimped out. The patch exists through careful comparison of the deprecated user mode and the current kernel mode implementations of usb-rndis, the poking of an INT IN endpoint being the only difference i found." I'd love to get something based on this upstream, it's one of the few remaining bugbears for which we haven't pushed a fix to the kernel. Does this ring any bells with you ? Or does it even look sane ? Many thanks Mark
diff -Nurp usb-rndis-lite.bak/rndis_host.c usb-rndis-lite/rndis_host.c --- usb-rndis-lite.bak/rndis_host.c 2009-07-07 10:35:20.000000000 +0100 +++ usb-rndis-lite/rndis_host.c 2009-07-07 10:49:20.000000000 +0100 @@ -64,6 +64,25 @@ void rndis_status(struct usbnet *dev, st } EXPORT_SYMBOL_GPL(rndis_status); +/* Function ripped from keyspan_remote.c */ +static struct usb_endpoint_descriptor *rndis_get_in_endpoint(struct usb_host_interface *iface) +{ + + struct usb_endpoint_descriptor *endpoint; + int i; + + for (i = 0; i < iface->desc.bNumEndpoints; ++i) { + endpoint = &iface->endpoint[i].desc; + + if (usb_endpoint_is_int_in(endpoint)) { + /* we found our interrupt in endpoint */ + return endpoint; + } + } + + return NULL; +} + /* * RPC done RNDIS-style. Caller guarantees: * - message is properly byteswapped @@ -77,11 +96,14 @@ EXPORT_SYMBOL_GPL(rndis_status); int rndis_command(struct usbnet *dev, struct rndis_msg_hdr *buf, int buflen) { struct cdc_state *info = (void *) &dev->data; + struct usb_endpoint_descriptor *endpoint; int master_ifnum; int retval; unsigned count; __le32 rsp; u32 xid = 0, msg_len, request_id; + char int_buf[128]; + int maxp, pipe, partial; /* REVISIT when this gets called from contexts other than probe() or * disconnect(): either serialize, or dispatch responses on xid @@ -110,6 +132,29 @@ int rndis_command(struct usbnet *dev, st // we time out and cancel our "get response" requests... // so, this is fragile. Probably need to poll for status. + /* FIXME This feels rancid */ + endpoint = rndis_get_in_endpoint(info->control->cur_altsetting); + pipe = usb_rcvintpipe(dev->udev, endpoint->bEndpointAddress); + maxp = usb_maxpacket(dev->udev, pipe, usb_pipeout(pipe)); + + retval = usb_interrupt_msg(dev->udev, + pipe, + int_buf, + (maxp > 8 ? 8 : maxp), + &partial, + RNDIS_CONTROL_TIMEOUT_MS); + + dev_dbg(&info->control->dev, + "pipe: %d, maxp: %d, partial: %d, retval: %d\n", + pipe, + maxp, + partial, + retval); + + /* I /think/ usb_interrupt_msg blocks and returns < 0 for error */ + if (unlikely(retval < 0)) + return retval; + /* ignore status endpoint, just poll the control channel; * the request probably completed immediately */
signature.asc
Description: This is a digitally signed message part
------------------------------------------------------------------------------ This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers http://p.sf.net/sfu/verizon-dev2dev
_______________________________________________ SynCE-Devel mailing list SynCE-Devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/synce-devel