Changeset 1cbb4b7 in mainline for uspace/drv/usbhid/usbhid.c


Ignore:
Timestamp:
2011-04-10T18:28:45Z (13 years ago)
Author:
Lubos Slovak <lubos.slovak@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
777e336, c7bdfa7
Parents:
f76153ce
Message:

Fixed freeing of subdrivers + some debug output.

File:
1 edited

Legend:

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

    rf76153ce r1cbb4b7  
    171171        usb_hid_report_path_t *usage_path = usb_hid_report_path();
    172172        if (usage_path == NULL) {
     173                usb_log_debug("Failed to create usage path.\n");
    173174                return false;
    174175        }
     
    177178                if (usb_hid_report_path_append_item(usage_path,
    178179                    path[i].usage_page, path[i].usage) != EOK) {
     180                        usb_log_debug("Failed to append to usage path.\n");
    179181                        usb_hid_report_path_free(usage_path);
    180182                        return false;
     
    182184        }
    183185       
    184         bool matches = (usb_hid_report_input_length(hid_dev->parser, usage_path,
    185             compare) > 0);
     186        assert(hid_dev->parser != NULL);
     187       
     188        usb_log_debug("Compare flags: %d\n", compare);
     189        size_t size = usb_hid_report_input_length(hid_dev->parser, usage_path,
     190            compare);
     191        usb_log_debug("Size of the input report: %d\n", size);
    186192       
    187193        usb_hid_report_path_free(usage_path);
    188194       
    189         return matches;
     195        return (size > 0);
    190196}
    191197
     
    260266               
    261267                if (mapping->usage_path != NULL) {
     268                        usb_log_debug("Comparing device against usage path.\n");
    262269                        if (usb_hid_path_matches(hid_dev,
    263270                            mapping->usage_path, mapping->path_size,
    264271                            mapping->compare)) {
    265272                                subdrivers[count++] = &mapping->subdriver;
     273                        } else {
     274                                usb_log_debug("Not matched.\n");
    266275                        }
    267276                }
     
    552561        // free the subdrivers info
    553562        if ((*hid_dev)->subdrivers != NULL) {
    554                 free(subdrivers);
     563                free((*hid_dev)->subdrivers);
    555564        }
    556565
Note: See TracChangeset for help on using the changeset viewer.