Commit 4368c28a authored by Felix Hädicke's avatar Felix Hädicke Committed by Felipe Balbi

usb: gadget: f_fs: handle control requests in config 0

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: default avatarFelix Hädicke <felixhaedicke@web.de>
Signed-off-by: default avatarFelipe Balbi <felipe.balbi@linux.intel.com>
parent 1a00b457
...@@ -2247,7 +2247,8 @@ static int __ffs_data_got_descs(struct ffs_data *ffs, ...@@ -2247,7 +2247,8 @@ static int __ffs_data_got_descs(struct ffs_data *ffs,
FUNCTIONFS_HAS_MS_OS_DESC | FUNCTIONFS_HAS_MS_OS_DESC |
FUNCTIONFS_VIRTUAL_ADDR | FUNCTIONFS_VIRTUAL_ADDR |
FUNCTIONFS_EVENTFD | FUNCTIONFS_EVENTFD |
FUNCTIONFS_ALL_CTRL_RECIP)) { FUNCTIONFS_ALL_CTRL_RECIP |
FUNCTIONFS_CONFIG0_SETUP)) {
ret = -ENOSYS; ret = -ENOSYS;
goto error; goto error;
} }
...@@ -3142,7 +3143,7 @@ static bool ffs_func_req_match(struct usb_function *f, ...@@ -3142,7 +3143,7 @@ static bool ffs_func_req_match(struct usb_function *f,
{ {
struct ffs_function *func = ffs_func_from_usb(f); struct ffs_function *func = ffs_func_from_usb(f);
if (config0) if (config0 && !(func->ffs->user_flags & FUNCTIONFS_CONFIG0_SETUP))
return false; return false;
switch (creq->bRequestType & USB_RECIP_MASK) { switch (creq->bRequestType & USB_RECIP_MASK) {
......
...@@ -22,6 +22,7 @@ enum functionfs_flags { ...@@ -22,6 +22,7 @@ enum functionfs_flags {
FUNCTIONFS_VIRTUAL_ADDR = 16, FUNCTIONFS_VIRTUAL_ADDR = 16,
FUNCTIONFS_EVENTFD = 32, FUNCTIONFS_EVENTFD = 32,
FUNCTIONFS_ALL_CTRL_RECIP = 64, FUNCTIONFS_ALL_CTRL_RECIP = 64,
FUNCTIONFS_CONFIG0_SETUP = 128,
}; };
/* Descriptor of an non-audio endpoint */ /* Descriptor of an non-audio endpoint */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment