Changeset b5c92d7 in mainline


Ignore:
Timestamp:
2018-01-19T22:42:46Z (6 years ago)
Author:
Ondřej Hlavatý <aearsis@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
609f3f73
Parents:
4c03793
git-author:
Ondřej Hlavatý <aearsis@…> (2018-01-19 22:42:44)
git-committer:
Ondřej Hlavatý <aearsis@…> (2018-01-19 22:42:46)
Message:

libusbdev: pass correct endpoint index to reset endpoint

… and do not trust that the index is correct in libusbhost.

Location:
uspace/lib
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/usbdev/src/request.c

    r4c03793 rb5c92d7  
    843843                return EINVAL;
    844844        }
    845         return usb_request_clear_endpoint_halt(ctrl_pipe,
    846             target_pipe->desc.endpoint_no);
     845
     846        uint16_t index = target_pipe->desc.endpoint_no;
     847        index |= (target_pipe->desc.direction == USB_DIRECTION_IN) << 7;
     848        return usb_request_clear_endpoint_halt(ctrl_pipe, index);
    847849}
    848850
  • uspace/lib/usbhost/src/utility.c

    r4c03793 rb5c92d7  
    233233                if ((request->request_type == 0x2) &&
    234234                    (request->value == USB_FEATURE_ENDPOINT_HALT)) {
    235                         const unsigned index = uint16_usb2host(request->index);
    236                         const unsigned ep_num = index & 0xf;
     235                        const uint16_t index = uint16_usb2host(request->index);
     236                        const usb_endpoint_t ep_num = index & 0xf;
    237237                        const usb_direction_t dir = (index >> 7) ? USB_DIRECTION_IN : USB_DIRECTION_OUT;
    238238
    239239                        endpoint_t *ep = bus_find_endpoint(dev, ep_num, dir);
    240                         reset_cb(ep);
     240                        if (ep) {
     241                                reset_cb(ep);
     242                                endpoint_del_ref(ep);
     243                        } else {
     244                                usb_log_warning("Device(%u): Resetting unregistered endpoint %u %s.", dev->address, ep_num, usb_str_direction(dir));
     245                        }
    241246                }
    242247                break;
Note: See TracChangeset for help on using the changeset viewer.