Changeset 06f9d8fb in mainline for uspace/drv/usbhid/usbhid.c


Ignore:
Timestamp:
2011-05-30T20:02:17Z (13 years ago)
Author:
Matus Dekanek <smekideki@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
c3dafe1
Parents:
be8d907 (diff), 63862a0 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

merge with usb/development

File:
1 edited

Legend:

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

    rbe8d907 r06f9d8fb  
    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 
    6865/*----------------------------------------------------------------------------*/
    6966
     
    206203        }
    207204       
    208 //      if (mapping->report_id >= 0) {
    209 //              usb_hid_report_path_set_report_id(usage_path,
    210 //                  mapping->report_id);
    211 //      }
    212        
    213205        assert(hid_dev->report != NULL);
    214206       
    215207        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;
    219208       
    220209        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);
    225210        uint8_t report_id = mapping->report_id;
    226211
    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                                              
     212        do {
    234213                usb_log_debug("Trying report id %u\n", report_id);
    235214               
     
    247226
    248227                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);
    253228                        matches = true;
    254229                        break;
     
    258233                    hid_dev->report, report_id,
    259234                    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 //              }
    277235        } while (!matches && report_id != 0);
    278236       
    279 //      usb_log_debug("Size of the input report: %zu\n", size);
    280237        usb_hid_report_path_free(usage_path);
    281238       
     
    423380       
    424381        uint8_t report_id = 0;
    425         size_t size;/* = usb_hid_report_byte_size(hid_dev->report, report_id,
    426             USB_HID_REPORT_TYPE_INPUT);*/
     382        size_t size;
    427383       
    428384        size_t max_size = 0;
     
    503459        rc = usb_hid_check_pipes(hid_dev, dev);
    504460        if (rc != EOK) {
    505                 //usb_hid_free(&hid_dev);
    506461                return rc;
    507462        }
     
    551506                            == USB_HID_GENERIC_POLL_EP_NO);
    552507                       
    553                         /* TODO: this has no meaning if the report descriptor
    554                                  is not parsed */
    555508                        usb_log_info("Falling back to generic HID driver.\n");
    556509                        rc = usb_hid_set_generic_hid_subdriver(hid_dev);
     
    563516                usb_log_debug("Subdriver count: %d\n",
    564517                    hid_dev->subdriver_count);
    565                 //usb_hid_free(&hid_dev);
    566518               
    567519        } else {
     
    619571        usb_hid_dev_t *hid_dev = (usb_hid_dev_t *)arg;
    620572       
    621 //      int allocated = (hid_dev->input_report != NULL);
    622573        assert(hid_dev->input_report != NULL);
    623574        usb_log_debug("Max input report size: %zu, buffer size: %zu\n",
    624575            hid_dev->max_input_report_size, buffer_size);
    625         //assert(hid_dev->max_input_report_size >= buffer_size);
     576
    626577        if (hid_dev->max_input_report_size >= buffer_size) {
    627578                /*! @todo This should probably be atomic. */
     
    670621/*----------------------------------------------------------------------------*/
    671622
    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 
    707623void usb_hid_new_report(usb_hid_dev_t *hid_dev)
    708624{
     
    716632        return hid_dev->report_nr;
    717633}
    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 //}
    732634
    733635/*----------------------------------------------------------------------------*/
Note: See TracChangeset for help on using the changeset viewer.