Hi, On Wed, Oct 08, 2014 at 01:32:31PM +0200, Andrzej Pietrasiewicz wrote: > Some not-so-well-behaving USB hosts with a popular proprietary operating > system sometimes issue per-device requests even though they mean requests > for a particular function, e.g. for ptp (picture transfer protocol). which request would that be ? > This patch adds optional "for_device" function in usb_configuration so that > it can be used as the last fallback when handling unknown requests. If it > is not set then the composite_setup() behaviour remains unchanged. > > Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@xxxxxxxxxxx> > --- > drivers/usb/gadget/composite.c | 16 ++++++++++------ > include/linux/usb/composite.h | 1 + > 2 files changed, 11 insertions(+), 6 deletions(-) > > diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c > index 6178353..32b0104 100644 > --- a/drivers/usb/gadget/composite.c > +++ b/drivers/usb/gadget/composite.c > @@ -1785,12 +1785,16 @@ unknown: > } > > /* try the only function in the current config */ > - if (!list_is_singular(&c->functions)) > - goto done; > - f = list_first_entry(&c->functions, struct usb_function, > - list); > - if (f->setup) > - value = f->setup(f, ctrl); > + if (list_is_singular(&c->functions)) { > + f = list_first_entry(&c->functions, > + struct usb_function, list); > + if (f->setup) > + value = f->setup(f, ctrl); > + } else { > + f = c->for_device; > + if (f && f->setup) > + value = f->setup(f, ctrl); > + } instead, why don't you just list_for_each_entry() here ? -- balbi
Attachment:
signature.asc
Description: Digital signature