Changeset 8565a42 in mainline for uspace/app/mkbd


Ignore:
Timestamp:
2018-03-02T20:34:50Z (8 years ago)
Author:
GitHub <noreply@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a1a81f69, d5e5fd1
Parents:
3061bc1 (diff), 34e1206 (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.
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-03-02 20:34:50)
git-committer:
GitHub <noreply@…> (2018-03-02 20:34:50)
Message:

Remove all trailing whitespace, everywhere.

See individual commit messages for details.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/mkbd/main.c

    r3061bc1 r8565a42  
    6666        if (*report == NULL)
    6767                return ENOMEM;
    68        
     68
    6969        errno_t rc = usb_hid_report_init(*report);
    7070        if (rc != EOK) {
     
    7373                return rc;
    7474        }
    75        
     75
    7676        /* Get the report descriptor length from the device */
    7777        size_t report_desc_size;
     
    8383                return rc;
    8484        }
    85        
     85
    8686        if (report_desc_size == 0) {
    8787                usb_hid_report_deinit(*report);
     
    9090                return EINVAL;
    9191        }
    92        
     92
    9393        uint8_t *desc = (uint8_t *) malloc(report_desc_size);
    9494        if (desc == NULL) {
     
    9797                return ENOMEM;
    9898        }
    99        
     99
    100100        /* Get the report descriptor from the device */
    101101        size_t actual_size;
     
    108108                return rc;
    109109        }
    110        
     110
    111111        if (actual_size != report_desc_size) {
    112112                usb_hid_report_deinit(*report);
     
    116116                return EINVAL;
    117117        }
    118        
     118
    119119        /* Initialize the report parser */
    120        
     120
    121121        rc = usb_hid_parse_report_descriptor(*report, desc, report_desc_size);
    122122        free(desc);
    123        
     123
    124124        return rc;
    125125}
     
    129129        assert(buffer != NULL);
    130130        assert(report != NULL);
    131        
     131
    132132        uint8_t report_id;
    133133        errno_t rc = usb_hid_parse_report(report, buffer, size, &report_id);
    134134        if (rc != EOK)
    135135                return;
    136        
     136
    137137        usb_hid_report_path_t *path = usb_hid_report_path();
    138138        if (path == NULL) {
    139139                return;
    140140        }
    141        
     141
    142142        usb_hid_report_path_append_item(path, USB_HIDUT_PAGE_CONSUMER, 0);
    143        
     143
    144144        usb_hid_report_path_set_report_id(path, report_id);
    145145
     
    148148            | USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY,
    149149            USB_HID_REPORT_TYPE_INPUT);
    150        
     150
    151151        while (field != NULL) {
    152152                if (field->value != 0) {
     
    155155                        printf("Pressed key: %s\n", key_str);
    156156                }
    157                
     157
    158158                field = usb_hid_report_get_sibling(
    159159                    report, field, path, USB_HID_PATH_COMPARE_END
     
    161161                    USB_HID_REPORT_TYPE_INPUT);
    162162        }
    163        
     163
    164164        usb_hid_report_path_free(path);
    165165}
     
    208208{
    209209        int act_event = -1;
    210        
     210
    211211        if (argc <= 1) {
    212212                print_usage(argv[0]);
    213213                return -1;
    214214        }
    215        
     215
    216216        char *devpath = argv[1];
    217        
     217
    218218        devman_handle_t dev_handle = 0;
    219        
     219
    220220        errno_t rc = usb_resolve_device_handle(devpath, &dev_handle);
    221221        if (rc != EOK) {
     
    224224                return rc;
    225225        }
    226        
     226
    227227        async_sess_t *sess = devman_device_connect(dev_handle, 0);
    228228        if (!sess) {
     
    231231                return errno;
    232232        }
    233        
     233
    234234        dev_sess = sess;
    235        
     235
    236236        char path[MAX_PATH_LENGTH];
    237237        rc = devman_fun_get_path(dev_handle, path, MAX_PATH_LENGTH);
     
    241241                return ENOMEM;
    242242        }
    243        
     243
    244244        printf("Device path: %s\n", path);
    245        
    246        
     245
     246
    247247        usb_hid_report_t *report = NULL;
    248248        rc = initialize_report_parser(dev_sess, &report);
     
    252252                return rc;
    253253        }
    254        
     254
    255255        assert(report != NULL);
    256        
     256
    257257        size_t size;
    258258        rc = usbhid_dev_get_event_length(dev_sess, &size);
     
    261261                return rc;
    262262        }
    263        
     263
    264264        uint8_t *event = (uint8_t *)malloc(size);
    265265        if (event == NULL) {
     
    268268                return ENOMEM;
    269269        }
    270        
     270
    271271        fid_t quit_fibril = fibril_create(wait_for_quit_fibril, NULL);
    272272        if (quit_fibril == 0) {
     
    278278        size_t actual_size;
    279279        int event_nr;
    280        
     280
    281281        while (true) {
    282282                /** @todo Try blocking call. */
     
    289289                        break;
    290290                }
    291                
     291
    292292                if (event_nr > act_event) {
    293293                        print_key(event, size, report);
    294294                        act_event = event_nr;
    295295                }
    296                
     296
    297297                async_usleep(10000);
    298298        }
    299        
     299
    300300        return 0;
    301301}
Note: See TracChangeset for help on using the changeset viewer.