icE1usb fw: Process read/write device requests separately
Signed-off-by: Sylvain Munaut <tnt@246tNt.com> Change-Id: I9a8fb3d6712c83f59e5e4cba8e0bcbd4d4f95eee
This commit is contained in:
parent
321b1c8694
commit
b722de7a2a
|
@ -21,13 +21,19 @@ const char *fw_build_str = BUILD_INFO;
|
|||
|
||||
|
||||
static enum usb_fnd_resp
|
||||
_usb_dev_ctrl_req(struct usb_ctrl_req *req, struct usb_xfer *xfer)
|
||||
_usb_dev_ctrl_req_write(struct usb_ctrl_req *req, struct usb_xfer *xfer)
|
||||
{
|
||||
/* Check it's a device-wide vendor request */
|
||||
if (USB_REQ_TYPE_RCPT(req) != (USB_REQ_TYPE_VENDOR | USB_REQ_RCPT_DEV))
|
||||
return USB_FND_CONTINUE;
|
||||
switch (req->bRequest) {
|
||||
default:
|
||||
return USB_FND_ERROR;
|
||||
}
|
||||
|
||||
/* Dispatch / Handle */
|
||||
return USB_FND_SUCCESS;
|
||||
}
|
||||
|
||||
static enum usb_fnd_resp
|
||||
_usb_dev_ctrl_req_read(struct usb_ctrl_req *req, struct usb_xfer *xfer)
|
||||
{
|
||||
switch (req->bRequest) {
|
||||
case ICE1USB_DEV_GET_CAPABILITIES:
|
||||
xfer->data[0] = (1 << ICE1USB_DEV_CAP_GPSDO);
|
||||
|
@ -44,6 +50,20 @@ _usb_dev_ctrl_req(struct usb_ctrl_req *req, struct usb_xfer *xfer)
|
|||
return USB_FND_SUCCESS;
|
||||
}
|
||||
|
||||
static enum usb_fnd_resp
|
||||
_usb_dev_ctrl_req(struct usb_ctrl_req *req, struct usb_xfer *xfer)
|
||||
{
|
||||
/* Check it's a device-wide vendor request */
|
||||
if (USB_REQ_TYPE_RCPT(req) != (USB_REQ_TYPE_VENDOR | USB_REQ_RCPT_DEV))
|
||||
return USB_FND_CONTINUE;
|
||||
|
||||
/* Read / Write dispatch */
|
||||
if (USB_REQ_IS_READ(req))
|
||||
return _usb_dev_ctrl_req_read(req, xfer);
|
||||
else
|
||||
return _usb_dev_ctrl_req_write(req, xfer);
|
||||
}
|
||||
|
||||
|
||||
static struct usb_fn_drv _dev_drv = {
|
||||
.ctrl_req = _usb_dev_ctrl_req,
|
||||
|
|
Loading…
Reference in New Issue