Changeset 4bb9fd2 in mainline


Ignore:
Timestamp:
2011-04-12T16:35:19Z (13 years ago)
Author:
Lubos Slovak <lubos.slovak@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
8f8f34ad
Parents:
caed7843
Message:

Improved matching of subdrivers.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/usbhid/usbhid.c

    rcaed7843 r4bb9fd2  
    238238        int i = 0, count = 0;
    239239        const usb_hid_subdriver_mapping_t *mapping = &usb_hid_subdrivers[i];
     240
     241        bool ids_matched;
     242        bool matched;
    240243       
    241244        while (count < USB_HID_MAX_SUBDRIVERS &&
     
    254257                }
    255258               
     259                ids_matched = false;
     260                matched = false;
     261               
    256262                if (mapping->vendor_id != 0) {
    257263                        assert(mapping->product_id != 0);
     
    260266                            mapping->product_id);
    261267                        if (usb_hid_ids_match(hid_dev, mapping)) {
    262                                 usb_log_debug("Matched.\n");
    263                                 subdrivers[count++] = &mapping->subdriver;
    264                                 // skip the checking of usage path
    265                                 goto next;
     268                                usb_log_debug("IDs matched.\n");
     269                                ids_matched = true;
    266270                        }
    267271                }
     
    271275                        if (usb_hid_path_matches(hid_dev,
    272276                            mapping->usage_path, mapping->compare)) {
    273                                 subdrivers[count++] = &mapping->subdriver;
    274                         } else {
    275                                 usb_log_debug("Not matched.\n");
     277                                // does not matter if IDs were matched
     278                                matched = true;
    276279                        }
    277                 }
    278         next:
     280                } else {
     281                        // matched only if IDs were matched and there is no path
     282                        matched = ids_matched;
     283                }
     284               
     285                if (matched) {
     286                        subdrivers[count++] = &mapping->subdriver;
     287                }
     288               
    279289                mapping = &usb_hid_subdrivers[++i];
    280290        }
Note: See TracChangeset for help on using the changeset viewer.