Changeset a35b458 in mainline for uspace/lib/usbhid/src/hidreport.c


Ignore:
Timestamp:
2018-03-02T20:10:49Z (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:
f1380b7
Parents:
3061bc1
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-02-28 17:38:31)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-03-02 20:10:49)
Message:

style: Remove trailing whitespace on _all_ lines, including empty ones, for particular file types.

Command used: tools/srepl '\s\+$' '' -- *.c *.h *.py *.sh *.s *.S *.ag

Currently, whitespace on empty lines is very inconsistent.
There are two basic choices: Either remove the whitespace, or keep empty lines
indented to the level of surrounding code. The former is AFAICT more common,
and also much easier to do automatically.

Alternatively, we could write script for automatic indentation, and use that
instead. However, if such a script exists, it's possible to use the indented
style locally, by having the editor apply relevant conversions on load/save,
without affecting remote repository. IMO, it makes more sense to adopt
the simpler rule.

File:
1 edited

Legend:

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

    r3061bc1 ra35b458  
    5555        assert(report_desc != NULL);
    5656        assert(size != NULL);
    57        
     57
    5858        usb_dp_parser_t parser =  {
    5959                .nesting = usb_dp_standard_descriptor_nesting
    6060        };
    61        
     61
    6262        usb_dp_parser_data_t parser_data = {
    6363                .data = usb_device_descriptors(dev)->full_config,
     
    6565                .arg = NULL
    6666        };
    67        
     67
    6868        /*
    6969         * First nested descriptor of the configuration descriptor.
     
    7272            usb_dp_get_nested_descriptor(&parser, &parser_data,
    7373            usb_device_descriptors(dev)->full_config);
    74        
     74
    7575        /*
    7676         * Find the interface descriptor corresponding to our interface number.
     
    8282                ++i;
    8383        }
    84        
     84
    8585        if (d == NULL) {
    8686                usb_log_error("The %d. interface descriptor not found!",
     
    8888                return ENOENT;
    8989        }
    90        
     90
    9191        /*
    9292         * First nested descriptor of the interface descriptor.
     
    9494        const uint8_t *iface_desc = d;
    9595        d = usb_dp_get_nested_descriptor(&parser, &parser_data, iface_desc);
    96        
     96
    9797        /*
    9898         * Search through siblings until the HID descriptor is found.
     
    102102                    iface_desc, d);
    103103        }
    104        
     104
    105105        if (d == NULL) {
    106106                usb_log_fatal("No HID descriptor found!");
    107107                return ENOENT;
    108108        }
    109        
     109
    110110        if (*d != sizeof(usb_standard_hid_descriptor_t)) {
    111111                usb_log_error("HID descriptor has wrong size (%u, expected %zu"
     
    113113                return EINVAL;
    114114        }
    115        
     115
    116116        usb_standard_hid_descriptor_t *hid_desc =
    117117            (usb_standard_hid_descriptor_t *)d;
    118        
     118
    119119        uint16_t length = uint16_usb2host(hid_desc->report_desc_info.length);
    120120        size_t actual_size = 0;
     
    129129                return ENOMEM;
    130130        }
    131        
     131
    132132        usb_log_debug("Getting Report descriptor, expected size: %u", length);
    133        
     133
    134134        /*
    135135         * Get the descriptor from the device.
     
    153153                return EINVAL;
    154154        }
    155        
     155
    156156        *size = length;
    157        
     157
    158158        usb_log_debug("Done.");
    159        
     159
    160160        return EOK;
    161161}
     
    171171                return EINVAL;
    172172        }
    173        
     173
    174174//      uint8_t *report_desc = NULL;
    175175//      size_t report_size;
    176        
     176
    177177        errno_t rc = usb_hid_get_report_descriptor(dev, report_desc, report_size);
    178        
     178
    179179        if (rc != EOK) {
    180180                usb_log_error("Problem with getting Report descriptor: %s.",
     
    186186                return rc;
    187187        }
    188        
     188
    189189        assert(*report_desc != NULL);
    190        
     190
    191191        rc = usb_hid_parse_report_descriptor(report, *report_desc, *report_size);
    192192        if (rc != EOK) {
     
    197197                return rc;
    198198        }
    199        
     199
    200200        usb_hid_descriptor_print(report);
    201        
     201
    202202        return EOK;
    203203}
Note: See TracChangeset for help on using the changeset viewer.