Skip to content

Commit aecb67b

Browse files
xiaoguangwulijinxia
authored andcommitted
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>
1 parent 38e2e45 commit aecb67b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

devicemodel/hw/platform/usb_pmapper.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -634,15 +634,15 @@ usb_dev_request(void *pdata, struct usb_data_xfer *xfer)
634634
goto out;
635635

636636
switch (UREQ(request, request_type)) {
637-
case UREQ(UR_SET_ADDRESS, UT_READ_DEVICE):
637+
case UREQ(UR_SET_ADDRESS, UT_WRITE_DEVICE):
638638
UPRINTF(LDBG, "UR_SET_ADDRESS\n");
639639
udev->addr = value;
640640
goto out;
641-
case UREQ(UR_SET_CONFIG, UT_READ_DEVICE):
641+
case UREQ(UR_SET_CONFIG, UT_WRITE_DEVICE):
642642
UPRINTF(LDBG, "UR_SET_CONFIG\n");
643643
usb_dev_set_config(udev, xfer, value & 0xff);
644644
goto out;
645-
case UREQ(UR_SET_INTERFACE, UT_READ_INTERFACE):
645+
case UREQ(UR_SET_INTERFACE, UT_WRITE_INTERFACE):
646646
UPRINTF(LDBG, "UR_SET_INTERFACE\n");
647647
usb_dev_set_if(udev, index, value, xfer);
648648
goto out;

0 commit comments

Comments
 (0)