Changeset 1b20da0 in mainline for uspace/lib/usbhid


Ignore:
Timestamp:
2018-02-28T17:52:03Z (8 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
3061bc1
Parents:
df6ded8
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-02-28 17:26:03)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-02-28 17:52:03)
Message:

style: Remove trailing whitespace on non-empty lines, in certain file types.

Command used: tools/srepl '\([^[:space:]]\)\s\+$' '\1' -- *.c *.h *.py *.sh *.s *.S *.ag

Location:
uspace/lib/usbhid
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/usbhid/include/usb/hid/hid_report_items.h

    rdf6ded8 r1b20da0  
    7474 * Input/Output/Feature Item flags
    7575 */
    76 /** 
     76/**
    7777 * Indicates whether the item is data (0) or a constant (1) value. Data
    7878 * indicates the item is defining report fields that contain modifiable device
     
    8484/**
    8585 * Indicates whether the item creates variable (1) or array (0) data fields in
    86  * reports. 
     86 * reports.
    8787 */
    8888#define USB_HID_ITEM_FLAG_VARIABLE(flags)       ((flags & 0x2) == 0x2)
     
    175175/**
    176176 * A Collection item identifies a relationship between two or more data
    177  * (Input, Output, or Feature.) 
     177 * (Input, Output, or Feature.)
    178178 */
    179179#define USB_HID_REPORT_TAG_COLLECTION           0xA
     
    203203#define USB_HID_REPORT_TAG_USAGE_PAGE           0x0
    204204
    205 /** 
     205/**
    206206 * Extent value in logical units. This is the minimum value that a variable
    207207 * or array item will report. For example, a mouse reporting x position values
     
    211211#define USB_HID_REPORT_TAG_LOGICAL_MINIMUM      0x1
    212212
    213 /** 
     213/**
    214214 * Extent value in logical units. This is the maximum value that a variable
    215215 * or array item will report.
     
    217217#define USB_HID_REPORT_TAG_LOGICAL_MAXIMUM      0x2
    218218
    219 /** 
     219/**
    220220 * Minimum value for the physical extent of a variable item. This represents
    221221 * the Logical Minimum with units applied to it.
     
    223223#define USB_HID_REPORT_TAG_PHYSICAL_MINIMUM     0x3
    224224
    225 /** 
     225/**
    226226 * Maximum value for the physical extent of a variable item.
    227227 */
    228228#define USB_HID_REPORT_TAG_PHYSICAL_MAXIMUM     0x4
    229229
    230 /** 
     230/**
    231231 * Value of the unit exponent in base 10. See the table later in this section
    232232 * for more information.
     
    234234#define USB_HID_REPORT_TAG_UNIT_EXPONENT        0x5
    235235
    236 /** 
     236/**
    237237 * Unit values.
    238238 */
    239239#define USB_HID_REPORT_TAG_UNIT                 0x6
    240240
    241 /** 
     241/**
    242242 * Unsigned integer specifying the size of the report fields in bits. This
    243243 * allows the parser to build an item map for the report handler to use.
     
    245245#define USB_HID_REPORT_TAG_REPORT_SIZE          0x7
    246246
    247 /** 
     247/**
    248248 * Unsigned value that specifies the Report ID. If a Report ID tag is used
    249249 * anywhere in Report descriptor, all data reports for the device are preceded
     
    255255#define USB_HID_REPORT_TAG_REPORT_ID            0x8
    256256
    257 /** 
     257/**
    258258 * Unsigned integer specifying the number of data fields for the item;
    259259 * determines how many fields are included in the report for this particular
     
    262262#define USB_HID_REPORT_TAG_REPORT_COUNT         0x9
    263263
    264 /** 
     264/**
    265265 * Places a copy of the global item state table on the stack.
    266266 */
    267267#define USB_HID_REPORT_TAG_PUSH                 0xA
    268268
    269 /** 
     269/**
    270270 * Replaces the item state table with the top structure from the stack.
    271271 */
  • uspace/lib/usbhid/include/usb/hid/hidpath.h

    rdf6ded8 r1b20da0  
    4848 */
    4949/** Wanted usage path must be exactly the same as the searched one.  This
    50  * option cannot be combined with the others. 
     50 * option cannot be combined with the others.
    5151 */
    5252#define USB_HID_PATH_COMPARE_STRICT             0
     
    5757#define USB_HID_PATH_COMPARE_END                1
    5858
    59 /** 
     59/**
    6060 * Only usage page are compared along the usage path.  This option can be
    61  * combined with others. 
     61 * combined with others.
    6262 */
    6363#define USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY    2
    6464
    65 /** 
     65/**
    6666 * Searched usage page must be prefix of the other one.
    6767 */
    6868#define USB_HID_PATH_COMPARE_BEGIN              4
    6969
    70 /** 
     70/**
    7171 * Searched couple of usage page and usage can be anywhere in usage path.
    7272 * This option is deprecated.
     
    7575
    7676
    77 /** 
     77/**
    7878 * Item of usage path structure. Last item of linked list describes one item
    7979 * in report, the others describe superior Collection tags. Usage and Usage
    80  * page of report item can be changed due to data in report. 
     80 * page of report item can be changed due to data in report.
    8181 */
    8282typedef struct {
     
    9595
    9696
    97 /** 
     97/**
    9898 * USB HID usage path structure.
    9999 * */
  • uspace/lib/usbhid/include/usb/hid/hidreport.h

    rdf6ded8 r1b20da0  
    5353 * \retval ENOENT if there are some descriptors missing.
    5454 * \retval ENOMEM if an error with allocation occured.
    55  * \retval EINVAL if the Report descriptor's size does not match the size 
     55 * \retval EINVAL if the Report descriptor's size does not match the size
    5656 *         from the interface descriptor.
    5757 * \return Other value inherited from function usb_pipe_start_session(),
  • uspace/lib/usbhid/include/usb/hid/hidtypes.h

    rdf6ded8 r1b20da0  
    138138
    139139/**
    140  * Description of one field/item in report 
     140 * Description of one field/item in report
    141141 */
    142142typedef struct {
     
    159159        usb_hid_report_path_t *collection_path;
    160160
    161         /** 
     161        /**
    162162         * The lowest valid logical value (value with the device operates)
    163163         */
     
    208208 */
    209209typedef struct {
    210         /** report id */       
     210        /** report id */
    211211        int32_t id;
    212212       
     
    223223        uint32_t usage_page;
    224224
    225         /** Minimum valid usage index */       
     225        /** Minimum valid usage index */
    226226        int32_t usage_minimum;
    227227       
    228         /** Maximum valid usage index */       
     228        /** Maximum valid usage index */
    229229        int32_t usage_maximum;
    230230       
    231         /** Minimum valid logical value */     
     231        /** Minimum valid logical value */
    232232        int32_t logical_minimum;
    233233       
    234         /** Maximum valid logical value */     
     234        /** Maximum valid logical value */
    235235        int32_t logical_maximum;
    236236
    237         /** Length of the items in bits*/       
     237        /** Length of the items in bits*/
    238238        int32_t size;
    239239
    240         /** COunt of items*/   
     240        /** COunt of items*/
    241241        int32_t count;
    242242
    243         /**  Bit offset of the item in report */       
     243        /**  Bit offset of the item in report */
    244244        size_t offset;
    245245
    246         /** Unit exponent */   
     246        /** Unit exponent */
    247247        int32_t unit_exponent;
    248         /** Unit of the value */       
     248        /** Unit of the value */
    249249        int32_t unit;
    250250
     
    252252        uint32_t string_index;
    253253
    254         /** Minimum valid string index */       
     254        /** Minimum valid string index */
    255255        uint32_t string_minimum;
    256256
    257         /** Maximum valid string index */       
     257        /** Maximum valid string index */
    258258        uint32_t string_maximum;
    259259
    260         /** The designator index */     
     260        /** The designator index */
    261261        uint32_t designator_index;
    262262
    263         /** Minimum valid designator value*/   
     263        /** Minimum valid designator value*/
    264264        uint32_t designator_minimum;
    265265
    266         /** Maximum valid designator value*/   
     266        /** Maximum valid designator value*/
    267267        uint32_t designator_maximum;
    268268
    269         /** Minimal valid physical value*/     
     269        /** Minimal valid physical value*/
    270270        int32_t physical_minimum;
    271271
    272         /** Maximal valid physical value */     
     272        /** Maximal valid physical value */
    273273        int32_t physical_maximum;
    274274
    275         /** Items attributes*/ 
     275        /** Items attributes*/
    276276        uint8_t item_flags;
    277277
     
    279279        usb_hid_report_type_t type;
    280280
    281         /** current collection path*/   
     281        /** current collection path*/
    282282        usb_hid_report_path_t *usage_path;
    283283
    284         /** Unused*/   
     284        /** Unused*/
    285285        link_t link;
    286286
     
    289289
    290290/**
    291  * Enum of the keyboard modifiers 
     291 * Enum of the keyboard modifiers
    292292 */
    293293typedef enum {
     
    303303} usb_hid_modifiers_t;
    304304
    305 static const usb_hid_modifiers_t 
     305static const usb_hid_modifiers_t
    306306    usb_hid_modifiers_consts[USB_HID_MOD_COUNT] = {
    307307        USB_HID_MOD_LCTRL,
  • uspace/lib/usbhid/src/consumer.c

    rdf6ded8 r1b20da0  
    326326        [0x11e] = "Reserved",
    327327        [0x11f] = "Reserved",
    328         [0x120] = "Reserved", 
     328        [0x120] = "Reserved",
    329329        [0x121] = "Reserved",
    330330        [0x122] = "Reserved",
     
    342342        [0x12e] = "Reserved",
    343343        [0x12f] = "Reserved",
    344         [0x130] = "Reserved", 
     344        [0x130] = "Reserved",
    345345        [0x131] = "Reserved",
    346346        [0x132] = "Reserved",
     
    710710
    711711/**
    712  * Translates USB HID Usages from the Consumer Page into their string 
     712 * Translates USB HID Usages from the Consumer Page into their string
    713713 * representation.
    714714 *
    715715 * @param usage USB HID Consumer Page Usage number.
    716  * 
     716 *
    717717 * @retval HelenOS key code corresponding to the given USB Consumer Page Usage.
    718718 */
  • uspace/lib/usbhid/src/hiddescriptor.c

    rdf6ded8 r1b20da0  
    8585 * inserts it if not.
    8686 *
    87  * @param report Report structure 
    88  * @param cmp_path The collection path 
     87 * @param report Report structure
     88 * @param cmp_path The collection path
    8989 * @return Pointer to the result collection path in report structure.
    9090 * @retval NULL If some error occurs
     
    122122        else {
    123123                return list_get_instance(path_it, usb_hid_report_path_t,
    124                                 cpath_link); 
     124                                cpath_link);
    125125        }
    126126}
     
    156156 * @param report Report structure in which the new report items should be
    157157 *               stored
    158  * @param report_item Current report descriptor's parsing state table 
     158 * @param report_item Current report descriptor's parsing state table
    159159 * @return Error code
    160160 * @retval EOK If all fields were successfully append to report
     
    179179                usages = malloc(sizeof(uint32_t) * report_item->usages_count);
    180180                memcpy(usages, report_item->usages, sizeof(int32_t) *
    181                                 report_item->usages_count); 
     181                                report_item->usages_count);
    182182        }
    183183        else {
     
    185185        }
    186186       
    187         usb_hid_report_path_t *path = report_item->usage_path; 
     187        usb_hid_report_path_t *path = report_item->usage_path;
    188188        for(i=0; i<report_item->count; i++){
    189189
     
    196196                link_initialize(&field->ritems_link);
    197197
    198                 /* fill the attributes */               
     198                /* fill the attributes */
    199199                field->logical_minimum = report_item->logical_minimum;
    200200                field->logical_maximum = report_item->logical_maximum;
     
    203203
    204204                if(USB_HID_ITEM_FLAG_VARIABLE(report_item->item_flags) == 0){
    205                         /* 
     205                        /*
    206206                        Store usage array. The Correct Usage Page and Usage is
    207207                        depending on data in report and will be filled later
     
    223223                        else {
    224224                                usage = report_item->usages[
    225                                         report_item->usages_count- 1]; 
     225                                        report_item->usages_count- 1];
    226226                        }
    227227
    228228                        if(USB_HID_IS_EXTENDED_USAGE(usage)){
    229229                                field->usage = USB_HID_EXTENDED_USAGE(usage);
    230                                 field->usage_page = 
     230                                field->usage_page =
    231231                                        USB_HID_EXTENDED_USAGE_PAGE(usage);
    232232                        }
     
    324324            usb_hid_report_description_t, report_des) {
    325325                // if report id not set, return the first of the type
    326                 if(((report_des->report_id == report_id) || (report_id == 0)) && 
    327                    (report_des->type == type)) { 
     326                if(((report_des->report_id == report_id) || (report_id == 0)) &&
     327                   (report_des->type == type)) {
    328328                        return report_des;
    329329                }
     
    343343 * @retval EOK If report descriptor is successfully parsed
    344344 */
    345 errno_t usb_hid_parse_report_descriptor(usb_hid_report_t *report, 
     345errno_t usb_hid_parse_report_descriptor(usb_hid_report_t *report,
    346346    const uint8_t *data, size_t size)
    347347{
     
    352352        int ret;
    353353        usb_hid_report_item_t *report_item=0;
    354         usb_hid_report_item_t *new_report_item; 
     354        usb_hid_report_item_t *new_report_item;
    355355        usb_hid_report_path_t *usage_path;
    356356
     
    380380                return ENOMEM;
    381381        }
    382         usb_hid_report_path_append_item(usage_path, 0, 0);     
    383        
    384         while(i<size){ 
     382        usb_hid_report_path_append_item(usage_path, 0, 0);
     383       
     384        while(i<size){
    385385                if(!USB_HID_ITEM_IS_LONG(data[i])){
    386386
     
    412412                                switch(tag) {
    413413                                case USB_HID_REPORT_TAG_INPUT:
    414                                         report_item->type = 
     414                                        report_item->type =
    415415                                            USB_HID_REPORT_TYPE_INPUT;
    416416
    417417                                        report_item->offset = offset_input;
    418                                         offset_input += report_item->count * 
     418                                        offset_input += report_item->count *
    419419                                            report_item->size;
    420420                                        break;
    421421       
    422422                                case USB_HID_REPORT_TAG_OUTPUT:
    423                                         report_item->type = 
     423                                        report_item->type =
    424424                                            USB_HID_REPORT_TYPE_OUTPUT;
    425425                                       
    426426                                        report_item->offset = offset_output;
    427                                         offset_output += report_item->count * 
     427                                        offset_output += report_item->count *
    428428                                            report_item->size;
    429429                                        break;
    430430       
    431431                                case USB_HID_REPORT_TAG_FEATURE:
    432                                         report_item->type = 
     432                                        report_item->type =
    433433                                            USB_HID_REPORT_TYPE_FEATURE;
    434434
    435435                                        report_item->offset = offset_feature;
    436                                         offset_feature += report_item->count * 
     436                                        offset_feature += report_item->count *
    437437                                                report_item->size;
    438438                                        break;
     
    444444                                }
    445445                                       
    446                                 /* 
    447                                  * append new fields to the report structure                                     
     446                                /*
     447                                 * append new fields to the report structure
    448448                                 */
    449                                 usb_hid_report_append_fields(report, 
     449                                usb_hid_report_append_fields(report,
    450450                                    report_item);
    451451
     
    458458                                offset_output = 0;
    459459                                offset_feature = 0;
    460                                 usb_hid_report_path_set_report_id (usage_path, 
     460                                usb_hid_report_path_set_report_id (usage_path,
    461461                                    report_item->id);
    462462                                break;
     
    467467                                    report_item);
    468468                               
    469                                 usb_hid_report_path_t *tmp_path = 
     469                                usb_hid_report_path_t *tmp_path =
    470470                                    usb_hid_report_path_clone(usage_path);
    471471
    472                                 new_report_item->usage_path = tmp_path; 
     472                                new_report_item->usage_path = tmp_path;
    473473
    474474                                list_prepend (&new_report_item->link, &stack);
     
    490490                                    usb_hid_report_usage_path_t, rpath_items_link);
    491491                               
    492                                 usb_hid_report_set_last_item(usage_path, 
     492                                usb_hid_report_set_last_item(usage_path,
    493493                                    USB_HID_TAG_CLASS_GLOBAL, tmp_usage_path->usage_page);
    494494                               
    495                                 usb_hid_report_set_last_item(usage_path, 
     495                                usb_hid_report_set_last_item(usage_path,
    496496                                    USB_HID_TAG_CLASS_LOCAL, tmp_usage_path->usage);
    497497
     
    502502                                       
    503503                        default:
    504                                 // nothing special to do                                       
     504                                // nothing special to do
    505505                                break;
    506506                        }
     
    533533int usb_hid_report_parse_tag(uint8_t tag, uint8_t class, const uint8_t *data,
    534534        size_t item_size, usb_hid_report_item_t *report_item,
    535         usb_hid_report_path_t *usage_path) {   
     535        usb_hid_report_path_t *usage_path) {
    536536       
    537537        int ret;
     
    550550                break;
    551551
    552         case USB_HID_TAG_CLASS_GLOBAL: 
     552        case USB_HID_TAG_CLASS_GLOBAL:
    553553                return usb_hid_report_parse_global_tag(tag, data, item_size,
    554554                        report_item, usage_path);
    555555                break;
    556556
    557         case USB_HID_TAG_CLASS_LOCAL:                   
     557        case USB_HID_TAG_CLASS_LOCAL:
    558558                return usb_hid_report_parse_local_tag(tag, data, item_size,
    559559                        report_item, usage_path);
     
    575575 */
    576576
    577 int usb_hid_report_parse_main_tag(uint8_t tag, const uint8_t *data, 
     577int usb_hid_report_parse_main_tag(uint8_t tag, const uint8_t *data,
    578578        size_t item_size, usb_hid_report_item_t *report_item,
    579579        usb_hid_report_path_t *usage_path)
     
    586586        case USB_HID_REPORT_TAG_OUTPUT:
    587587        case USB_HID_REPORT_TAG_FEATURE:
    588                 report_item->item_flags = *data;                       
    589                 return 0;                       
     588                report_item->item_flags = *data;
     589                return 0;
    590590                break;
    591591                       
     
    598598                       
    599599                /* set last item */
    600                 usb_hid_report_set_last_item(usage_path, 
    601                         USB_HID_TAG_CLASS_GLOBAL, 
     600                usb_hid_report_set_last_item(usage_path,
     601                        USB_HID_TAG_CLASS_GLOBAL,
    602602                        USB_HID_EXTENDED_USAGE_PAGE(report_item->usages[
    603603                                report_item->usages_count-1]));
    604604
    605                 usb_hid_report_set_last_item(usage_path, 
    606                         USB_HID_TAG_CLASS_LOCAL, 
     605                usb_hid_report_set_last_item(usage_path,
     606                        USB_HID_TAG_CLASS_LOCAL,
    607607                        USB_HID_EXTENDED_USAGE(report_item->usages[
    608608                                report_item->usages_count-1]));
     
    610610                /* append the new one which will be set by common usage/usage
    611611                 * page */
    612                 usb_hid_report_path_append_item(usage_path, 
    613                         report_item->usage_page, 
     612                usb_hid_report_path_append_item(usage_path,
     613                        report_item->usage_page,
    614614                        report_item->usages[report_item->usages_count-1]);
    615615
     
    639639 * @return 0 or USB_HID_ code
    640640 */
    641 int usb_hid_report_parse_global_tag(uint8_t tag, const uint8_t *data, 
    642         size_t item_size, usb_hid_report_item_t *report_item, 
    643         usb_hid_report_path_t *usage_path) { 
     641int usb_hid_report_parse_global_tag(uint8_t tag, const uint8_t *data,
     642        size_t item_size, usb_hid_report_item_t *report_item,
     643        usb_hid_report_path_t *usage_path) {
    644644       
    645645        switch(tag)
    646646        {
    647647        case USB_HID_REPORT_TAG_USAGE_PAGE:
    648                 report_item->usage_page = 
     648                report_item->usage_page =
    649649                        usb_hid_report_tag_data_uint32(data, item_size);
    650650                break;
     
    658658        case USB_HID_REPORT_TAG_LOGICAL_MAXIMUM:
    659659                report_item->logical_maximum = USB_HID_UINT32_TO_INT32(
    660                         usb_hid_report_tag_data_uint32(data,item_size), 
     660                        usb_hid_report_tag_data_uint32(data,item_size),
    661661                        item_size * 8);
    662662                break;
     
    664664        case USB_HID_REPORT_TAG_PHYSICAL_MINIMUM:
    665665                report_item->physical_minimum = USB_HID_UINT32_TO_INT32(
    666                         usb_hid_report_tag_data_uint32(data,item_size), 
     666                        usb_hid_report_tag_data_uint32(data,item_size),
    667667                        item_size * 8);
    668                 break;                 
     668                break;
    669669
    670670        case USB_HID_REPORT_TAG_PHYSICAL_MAXIMUM:
    671671                report_item->physical_maximum = USB_HID_UINT32_TO_INT32(
    672                         usb_hid_report_tag_data_uint32(data,item_size), 
     672                        usb_hid_report_tag_data_uint32(data,item_size),
    673673                        item_size * 8);
    674674                break;
     
    695695
    696696        case USB_HID_REPORT_TAG_REPORT_ID:
    697                 report_item->id = usb_hid_report_tag_data_uint32(data, 
     697                report_item->id = usb_hid_report_tag_data_uint32(data,
    698698                        item_size);
    699699                return USB_HID_RESET_OFFSET;
     
    702702        case USB_HID_REPORT_TAG_PUSH:
    703703        case USB_HID_REPORT_TAG_POP:
    704                 /* 
     704                /*
    705705                 * stack operations are done in top level parsing
    706706                 * function
     
    943943
    944944
    945 /** Frees the HID report descriptor parser structure 
     945/** Frees the HID report descriptor parser structure
    946946 *
    947947 * @param parser Opaque HID report parser structure
Note: See TracChangeset for help on using the changeset viewer.