DM USB: support multiple interfaces USB device

This patch correct the USB request type which set wrong direction in
original code. It caused these important usb control transfer packets
send to phsical USB devices via libusb_control_transfer instead of
calling standard libusb APIs, likes libusb_set_configuration. From
libusb document, this is not the correct way:

"You should always use this function rather than formulating your own
SET_CONFIGURATION control request. This is because the underlying
operating system needs to know when such changes happen."

Change-Id: I7a6aade326220bee3b685086584920dacd37f87c
Signed-off-by: Xiaoguang Wu <xiaoguang.wu@intel.com>
Reviewed-by: Liang Yang <liang3.yang@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
This commit is contained in:
Xiaoguang Wu 2018-07-11 14:21:38 +08:00 committed by lijinxia
parent 38e2e45d83
commit aecb67bcea
1 changed files with 3 additions and 3 deletions

View File

@ -634,15 +634,15 @@ usb_dev_request(void *pdata, struct usb_data_xfer *xfer)
goto out;
switch (UREQ(request, request_type)) {
case UREQ(UR_SET_ADDRESS, UT_READ_DEVICE):
case UREQ(UR_SET_ADDRESS, UT_WRITE_DEVICE):
UPRINTF(LDBG, "UR_SET_ADDRESS\n");
udev->addr = value;
goto out;
case UREQ(UR_SET_CONFIG, UT_READ_DEVICE):
case UREQ(UR_SET_CONFIG, UT_WRITE_DEVICE):
UPRINTF(LDBG, "UR_SET_CONFIG\n");
usb_dev_set_config(udev, xfer, value & 0xff);
goto out;
case UREQ(UR_SET_INTERFACE, UT_READ_INTERFACE):
case UREQ(UR_SET_INTERFACE, UT_WRITE_INTERFACE):
UPRINTF(LDBG, "UR_SET_INTERFACE\n");
usb_dev_set_if(udev, index, value, xfer);
goto out;