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

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


Ignore:
Timestamp:
2011-04-21T08:33:44Z (11 years ago)
Author:
Lubos Slovak <lubos.slovak@…>
Branches:
lfn, master
Children:
020559c9
Parents:
da1dd48 (diff), e50cd7f (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:

Changes to HID parser (report structure)

File:
1 edited

Legend:

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

    rda1dd48 r63517c2  
    320320        // TODO: COMPOSE and KANA
    321321       
    322         usb_log_debug("Creating output report.\n");
    323        
    324         int rc = usb_hid_report_output_translate(hid_dev->parser,
    325             kbd_dev->led_path,
    326             USB_HID_PATH_COMPARE_END | USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY,
    327             kbd_dev->output_buffer,
    328             kbd_dev->output_size, kbd_dev->led_data, kbd_dev->led_output_size);
     322        usb_log_debug("Creating output report: %s\n", usb_debug_str_buffer ((uint8_t *)kbd_dev->led_data, kbd_dev->led_output_size * 4, 0));
     323
     324        usb_hid_report_output_set_data(hid_dev->parser, kbd_dev->led_path,
     325                                       USB_HID_PATH_COMPARE_END , kbd_dev->led_data,
     326                                       kbd_dev->led_output_size);
     327        int rc = usb_hid_report_output_translate(hid_dev->parser, 0,
     328            kbd_dev->output_buffer, kbd_dev->output_size);
    329329       
    330330        if (rc != EOK) {
     
    649649        //usb_hid_report_path_set_report_id(path, 0);
    650650       
    651         int rc = usb_hid_parse_report(hid_dev->parser, buffer,
    652             actual_size, path,
    653             USB_HID_PATH_COMPARE_END | USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY,
    654             &usb_kbd_parser_callbacks, hid_dev);
    655 
     651        int rc = usb_hid_parse_report(hid_dev->parser, buffer, actual_size);   
     652        usb_hid_report_field_t *field = usb_hid_report_get_sibling(hid_dev->parser,
     653                            NULL, path, USB_HID_PATH_COMPARE_END | USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY,
     654                                                USB_HID_REPORT_TYPE_INPUT);
     655       
     656        while(field != NULL) {
     657                usb_log_debug("FIELD (%X) - VALUE(%X) USAGE(%X)\n", field, field->value, field->usage);
     658                field = usb_hid_report_get_sibling(hid_dev->parser, field, path,
     659                                                   USB_HID_PATH_COMPARE_END | USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY,
     660                                                   USB_HID_REPORT_TYPE_INPUT);
     661        }
     662               
     663       
    656664        usb_hid_report_path_free(path);
    657665       
     
    766774        kbd_dev->output_size = 0;
    767775        kbd_dev->output_buffer = usb_hid_report_output(hid_dev->parser,
    768             &kbd_dev->output_size);
    769         if (kbd_dev->output_buffer == NULL && kbd_dev->output_size != 0) {
     776            &kbd_dev->output_size, 0x00);
     777        if (kbd_dev->output_buffer == NULL) {
    770778                usb_log_warning("Error creating output report buffer.\n");
    771779                free(kbd_dev->keys);
    772                 free(kbd_dev);
    773                 return ENOMEM;
     780                return ENOMEM;  /* TODO: other error code */
    774781        }
    775782       
Note: See TracChangeset for help on using the changeset viewer.