Ignore:
File:
1 edited

Legend:

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

    rb803845 r2a5b62b  
    8888
    8989/** Keyboard polling endpoint description for boot protocol class. */
    90 const usb_endpoint_description_t usb_hid_kbd_poll_endpoint_description = {
     90usb_endpoint_description_t usb_hid_kbd_poll_endpoint_description = {
    9191        .transfer_type = USB_TRANSFER_INTERRUPT,
    9292        .direction = USB_DIRECTION_IN,
     
    237237
    238238        usb_hid_report_field_t *field = usb_hid_report_get_sibling(
    239             &hid_dev->report, NULL, kbd_dev->led_path,
     239            hid_dev->report, NULL, kbd_dev->led_path,
    240240            USB_HID_PATH_COMPARE_END | USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY,
    241241            USB_HID_REPORT_TYPE_OUTPUT);
    242242
    243243        while (field != NULL) {
    244 
    245                 if ((field->usage == USB_HID_LED_NUM_LOCK)
     244               
     245                if ((field->usage == USB_HID_LED_NUM_LOCK) 
    246246                    && (kbd_dev->mods & KM_NUM_LOCK)){
    247247                        field->value = 1;
    248248                }
    249249
    250                 if ((field->usage == USB_HID_LED_CAPS_LOCK)
     250                if ((field->usage == USB_HID_LED_CAPS_LOCK) 
    251251                    && (kbd_dev->mods & KM_CAPS_LOCK)){
    252252                        field->value = 1;
    253253                }
    254254
    255                 if ((field->usage == USB_HID_LED_SCROLL_LOCK)
     255                if ((field->usage == USB_HID_LED_SCROLL_LOCK) 
    256256                    && (kbd_dev->mods & KM_SCROLL_LOCK)){
    257257                        field->value = 1;
    258258                }
    259 
    260                 field = usb_hid_report_get_sibling(
    261                     &hid_dev->report, field, kbd_dev->led_path,
    262                 USB_HID_PATH_COMPARE_END | USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY,
    263                     USB_HID_REPORT_TYPE_OUTPUT);
     259               
     260                field = usb_hid_report_get_sibling(hid_dev->report, field,
     261                    kbd_dev->led_path, 
     262                USB_HID_PATH_COMPARE_END | USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY,
     263                        USB_HID_REPORT_TYPE_OUTPUT);
    264264        }
    265265
    266266        // TODO: what about the Report ID?
    267         int rc = usb_hid_report_output_translate(&hid_dev->report, 0,
     267        int rc = usb_hid_report_output_translate(hid_dev->report, 0,
    268268            kbd_dev->output_buffer, kbd_dev->output_size);
    269269
     
    432432static void usb_kbd_process_data(usb_hid_dev_t *hid_dev, usb_kbd_t *kbd_dev)
    433433{
     434        assert(hid_dev->report != NULL);
    434435        assert(hid_dev != NULL);
    435436        assert(kbd_dev != NULL);
     
    443444
    444445        usb_hid_report_field_t *field = usb_hid_report_get_sibling(
    445             &hid_dev->report, NULL, path,
    446             USB_HID_PATH_COMPARE_END | USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY,
     446            hid_dev->report, NULL, path,
     447            USB_HID_PATH_COMPARE_END | USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY, 
    447448            USB_HID_REPORT_TYPE_INPUT);
    448449        unsigned i = 0;
     
    453454               
    454455                assert(i < kbd_dev->key_count);
    455 
     456               
    456457                // save the key usage
    457458                if (field->value != 0) {
     
    462463                }
    463464                usb_log_debug2("Saved %u. key usage %d\n", i, kbd_dev->keys[i]);
    464 
     465               
    465466                ++i;
    466                 field = usb_hid_report_get_sibling(
    467                     &hid_dev->report, field, path, USB_HID_PATH_COMPARE_END
    468                         | USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY,
     467                field = usb_hid_report_get_sibling(hid_dev->report, field, path,
     468                    USB_HID_PATH_COMPARE_END
     469                    | USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY,
    469470                    USB_HID_REPORT_TYPE_INPUT);
    470471        }
     
    615616
    616617        kbd_dev->key_count = usb_hid_report_size(
    617             &hid_dev->report, 0, USB_HID_REPORT_TYPE_INPUT);
     618            hid_dev->report, 0, USB_HID_REPORT_TYPE_INPUT);
    618619        usb_hid_report_path_free(path);
    619620
    620621        usb_log_debug("Size of the input report: %zu\n", kbd_dev->key_count);
    621622
    622         kbd_dev->keys = calloc(kbd_dev->key_count, sizeof(int32_t));
     623        kbd_dev->keys = (int32_t *)calloc(kbd_dev->key_count, sizeof(int32_t));
    623624
    624625        if (kbd_dev->keys == NULL) {
     
    642643         */
    643644        kbd_dev->output_size = 0;
    644         kbd_dev->output_buffer = usb_hid_report_output(&hid_dev->report,
     645        kbd_dev->output_buffer = usb_hid_report_output(hid_dev->report,
    645646            &kbd_dev->output_size, 0);
    646647        if (kbd_dev->output_buffer == NULL) {
     
    656657            kbd_dev->led_path, USB_HIDUT_PAGE_LED, 0);
    657658
    658         kbd_dev->led_output_size = usb_hid_report_size(
    659             &hid_dev->report, 0, USB_HID_REPORT_TYPE_OUTPUT);
     659        kbd_dev->led_output_size = usb_hid_report_size(hid_dev->report,
     660            0, USB_HID_REPORT_TYPE_OUTPUT);
    660661
    661662        usb_log_debug("Output report size (in items): %zu\n",
     
    825826int usb_kbd_set_boot_protocol(usb_hid_dev_t *hid_dev)
    826827{
    827         int rc = usb_hid_parse_report_descriptor(
    828             &hid_dev->report, USB_KBD_BOOT_REPORT_DESCRIPTOR,
     828        int rc = usb_hid_parse_report_descriptor(hid_dev->report,
     829            USB_KBD_BOOT_REPORT_DESCRIPTOR,
    829830            USB_KBD_BOOT_REPORT_DESCRIPTOR_SIZE);
    830831
     
    835836        }
    836837
    837         rc = usbhid_req_set_protocol(&hid_dev->usb_dev->ctrl_pipe,
     838        rc = usbhid_req_set_protocol(&hid_dev->usb_dev->ctrl_pipe, 
    838839            hid_dev->usb_dev->interface_no, USB_HID_PROTOCOL_BOOT);
    839840
Note: See TracChangeset for help on using the changeset viewer.