From 54dfce6d07b0391e23d006579bba488de4f7d6aa Mon Sep 17 00:00:00 2001 From: Felix Hädicke Date: Wed, 22 Jun 2016 01:12:07 +0200 Subject: usb: gadget: f_fs: handle control requests not directed to interface or endpoint MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Introduces a new FunctionFS descriptor flag named FUNCTIONFS_ALL_CTRL_RECIP. When this flag is enabled, control requests, which are not explicitly directed to an interface or endpoint, can be handled. This allows FunctionFS userspace drivers to process non-standard control requests. Signed-off-by: Felix Hädicke Signed-off-by: Felipe Balbi --- include/uapi/linux/usb/functionfs.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include/uapi/linux/usb/functionfs.h') diff --git a/include/uapi/linux/usb/functionfs.h b/include/uapi/linux/usb/functionfs.h index 108dd7997014..93da4ca82dc7 100644 --- a/include/uapi/linux/usb/functionfs.h +++ b/include/uapi/linux/usb/functionfs.h @@ -21,6 +21,7 @@ enum functionfs_flags { FUNCTIONFS_HAS_MS_OS_DESC = 8, FUNCTIONFS_VIRTUAL_ADDR = 16, FUNCTIONFS_EVENTFD = 32, + FUNCTIONFS_ALL_CTRL_RECIP = 64, }; /* Descriptor of an non-audio endpoint */ -- cgit From 4368c28ae7acb0744968e58c81be561b44aacd57 Mon Sep 17 00:00:00 2001 From: Felix Hädicke Date: Wed, 22 Jun 2016 01:12:09 +0200 Subject: usb: gadget: f_fs: handle control requests in config 0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Introduces a new FunctionFS descriptor flag named FUNCTIONFS_CONFIG0_SETUP. When this flag is enabled, FunctionFS userspace drivers can process non-standard control requests in configuration 0. Signed-off-by: Felix Hädicke Signed-off-by: Felipe Balbi --- drivers/usb/gadget/function/f_fs.c | 5 +++-- include/uapi/linux/usb/functionfs.h | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'include/uapi/linux/usb/functionfs.h') diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c index d8f46f6233ac..998697bd80ac 100644 --- a/drivers/usb/gadget/function/f_fs.c +++ b/drivers/usb/gadget/function/f_fs.c @@ -2247,7 +2247,8 @@ static int __ffs_data_got_descs(struct ffs_data *ffs, FUNCTIONFS_HAS_MS_OS_DESC | FUNCTIONFS_VIRTUAL_ADDR | FUNCTIONFS_EVENTFD | - FUNCTIONFS_ALL_CTRL_RECIP)) { + FUNCTIONFS_ALL_CTRL_RECIP | + FUNCTIONFS_CONFIG0_SETUP)) { ret = -ENOSYS; goto error; } @@ -3142,7 +3143,7 @@ static bool ffs_func_req_match(struct usb_function *f, { struct ffs_function *func = ffs_func_from_usb(f); - if (config0) + if (config0 && !(func->ffs->user_flags & FUNCTIONFS_CONFIG0_SETUP)) return false; switch (creq->bRequestType & USB_RECIP_MASK) { diff --git a/include/uapi/linux/usb/functionfs.h b/include/uapi/linux/usb/functionfs.h index 93da4ca82dc7..acc63697a0cc 100644 --- a/include/uapi/linux/usb/functionfs.h +++ b/include/uapi/linux/usb/functionfs.h @@ -22,6 +22,7 @@ enum functionfs_flags { FUNCTIONFS_VIRTUAL_ADDR = 16, FUNCTIONFS_EVENTFD = 32, FUNCTIONFS_ALL_CTRL_RECIP = 64, + FUNCTIONFS_CONFIG0_SETUP = 128, }; /* Descriptor of an non-audio endpoint */ -- cgit