On Thu, 8 Dec 2011, Sebastian Andrzej Siewior wrote: > This patch adds sg support to dummy_hcd. It seems that uas is not able > to work with a hcd which does not support sg only based transfers. > > Signed-off-by: Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx> > --- > drivers/usb/gadget/dummy_hcd.c | 78 ++++++++++++++++++++++++++++++++++++---- > 1 files changed, 71 insertions(+), 7 deletions(-) > > diff --git a/drivers/usb/gadget/dummy_hcd.c b/drivers/usb/gadget/dummy_hcd.c > index bfba4aa..5ba8e18 100644 > --- a/drivers/usb/gadget/dummy_hcd.c > +++ b/drivers/usb/gadget/dummy_hcd.c > @@ -1140,21 +1142,82 @@ static int dummy_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status) > return rc; > } > > +static void forward_miter(struct sg_mapping_iter *miter, u32 bytes) > +{ > + u32 done = 0; > + > + /* press the forward button on the URB side */ > + if (!bytes) > + return; > + do { > + done += miter->length; > + if (bytes > done) { > + sg_miter_next(miter); > + continue; > + } > + if (bytes == done) > + break; > + > + miter->consumed = miter->length - (done - bytes); > + break; > + } while (1); > + sg_miter_next(miter); > +} This entire routine could be eliminated if you put the sg_mapping_iter thingy inside the urbp private structure. Don't start the iteration until you're ready to use it, of course. Alan Stern -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html