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


Ignore:
Timestamp:
2011-04-12T19:00:00Z (14 years ago)
Author:
Lubos Slovak <lubos.slovak@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
11d2e96a, c7dd69d
Parents:
a6610d4
Message:

Report IDs in subdriver mappings, sample driver for Logitech kbd

File:
1 edited

Legend:

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

    ra6610d4 re3b5129  
    164164
    165165static bool usb_hid_path_matches(usb_hid_dev_t *hid_dev,
    166     const usb_hid_subdriver_usage_t *path, int compare)
     166    const usb_hid_subdriver_mapping_t *mapping)
    167167{
    168168        assert(hid_dev != NULL);
    169         assert(path != NULL);
     169        assert(mapping != NULL);
    170170       
    171171        usb_hid_report_path_t *usage_path = usb_hid_report_path();
     
    175175        }
    176176        int i = 0;
    177         while (path[i].usage != 0 || path[i].usage_page != 0) {
     177        while (mapping->usage_path[i].usage != 0
     178            || mapping->usage_path[i].usage_page != 0) {
    178179                if (usb_hid_report_path_append_item(usage_path,
    179                     path[i].usage_page, path[i].usage) != EOK) {
     180                    mapping->usage_path[i].usage_page,
     181                    mapping->usage_path[i].usage) != EOK) {
    180182                        usb_log_debug("Failed to append to usage path.\n");
    181183                        usb_hid_report_path_free(usage_path);
     
    185187        }
    186188       
     189        if (mapping->report_id >= 0) {
     190                usb_hid_report_path_set_report_id(usage_path,
     191                    mapping->report_id);
     192        }
     193       
    187194        assert(hid_dev->parser != NULL);
    188195       
    189         usb_log_debug("Compare flags: %d\n", compare);
     196        usb_log_debug("Compare flags: %d\n", mapping->compare);
    190197        size_t size = usb_hid_report_input_length(hid_dev->parser, usage_path,
    191             compare);
     198            mapping->compare);
    192199        usb_log_debug("Size of the input report: %d\n", size);
    193200       
     
    273280                if (mapping->usage_path != NULL) {
    274281                        usb_log_debug("Comparing device against usage path.\n");
    275                         if (usb_hid_path_matches(hid_dev,
    276                             mapping->usage_path, mapping->compare)) {
     282                        if (usb_hid_path_matches(hid_dev, mapping)) {
    277283                                // does not matter if IDs were matched
    278284                                matched = true;
Note: See TracChangeset for help on using the changeset viewer.