Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/usbhid/src/hiddescriptor.c

    rfeeac0d r9d58539  
    4141#include <assert.h>
    4242
    43 
     43/*---------------------------------------------------------------------------*/
    4444/*
    4545 * Constants defining current parsing mode for correct parsing of the set of
     
    6161#define INSIDE_DELIMITER_SET    2
    6262
    63 
     63/*---------------------------------------------------------------------------*/
    6464       
    6565/** The new report item flag. Used to determine when the item is completly
     
    7878#define USB_HID_UNKNOWN_TAG             -99
    7979
    80 
     80/*---------------------------------------------------------------------------*/
    8181/**
    8282 * Checks if given collection path is already present in report structure and
     
    124124}
    125125
    126 
     126/*---------------------------------------------------------------------------*/
    127127/**
    128128 * Initialize the report descriptor parser structure
     
    147147}
    148148
    149 
     149/*---------------------------------------------------------------------------*/
    150150
    151151/**
     
    314314        return EOK;
    315315}
    316 
     316/*---------------------------------------------------------------------------*/
    317317/**
    318318 * Finds description of report with given report_id and of given type in
     
    333333        }
    334334
    335         list_foreach(report->reports, reports_link,
    336             usb_hid_report_description_t, report_des) {
     335        usb_hid_report_description_t *report_des = NULL;
     336       
     337        list_foreach(report->reports, report_it) {
     338                report_des = list_get_instance(report_it,
     339                                usb_hid_report_description_t, reports_link);
     340
    337341                // if report id not set, return the first of the type
    338342                if(((report_des->report_id == report_id) || (report_id == 0)) &&
     
    344348        return NULL;
    345349}
    346 
     350/*---------------------------------------------------------------------------*/
    347351
    348352/** Parse HID report descriptor.
     
    532536}
    533537
    534 
     538/*---------------------------------------------------------------------------*/
    535539
    536540/**
     
    867871        return EOK;
    868872}
    869 
     873/*---------------------------------------------------------------------------*/
    870874
    871875/**
     
    888892        return result;
    889893}
    890 
     894/*---------------------------------------------------------------------------*/
    891895
    892896/**
     
    898902void usb_hid_descriptor_print_list(list_t *list)
    899903{
     904        usb_hid_report_field_t *report_item;
     905
    900906        if(list == NULL || list_empty(list)) {
    901907            usb_log_debug("\tempty\n");
     
    903909        }
    904910
    905         list_foreach(*list, ritems_link, usb_hid_report_field_t,
    906             report_item) {
     911        list_foreach(*list, item) {
     912                report_item = list_get_instance(item, usb_hid_report_field_t,
     913                                ritems_link);
     914
    907915                usb_log_debug("\t\tOFFSET: %X\n", report_item->offset);
    908916                usb_log_debug("\t\tSIZE: %zu\n", report_item->size);
     
    929937
    930938                usb_log_debug("\n");
    931         }
    932 }
    933 
     939
     940        }
     941
     942}
     943/*---------------------------------------------------------------------------*/
    934944
    935945/**
     
    941951void usb_hid_descriptor_print(usb_hid_report_t *report)
    942952{
    943         if (report == NULL)
     953        if(report == NULL) {
    944954                return;
    945 
    946         list_foreach(report->reports, reports_link,
    947             usb_hid_report_description_t, report_des) {
     955        }
     956
     957        usb_hid_report_description_t *report_des;
     958
     959        list_foreach(report->reports, report_it) {
     960                report_des = list_get_instance(report_it,
     961                        usb_hid_report_description_t, reports_link);
    948962                usb_log_debug("Report ID: %d\n", report_des->report_id);
    949963                usb_log_debug("\tType: %d\n", report_des->type);
     
    958972        }
    959973}
    960 
     974/*---------------------------------------------------------------------------*/
    961975
    962976
     
    10081022        return;
    10091023}
    1010 
     1024/*---------------------------------------------------------------------------*/
    10111025
    10121026/**
Note: See TracChangeset for help on using the changeset viewer.