Changeset 1cbb4b7 in mainline


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.

Location:
uspace
Files:
3 edited

Legend:

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

    rf76153ce r1cbb4b7  
    3535
    3636#include "subdrivers.h"
     37#include "usb/classes/hidut.h"
    3738
    38 static usb_hid_subdriver_usage_t path_kbd[] = {{0, 7}};
     39static usb_hid_subdriver_usage_t path_kbd[] = {{USB_HIDUT_PAGE_KEYBOARD, 0}};
    3940
    4041const usb_hid_subdriver_mapping_t usb_hid_subdrivers[] = {
  • 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
  • uspace/lib/usb/src/hidparser.c

    rf76153ce r1cbb4b7  
    900900        item->usage_page = usage_page;
    901901       
     902        usb_log_debug("Appending usage %d, usage page %d\n", usage, usage_page);
     903       
    902904        list_append (&usage_path->link, &item->link);
    903905        usage_path->depth++;
Note: See TracChangeset for help on using the changeset viewer.