Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset eb393ad in mainline for uspace/drv/usbhid/kbd/kbddev.c


Ignore:
Timestamp:
2011-04-21T20:57:21Z (11 years ago)
Author:
Lubos Slovak <lubos.slovak@…>
Branches:
lfn, master
Children:
6513110
Parents:
36f737a (diff), c7c0984a (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:

Merged fixes from maklf

File:
1 edited

Legend:

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

    r36f737a reb393ad  
    299299                return;
    300300        }
    301        
    302         unsigned i = 0;
    303        
     301               
    304302        /* Reset the LED data. */
    305303        memset(kbd_dev->led_data, 0, kbd_dev->led_output_size * sizeof(int32_t));
    306        
    307         if ((kbd_dev->mods & KM_NUM_LOCK) && (i < kbd_dev->led_output_size)) {
    308                 kbd_dev->led_data[i++] = USB_HID_LED_NUM_LOCK;
    309         }
    310        
    311         if ((kbd_dev->mods & KM_CAPS_LOCK) && (i < kbd_dev->led_output_size)) {
    312                 kbd_dev->led_data[i++] = USB_HID_LED_CAPS_LOCK;
    313         }
    314        
    315         if ((kbd_dev->mods & KM_SCROLL_LOCK)
    316             && (i < kbd_dev->led_output_size)) {
    317                 kbd_dev->led_data[i++] = USB_HID_LED_SCROLL_LOCK;
    318         }
    319 
    320         // TODO: COMPOSE and KANA
    321        
    322         usb_log_debug("Creating output report: ");
    323         for (i = 0; i < kbd_dev->led_output_size; ++i) {
    324                 usb_log_debug("%d ", kbd_dev->led_data[i]);
    325         }
    326         usb_log_debug("\n");
    327 
    328         usb_hid_report_output_set_data(hid_dev->report, kbd_dev->led_path,
    329             USB_HID_PATH_COMPARE_END | USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY,
    330             kbd_dev->led_data, kbd_dev->led_output_size);
    331         int rc = usb_hid_report_output_translate(hid_dev->report, 0,
     304        usb_log_debug("Creating output report:\n");
     305
     306        usb_hid_report_field_t *field = usb_hid_report_get_sibling (hid_dev->parser, NULL,
     307                kbd_dev->led_path,
     308                                USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY | USB_HID_PATH_COMPARE_END,
     309                                USB_HID_REPORT_TYPE_OUTPUT);
     310        while(field != NULL) {
     311
     312                if((field->usage == USB_HID_LED_NUM_LOCK) && (kbd_dev->mods & KM_NUM_LOCK)){
     313                        field->value = 1;
     314                }
     315
     316                if((field->usage == USB_HID_LED_CAPS_LOCK) && (kbd_dev->mods & KM_CAPS_LOCK)){
     317                        field->value = 1;
     318                }
     319
     320                if((field->usage == USB_HID_LED_SCROLL_LOCK) && (kbd_dev->mods & KM_SCROLL_LOCK)){
     321                        field->value = 1;
     322                }
     323               
     324                field = usb_hid_report_get_sibling (hid_dev->parser, field,
     325                kbd_dev->led_path,
     326                                USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY | USB_HID_PATH_COMPARE_END,
     327                                USB_HID_REPORT_TYPE_OUTPUT);
     328        }
     329               
     330        int rc = usb_hid_report_output_translate(hid_dev->parser, 0,
    332331            kbd_dev->output_buffer, kbd_dev->output_size);
    333332       
     
    671670        usb_hid_report_path_append_item(path, USB_HIDUT_PAGE_KEYBOARD, 0);
    672671        //usb_hid_report_path_set_report_id(path, 0);
    673        
    674         int rc = usb_hid_parse_report(hid_dev->report, buffer, actual_size);
     672
     673        uint8_t report_id;
     674        int rc = usb_hid_parse_report(hid_dev->parser, buffer, actual_size, &report_id);       
     675        usb_hid_report_path_set_report_id (path, report_id);
     676        usb_hid_report_field_t *field = usb_hid_report_get_sibling(hid_dev->parser,
     677                            NULL, path, USB_HID_PATH_COMPARE_END | USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY,
     678                                                USB_HID_REPORT_TYPE_INPUT);
     679
     680        usb_hid_report_path_free(path);
    675681       
    676682        if (rc != EOK) {
Note: See TracChangeset for help on using the changeset viewer.