Ignore:
File:
1 edited

Legend:

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

    r19e0560e rf3f9733  
    6363static const int USB_HID_MAX_SUBDRIVERS = 10;
    6464
     65/** @todo What happens if this is not fibril local? */
     66//static fibril_local bool report_number;
     67
    6568/*----------------------------------------------------------------------------*/
    6669
     
    203206        }
    204207       
     208//      if (mapping->report_id >= 0) {
     209//              usb_hid_report_path_set_report_id(usage_path,
     210//                  mapping->report_id);
     211//      }
     212       
    205213        assert(hid_dev->report != NULL);
    206214       
    207215        usb_log_debug("Compare flags: %d\n", mapping->compare);
     216//      size_t size = usb_hid_report_size(hid_dev->report, 0,
     217//          USB_HID_REPORT_TYPE_INPUT);
     218//      size_t size = 0;
    208219       
    209220        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);
    210225        uint8_t report_id = mapping->report_id;
    211226
    212         do {
     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                                             
    213234                usb_log_debug("Trying report id %u\n", report_id);
    214235               
     
    226247
    227248                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);
    228253                        matches = true;
    229254                        break;
     
    233258                    hid_dev->report, report_id,
    234259                    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//              }
    235277        } while (!matches && report_id != 0);
    236278       
     279//      usb_log_debug("Size of the input report: %zu\n", size);
    237280        usb_hid_report_path_free(usage_path);
    238281       
     
    380423       
    381424        uint8_t report_id = 0;
    382         size_t size;
     425        size_t size;/* = usb_hid_report_byte_size(hid_dev->report, report_id,
     426            USB_HID_REPORT_TYPE_INPUT);*/
    383427       
    384428        size_t max_size = 0;
     
    459503        rc = usb_hid_check_pipes(hid_dev, dev);
    460504        if (rc != EOK) {
     505                //usb_hid_free(&hid_dev);
    461506                return rc;
    462507        }
     
    506551                            == USB_HID_GENERIC_POLL_EP_NO);
    507552                       
     553                        /* TODO: this has no meaning if the report descriptor
     554                                 is not parsed */
    508555                        usb_log_info("Falling back to generic HID driver.\n");
    509556                        rc = usb_hid_set_generic_hid_subdriver(hid_dev);
     
    516563                usb_log_debug("Subdriver count: %d\n",
    517564                    hid_dev->subdriver_count);
     565                //usb_hid_free(&hid_dev);
    518566               
    519567        } else {
     
    571619        usb_hid_dev_t *hid_dev = (usb_hid_dev_t *)arg;
    572620       
     621//      int allocated = (hid_dev->input_report != NULL);
    573622        assert(hid_dev->input_report != NULL);
    574623        usb_log_debug("Max input report size: %zu, buffer size: %zu\n",
    575624            hid_dev->max_input_report_size, buffer_size);
    576 
     625        //assert(hid_dev->max_input_report_size >= buffer_size);
    577626        if (hid_dev->max_input_report_size >= buffer_size) {
    578627                /*! @todo This should probably be atomic. */
     
    621670/*----------------------------------------------------------------------------*/
    622671
     672//const char *usb_hid_get_function_name(const usb_hid_dev_t *hid_dev)
     673//{
     674//      switch (hid_dev->poll_pipe_index) {
     675//      case USB_HID_KBD_POLL_EP_NO:
     676//              return HID_KBD_FUN_NAME;
     677//              break;
     678//      case USB_HID_MOUSE_POLL_EP_NO:
     679//              return HID_MOUSE_FUN_NAME;
     680//              break;
     681//      default:
     682//              return HID_GENERIC_FUN_NAME;
     683//      }
     684//}
     685
     686/*----------------------------------------------------------------------------*/
     687
     688//const char *usb_hid_get_class_name(const usb_hid_dev_t *hid_dev)
     689//{
     690//      // this means that only boot protocol keyboards will be connected
     691//      // to the console; there is probably no better way to do this
     692       
     693//      switch (hid_dev->poll_pipe_index) {
     694//      case USB_HID_KBD_POLL_EP_NO:
     695//              return HID_KBD_CLASS_NAME;
     696//              break;
     697//      case USB_HID_MOUSE_POLL_EP_NO:
     698//              return HID_MOUSE_CLASS_NAME;
     699//              break;
     700//      default:
     701//              return HID_GENERIC_CLASS_NAME;
     702//      }
     703//}
     704
     705/*----------------------------------------------------------------------------*/
     706
    623707void usb_hid_new_report(usb_hid_dev_t *hid_dev)
    624708{
     
    632716        return hid_dev->report_nr;
    633717}
     718
     719/*----------------------------------------------------------------------------*/
     720
     721//void usb_hid_report_received(void)
     722//{
     723//      ++report_number;
     724//}
     725
     726/*----------------------------------------------------------------------------*/
     727
     728//bool usb_hid_report_ready(void)
     729//{
     730//      return !report_received;
     731//}
    634732
    635733/*----------------------------------------------------------------------------*/
Note: See TracChangeset for help on using the changeset viewer.