Changeset d0a6e54 in mainline


Ignore:
Timestamp:
2011-04-21T17:16:53Z (13 years ago)
Author:
Lubos Slovak <lubos.slovak@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
3bcac68
Parents:
020559c9
Message:

Product and Vendor ID may be 0 - changed type to int.

Fixes #193

Location:
uspace/drv/usbhid
Files:
3 edited

Legend:

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

    r020559c9 rd0a6e54  
    5555                USB_HID_PATH_COMPARE_END
    5656                | USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY,
    57                 0,
    58                 0,
     57                -1,
     58                -1,
    5959                {
    6060                        .init = usb_kbd_init,
     
    7979                }
    8080        },
    81         {NULL, -1, 0, 0, 0, {NULL, NULL, NULL, NULL}}
     81        {NULL, -1, 0, -1, -1, {NULL, NULL, NULL, NULL}}
    8282};
    8383
  • uspace/drv/usbhid/subdrivers.h

    r020559c9 rd0a6e54  
    5656        int report_id;
    5757        int compare;
    58         uint16_t vendor_id;
    59         uint16_t product_id;
     58        int vendor_id;
     59        int product_id;
    6060        usb_hid_subdriver_t subdriver;
    6161} usb_hid_subdriver_mapping_t;
  • uspace/drv/usbhid/usbhid.c

    r020559c9 rd0a6e54  
    251251        while (count < USB_HID_MAX_SUBDRIVERS &&
    252252            (mapping->usage_path != NULL
    253             || mapping->vendor_id != 0 || mapping->product_id != 0)) {
     253            || mapping->vendor_id >= 0 || mapping->product_id >= 0)) {
    254254                // 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",
     255                if (mapping->vendor_id >= 0 && mapping->product_id < 0) {
     256                        usb_log_warning("Missing Product ID for Vendor ID %d\n",
    257257                            mapping->vendor_id);
    258258                        return EINVAL;
    259259                }
    260                 if (mapping->product_id != 0 && mapping->vendor_id == 0) {
    261                         usb_log_warning("Missing Vendor ID for Product ID %u\n",
     260                if (mapping->product_id >= 0 && mapping->vendor_id < 0) {
     261                        usb_log_warning("Missing Vendor ID for Product ID %d\n",
    262262                            mapping->product_id);
    263263                        return EINVAL;
     
    267267                matched = false;
    268268               
    269                 if (mapping->vendor_id != 0) {
    270                         assert(mapping->product_id != 0);
     269                if (mapping->vendor_id >= 0) {
     270                        assert(mapping->product_id >= 0);
    271271                        usb_log_debug("Comparing device against vendor ID %u"
    272272                            " and product ID %u.\n", mapping->vendor_id,
Note: See TracChangeset for help on using the changeset viewer.