Ignore:
File:
1 edited

Legend:

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

    r252cf2a r3a6e423  
    313313        usb_hid_report_field_t *field = usb_hid_report_get_sibling(
    314314            hid_dev->report, NULL, kbd_dev->led_path,
    315             USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY | USB_HID_PATH_COMPARE_END,
     315            USB_HID_PATH_COMPARE_END | USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY,
    316316            USB_HID_REPORT_TYPE_OUTPUT);
    317317       
    318         while (field != NULL) {
    319 
     318        while (field != NULL) {         
     319               
    320320                if ((field->usage == USB_HID_LED_NUM_LOCK)
    321321                    && (kbd_dev->mods & KM_NUM_LOCK)){
     
    334334               
    335335                field = usb_hid_report_get_sibling(hid_dev->report, field,
    336                     kbd_dev->led_path, USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY
    337                     | USB_HID_PATH_COMPARE_END, USB_HID_REPORT_TYPE_OUTPUT);
     336                    kbd_dev->led_path, 
     337                USB_HID_PATH_COMPARE_END | USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY,
     338                        USB_HID_REPORT_TYPE_OUTPUT);
    338339        }
    339340       
     
    677678//          callbacks, kbd_dev);
    678679        usb_hid_report_path_t *path = usb_hid_report_path();
    679         usb_hid_report_path_append_item(path, USB_HIDUT_PAGE_GENERIC_DESKTOP, 6);
     680        usb_hid_report_path_append_item(path, USB_HIDUT_PAGE_KEYBOARD, 0);
    680681        //usb_hid_report_path_set_report_id(path, 0);
    681682
     
    695696        usb_hid_report_field_t *field = usb_hid_report_get_sibling(
    696697            hid_dev->report, NULL, path,
    697             USB_HID_PATH_COMPARE_BEGIN,
     698            USB_HID_PATH_COMPARE_END | USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY,
    698699            USB_HID_REPORT_TYPE_INPUT);
    699700        unsigned i = 0;
    700 
     701       
    701702        while (field != NULL) {
    702                 //usb_log_debug2("FIELD (%p) - VALUE(%d) USAGE(%u)\n",
    703                 //    field, field->value, field->usage);
     703                usb_log_debug2("FIELD (%p) - VALUE(%d) USAGE(%u)\n",
     704                    field, field->value, field->usage);
    704705               
    705706                assert(i < kbd_dev->key_count);
     
    716717                 *       two parts of the Report somehow.
    717718                 */
    718                 usb_log_debug("value(%x), usage(%x)\n", field->value, field->usage);
    719719                if (field->value != 0) {
    720                         //kbd_dev->keys[i] = field->usage;
     720                        kbd_dev->keys[i] = field->usage;
    721721                }
    722722                else {
    723                         //kbd_dev->keys[i] = 0;
     723                        kbd_dev->keys[i] = 0;
    724724                }
    725                 //usb_log_debug2("Saved %u. key usage %d\n", i, kbd_dev->keys[i]);
     725                usb_log_debug2("Saved %u. key usage %d\n", i, kbd_dev->keys[i]);
    726726               
    727727                ++i;
    728728                field = usb_hid_report_get_sibling(hid_dev->report, field, path,
    729                     USB_HID_PATH_COMPARE_BEGIN,
     729                    USB_HID_PATH_COMPARE_END
     730                    | USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY,
    730731                    USB_HID_REPORT_TYPE_INPUT);
    731                 usb_log_debug("field -- %p\n", field);
    732732        }
    733733       
     
    861861         * TODO: make more general
    862862         */
     863        usb_hid_report_path_t *path = usb_hid_report_path();
     864        usb_hid_report_path_append_item(path, USB_HIDUT_PAGE_KEYBOARD, 0);
     865       
     866        usb_hid_report_path_set_report_id(path, 0);
     867       
    863868        kbd_dev->key_count = usb_hid_report_size(
    864             hid_dev->report, 0, USB_HID_REPORT_TYPE_INPUT);
    865        
    866         usb_log_debug("Size of the input report: %zu\n", kbd_dev->key_count);   
     869            hid_dev->report, 0, USB_HID_REPORT_TYPE_INPUT);
     870        usb_hid_report_path_free(path);
     871       
     872        usb_log_debug("Size of the input report: %zu\n", kbd_dev->key_count);
     873       
    867874        kbd_dev->keys = (int32_t *)calloc(kbd_dev->key_count, sizeof(int32_t));
    868875       
     
    901908            kbd_dev->led_path, USB_HIDUT_PAGE_LED, 0);
    902909       
    903         kbd_dev->led_output_size = usb_hid_report_size(hid_dev->report, 0,
    904             USB_HID_REPORT_TYPE_OUTPUT);
     910        kbd_dev->led_output_size = usb_hid_report_size(hid_dev->report,
     911            0, USB_HID_REPORT_TYPE_OUTPUT);
    905912       
    906913        usb_log_debug("Output report size (in items): %zu\n",
     
    980987                return rc;
    981988        }
    982 
     989       
    983990        return EOK;
    984991}
Note: See TracChangeset for help on using the changeset viewer.