Re: [PATCH v2 RESEND] usb:gadget:hid: {GET,SET} PROCOTOL Support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jul 18, 2017 at 10:17:24PM +0200, Greg KH wrote:
> On Tue, Jul 18, 2017 at 08:47:58PM +0100, Abdulhadi Mohamed wrote:
> > The current HID function driver doesn't support GET_PROCOTOL and
> > SET_PROCOTOL commands, which are required to operate the HID gadgets in
> > BOOT mode. This patch implements this feature for devices that have
> > the same implementation for REPORT and BOOT mode so that these 
> > devices are recognized by older BIOSes. 
> > 
> > Signed-off-by: Abdulhadi Mohamed <abdulahhadi2@xxxxxxxxx>
> 
> Any reason you didn't cc: the correct maintainers as well?
> scripts/get_maintainer.pl will tell you who to contact...
> 

Good point, I've looped them back in. 

> > 
> > ---
> >  drivers/usb/gadget/function/f_hid.c | 17 ++++++++++++++++-
> >  include/linux/hid.h                 |  6 ++++++
> >  2 files changed, 22 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/usb/gadget/function/f_hid.c b/drivers/usb/gadget/function/f_hid.c
> > index 5eea448..c60b882 100644
> > --- a/drivers/usb/gadget/function/f_hid.c
> > +++ b/drivers/usb/gadget/function/f_hid.c
> > @@ -44,6 +44,7 @@ struct f_hidg {
> >         /* configuration */
> >         unsigned char                   bInterfaceSubClass;
> >         unsigned char                   bInterfaceProtocol;
> > +       unsigned char                   protocol;
> >         unsigned short                  report_desc_length;
> >         char                            *report_desc;
> >         unsigned short                  report_length;
> > @@ -527,7 +528,9 @@ static int hidg_setup(struct usb_function *f,
> >         case ((USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE) << 8
> >                   | HID_REQ_GET_PROTOCOL):
> >                 VDBG(cdev, "get_protocol\n");
> > -               goto stall;
> > +               length = min_t(unsigned, length, 1);
> > +               ((u8 *) req->buf)[0] = hidg->protocol;
> > +               goto respond;
> >                 break;
> > 
> >         case ((USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE) << 8
> > @@ -539,6 +542,17 @@ static int hidg_setup(struct usb_function *f,
> >         case ((USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE) << 8
> >                   | HID_REQ_SET_PROTOCOL):
> >                 VDBG(cdev, "set_protocol\n");
> > +               if (value > HID_REPORT_PROTOCOL)
> > +                       goto stall;
> > +               length = 0;
> > +               /*
> > +                * We assume that programs implementing the Boot protocol
> > +                * are also compatible with the Report Protocol
> > +                */
> > +               if(hidg->bInterfaceSubClass == USB_INTERFACE_SUBCLASS_BOOT) {
> > +                       hidg->protocol = value;
> > +                       goto respond;
> > +               }
> 
> Always use scripts/checkpatch.pl on your patches so you do not get
> grumpy maintainers telling you to use scripts/checkpatch.pl on your
> patches...
> 
--
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



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux