Skip to content

Commit 292d2c8

Browse files
thejhgregkh
authored andcommitted
usb: raw-gadget: fix handling of dual-direction-capable endpoints
Under dummy_hcd, every available endpoint is *either* IN or OUT capable. But with some real hardware, there are endpoints that support both IN and OUT. In particular, the PLX 2380 has four available endpoints that each support both IN and OUT. raw-gadget currently gets confused and thinks that any endpoint that is usable as an IN endpoint can never be used as an OUT endpoint. Fix it by looking at the direction in the configured endpoint descriptor instead of looking at the hardware capabilities. With this change, I can use the PLX 2380 with raw-gadget. Fixes: f2c2e71 ("usb: gadget: add raw-gadget interface") Cc: stable <[email protected]> Tested-by: Andrey Konovalov <[email protected]> Reviewed-by: Andrey Konovalov <[email protected]> Signed-off-by: Jann Horn <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 5c2b9c6 commit 292d2c8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/usb/gadget/legacy/raw_gadget.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1004,7 +1004,7 @@ static int raw_process_ep_io(struct raw_dev *dev, struct usb_raw_ep_io *io,
10041004
ret = -EBUSY;
10051005
goto out_unlock;
10061006
}
1007-
if ((in && !ep->ep->caps.dir_in) || (!in && ep->ep->caps.dir_in)) {
1007+
if (in != usb_endpoint_dir_in(ep->ep->desc)) {
10081008
dev_dbg(&dev->gadget->dev, "fail, wrong direction\n");
10091009
ret = -EINVAL;
10101010
goto out_unlock;

0 commit comments

Comments
 (0)