Changeset cf2ccd4 in mainline for uspace/drv/usbhid/usbhid.c


Ignore:
Timestamp:
2011-04-22T09:26:50Z (13 years ago)
Author:
Matej Klonfar <maklf@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
7304663
Parents:
1553cbf (diff), 1775ebc (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

new report structure and usbhid merge

File:
1 edited

Legend:

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

    r1553cbf rcf2ccd4  
    158158    const usb_hid_subdriver_mapping_t *mapping)
    159159{
    160         return false;
     160        assert(hid_dev != NULL);
     161        assert(hid_dev->usb_dev != NULL);
     162       
     163        return (hid_dev->usb_dev->descriptors.device.vendor_id
     164            == mapping->vendor_id
     165            && hid_dev->usb_dev->descriptors.device.product_id
     166            == mapping->product_id);
    161167}
    162168
     
    192198        }
    193199       
    194         assert(hid_dev->parser != NULL);
     200        assert(hid_dev->report != NULL);
    195201       
    196202        usb_log_debug("Compare flags: %d\n", mapping->compare);
    197         size_t size = usb_hid_report_input_length(hid_dev->parser, usage_path,
     203        size_t size = usb_hid_report_input_length(hid_dev->report, usage_path,
    198204            mapping->compare);
    199         usb_log_debug("Size of the input report: %d\n", size);
     205        usb_log_debug("Size of the input report: %zuB\n", size);
    200206       
    201207        usb_hid_report_path_free(usage_path);
     
    251257        while (count < USB_HID_MAX_SUBDRIVERS &&
    252258            (mapping->usage_path != NULL
    253             || mapping->vendor_id != 0 || mapping->product_id != 0)) {
     259            || mapping->vendor_id >= 0 || mapping->product_id >= 0)) {
    254260                // check the vendor & product ID
    255                 if (mapping->vendor_id != 0 && mapping->product_id == 0) {
    256                         usb_log_warning("Missing Product ID for Vendor ID %u\n",
     261                if (mapping->vendor_id >= 0 && mapping->product_id < 0) {
     262                        usb_log_warning("Missing Product ID for Vendor ID %d\n",
    257263                            mapping->vendor_id);
    258264                        return EINVAL;
    259265                }
    260                 if (mapping->product_id != 0 && mapping->vendor_id == 0) {
    261                         usb_log_warning("Missing Vendor ID for Product ID %u\n",
     266                if (mapping->product_id >= 0 && mapping->vendor_id < 0) {
     267                        usb_log_warning("Missing Vendor ID for Product ID %d\n",
    262268                            mapping->product_id);
    263269                        return EINVAL;
     
    267273                matched = false;
    268274               
    269                 if (mapping->vendor_id != 0) {
    270                         assert(mapping->product_id != 0);
     275                if (mapping->vendor_id >= 0) {
     276                        assert(mapping->product_id >= 0);
    271277                        usb_log_debug("Comparing device against vendor ID %u"
    272278                            " and product ID %u.\n", mapping->vendor_id,
     
    341347        }
    342348       
    343         hid_dev->parser = (usb_hid_report_t *)(malloc(sizeof(
     349        hid_dev->report = (usb_hid_report_t *)(malloc(sizeof(
    344350            usb_hid_report_t)));
    345         if (hid_dev->parser == NULL) {
     351        if (hid_dev->report == NULL) {
    346352                usb_log_fatal("No memory!\n");
    347353                free(hid_dev);
     
    385391        /* Get the report descriptor and parse it. */
    386392        rc = usb_hid_process_report_descriptor(hid_dev->usb_dev,
    387             hid_dev->parser);
     393            hid_dev->report);
    388394       
    389395        bool fallback = false;
     
    583589
    584590        // destroy the parser
    585         if ((*hid_dev)->parser != NULL) {
    586                 usb_hid_free_report((*hid_dev)->parser);
     591        if ((*hid_dev)->report != NULL) {
     592                usb_hid_free_report((*hid_dev)->report);
    587593        }
    588594
Note: See TracChangeset for help on using the changeset viewer.