Changeset f3f9733 in mainline


Ignore:
Timestamp:
2011-05-30T14:35:40Z (13 years ago)
Author:
Lubos Slovak <lubos.slovak@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
1aba480, 2176ed6
Parents:
b9e3aa3
Message:

Modified subdriver matching with report IDs

File:
1 edited

Legend:

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

    rb9e3aa3 rf3f9733  
    206206        }
    207207       
    208         if (mapping->report_id >= 0) {
    209                 usb_hid_report_path_set_report_id(usage_path,
    210                     mapping->report_id);
    211         }
     208//      if (mapping->report_id >= 0) {
     209//              usb_hid_report_path_set_report_id(usage_path,
     210//                  mapping->report_id);
     211//      }
    212212       
    213213        assert(hid_dev->report != NULL);
     
    216216//      size_t size = usb_hid_report_size(hid_dev->report, 0,
    217217//          USB_HID_REPORT_TYPE_INPUT);
    218         size_t size = 0;
    219 
    220         usb_hid_report_description_t *report_des =
    221                 usb_hid_report_find_description(hid_dev->report,
    222                 mapping->report_id, USB_HID_REPORT_TYPE_INPUT);
    223 
    224         while(report_des != NULL) {
    225 
    226                 if((mapping->report_id) == 0 && (report_des->report_id != 0)) {
     218//      size_t size = 0;
     219       
     220        bool matches = false;
     221
     222//      usb_hid_report_description_t *report_des =
     223//              usb_hid_report_find_description(hid_dev->report,
     224//              mapping->report_id, USB_HID_REPORT_TYPE_INPUT);
     225        uint8_t report_id = mapping->report_id;
     226
     227        /*while(report_des != NULL)*/do {
     228
     229//              if((mapping->report_id) == 0 && (report_des->report_id != 0)) {
     230//                      usb_hid_report_path_set_report_id(usage_path,
     231//                              report_des->report_id);
     232//              }
     233                                             
     234                usb_log_debug("Trying report id %u\n", report_id);
     235               
     236                if (report_id != 0) {
    227237                        usb_hid_report_path_set_report_id(usage_path,
    228                                 report_des->report_id);
    229                 }
    230 
    231                 usb_hid_report_field_t *field = usb_hid_report_get_sibling (
    232                         hid_dev->report,
    233                         NULL, usage_path, mapping->compare,
    234                         USB_HID_REPORT_TYPE_INPUT);
    235 
    236                 while(field != NULL) {
    237                         size++;
    238                         field = usb_hid_report_get_sibling (hid_dev->report,
    239                                         field, usage_path, mapping->compare,
    240                             USB_HID_REPORT_TYPE_INPUT);
    241                 }
    242 
    243                 if((mapping->report_id == 0) && (report_des->report_id != 0)) {
    244                         uint8_t report_id = usb_hid_get_next_report_id(
    245                                 hid_dev->report, report_des->report_id,
    246                                 USB_HID_REPORT_TYPE_INPUT);
    247 
    248                         if(report_id == 0) {
    249                                 break;
    250                         }
    251 
    252                         report_des = usb_hid_report_find_description(
    253                                 hid_dev->report, report_id,
    254                                 USB_HID_REPORT_TYPE_INPUT);
    255                 }
    256                 else {
     238                                report_id);
     239                }
     240
     241                usb_hid_report_field_t *field = usb_hid_report_get_sibling(
     242                    hid_dev->report,
     243                    NULL, usage_path, mapping->compare,
     244                    USB_HID_REPORT_TYPE_INPUT);
     245               
     246                usb_log_debug("Field: %p\n", field);
     247
     248                if (field != NULL) {
     249//                      size++;
     250//                      field = usb_hid_report_get_sibling(hid_dev->report,
     251//                          field, usage_path, mapping->compare,
     252//                          USB_HID_REPORT_TYPE_INPUT);
     253                        matches = true;
    257254                        break;
    258255                }
    259         }
    260        
    261         usb_log_debug("Size of the input report: %zu\n", size);
     256               
     257                report_id = usb_hid_get_next_report_id(
     258                    hid_dev->report, report_id,
     259                    USB_HID_REPORT_TYPE_INPUT);
     260
     261//              if((mapping->report_id == 0) && (report_des->report_id != 0)) {
     262//                      uint8_t report_id = usb_hid_get_next_report_id(
     263//                              hid_dev->report, report_des->report_id,
     264//                              USB_HID_REPORT_TYPE_INPUT);
     265
     266//                      if(report_id == 0) {
     267//                              break;
     268//                      }
     269
     270//                      report_des = usb_hid_report_find_description(
     271//                              hid_dev->report, report_id,
     272//                              USB_HID_REPORT_TYPE_INPUT);
     273//              }
     274//              else {
     275//                      break;
     276//              }
     277        } while (!matches && report_id != 0);
     278       
     279//      usb_log_debug("Size of the input report: %zu\n", size);
    262280        usb_hid_report_path_free(usage_path);
    263281       
    264         return (size > 0);
     282        return matches;
    265283}
    266284
Note: See TracChangeset for help on using the changeset viewer.