Changeset 18cb870 in mainline


Ignore:
Timestamp:
2011-02-20T17:02:09Z (14 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
8ba18c6
Parents:
27a0012
Message:

Extend pipe initialization with interface number

Location:
uspace/lib/usb
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/usb/include/usb/pipes.h

    r27a0012 r18cb870  
    107107        /** Endpoint description. */
    108108        const usb_endpoint_description_t *description;
     109        /** Interface number the endpoint must belong to (-1 for any). */
     110        const int interface_no;
    109111        /** Found descriptor fitting the description. */
    110112        usb_standard_endpoint_descriptor_t *descriptor;
  • uspace/lib/usb/src/pipesinit.c

    r27a0012 r18cb870  
    109109 * @param mapping_count Number of endpoint mappings in @p mapping.
    110110 * @param found_endpoint Description of found endpoint.
     111 * @param interface_number Number of currently processed interface.
    111112 * @return Endpoint mapping corresponding to @p found_endpoint.
    112113 * @retval NULL No corresponding endpoint found.
     
    114115static usb_endpoint_mapping_t *find_endpoint_mapping(
    115116    usb_endpoint_mapping_t *mapping, size_t mapping_count,
    116     usb_endpoint_description_t *found_endpoint)
     117    usb_endpoint_description_t *found_endpoint,
     118    int interface_number)
    117119{
    118120        while (mapping_count > 0) {
    119                 if (endpoint_fits_description(mapping->description,
    120                     found_endpoint)) {
     121                bool interface_number_fits = (mapping->interface_no < 0)
     122                    || (mapping->interface_no == interface_number);
     123
     124                bool endpoint_descriptions_fits = endpoint_fits_description(
     125                    mapping->description, found_endpoint);
     126
     127                if (interface_number_fits && endpoint_descriptions_fits) {
    121128                        return mapping;
    122129                }
     
    169176         */
    170177        usb_endpoint_mapping_t *ep_mapping = find_endpoint_mapping(mapping,
    171             mapping_count, &description);
     178            mapping_count, &description, interface->interface_number);
    172179        if (ep_mapping == NULL) {
    173180                return ENOENT;
Note: See TracChangeset for help on using the changeset viewer.