Changeset b3c39690 in mainline for uspace/drv/bus/usb/usbdiag/device.c


Ignore:
Timestamp:
2018-01-21T23:19:20Z (8 years ago)
Author:
Ondřej Hlavatý <aearsis@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
db51a6a6
Parents:
09187c6e
git-author:
Ondřej Hlavatý <aearsis@…> (2018-01-21 23:19:14)
git-committer:
Ondřej Hlavatý <aearsis@…> (2018-01-21 23:19:20)
Message:

usb: remove misleading usb_device_get_mapped_ep

Even though this method may seem very convenient to use, it's actually
wrong. The devices are usually not required to have strict endpoint
numbers. That's why the mapping mechanism exists. Therefore, it's just
not possible to rely on fixed endpoint mapping.

There could be similar method, that would take the transfer type and
direction, but it's much better to ask for the complete mapping then.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/usbdiag/device.c

    r09187c6e rb3c39690  
    6464};
    6565
    66 static int device_init(usbdiag_dev_t *dev)
     66static int device_init(usbdiag_dev_t *dev, const usb_endpoint_description_t **endpoints)
    6767{
    6868        int rc;
     
    7777
    7878#define _MAP_EP(target, ep_no) do {\
    79         usb_endpoint_mapping_t *epm = usb_device_get_mapped_ep(dev->usb_dev, USBDIAG_EP_##ep_no);\
     79        usb_endpoint_mapping_t *epm = usb_device_get_mapped_ep_desc(dev->usb_dev, endpoints[USBDIAG_EP_##ep_no]);\
    8080        if (!epm || !epm->present) {\
    8181                usb_log_error("Failed to map endpoint: " #ep_no ".");\
     
    108108}
    109109
    110 int usbdiag_dev_create(usb_device_t *dev, usbdiag_dev_t **out_diag_dev)
     110int usbdiag_dev_create(usb_device_t *dev, usbdiag_dev_t **out_diag_dev, const usb_endpoint_description_t **endpoints)
    111111{
    112112        assert(dev);
     
    120120
    121121        int err;
    122         if ((err = device_init(diag_dev)))
     122        if ((err = device_init(diag_dev, endpoints)))
    123123                goto err_init;
    124124
Note: See TracChangeset for help on using the changeset viewer.