Ignore:
File:
1 edited

Legend:

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

    r054537b r36f737a  
    136136       
    137137        // set the init callback
    138         hid_dev->subdrivers[0].init = usb_generic_hid_init;
     138        hid_dev->subdrivers[0].init = NULL;
    139139       
    140140        // set the polling callback
     
    490490        usb_hid_dev_t *hid_dev = (usb_hid_dev_t *)arg;
    491491       
    492         int allocated = (hid_dev->input_report != NULL);
    493        
    494         if (!allocated
    495             || hid_dev->input_report_size < buffer_size) {
    496                 uint8_t *input_old = hid_dev->input_report;
    497                 uint8_t *input_new = (uint8_t *)malloc(buffer_size);
    498                
    499                 if (input_new == NULL) {
    500                         usb_log_error("Failed to allocate space for input "
    501                             "buffer. This event may not be reported\n");
    502                         memset(hid_dev->input_report, 0,
    503                             hid_dev->input_report_size);
    504                 } else {
    505                         memcpy(input_new, input_old,
    506                             hid_dev->input_report_size);
    507                         hid_dev->input_report = input_new;
    508                         if (allocated) {
    509                                 free(input_old);
    510                         }
    511                 }
    512         }
    513        
    514         /*! @todo This should probably be atomic. */
    515         memcpy(hid_dev->input_report, buffer, buffer_size);
    516         hid_dev->input_report_size = buffer_size;
    517        
    518492        bool cont = false;
    519493       
     
    554528/*----------------------------------------------------------------------------*/
    555529
    556 //const char *usb_hid_get_function_name(const usb_hid_dev_t *hid_dev)
    557 //{
    558 //      switch (hid_dev->poll_pipe_index) {
    559 //      case USB_HID_KBD_POLL_EP_NO:
    560 //              return HID_KBD_FUN_NAME;
    561 //              break;
    562 //      case USB_HID_MOUSE_POLL_EP_NO:
    563 //              return HID_MOUSE_FUN_NAME;
    564 //              break;
    565 //      default:
    566 //              return HID_GENERIC_FUN_NAME;
    567 //      }
    568 //}
    569 
    570 /*----------------------------------------------------------------------------*/
    571 
    572 //const char *usb_hid_get_class_name(const usb_hid_dev_t *hid_dev)
    573 //{
    574 //      // this means that only boot protocol keyboards will be connected
    575 //      // to the console; there is probably no better way to do this
    576        
    577 //      switch (hid_dev->poll_pipe_index) {
    578 //      case USB_HID_KBD_POLL_EP_NO:
    579 //              return HID_KBD_CLASS_NAME;
    580 //              break;
    581 //      case USB_HID_MOUSE_POLL_EP_NO:
    582 //              return HID_MOUSE_CLASS_NAME;
    583 //              break;
    584 //      default:
    585 //              return HID_GENERIC_CLASS_NAME;
    586 //      }
    587 //}
     530const char *usb_hid_get_function_name(const usb_hid_dev_t *hid_dev)
     531{
     532        switch (hid_dev->poll_pipe_index) {
     533        case USB_HID_KBD_POLL_EP_NO:
     534                return HID_KBD_FUN_NAME;
     535                break;
     536        case USB_HID_MOUSE_POLL_EP_NO:
     537                return HID_MOUSE_FUN_NAME;
     538                break;
     539        default:
     540                return HID_GENERIC_FUN_NAME;
     541        }
     542}
     543
     544/*----------------------------------------------------------------------------*/
     545
     546const char *usb_hid_get_class_name(const usb_hid_dev_t *hid_dev)
     547{
     548        // this means that only boot protocol keyboards will be connected
     549        // to the console; there is probably no better way to do this
     550       
     551        switch (hid_dev->poll_pipe_index) {
     552        case USB_HID_KBD_POLL_EP_NO:
     553                return HID_KBD_CLASS_NAME;
     554                break;
     555        case USB_HID_MOUSE_POLL_EP_NO:
     556                return HID_MOUSE_CLASS_NAME;
     557                break;
     558        default:
     559                return HID_GENERIC_CLASS_NAME;
     560        }
     561}
    588562
    589563/*----------------------------------------------------------------------------*/
Note: See TracChangeset for help on using the changeset viewer.