Ignore:
Timestamp:
2011-10-14T12:40:31Z (13 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
e5024111
Parents:
3002434
Message:

usbhid: Remove tabs on empty lines. diff -w shows no changes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/usbhid/mouse/mousedev.c

    r3002434 rcc29622  
    124124{
    125125        usb_mouse_t *mouse_dev = (usb_mouse_t *) fun->driver_data;
    126        
     126
    127127        if (mouse_dev == NULL) {
    128128                usb_log_debug("default_connection_handler: Missing "
     
    131131                return;
    132132        }
    133        
     133
    134134        usb_log_debug("default_connection_handler: fun->name: %s\n",
    135135                      fun->name);
    136136        usb_log_debug("default_connection_handler: mouse_sess: %p, "
    137137            "wheel_sess: %p\n", mouse_dev->mouse_sess, mouse_dev->wheel_sess);
    138        
     138
    139139        async_sess_t **sess_ptr =
    140140            (str_cmp(fun->name, HID_MOUSE_FUN_NAME) == 0) ?
    141141            &mouse_dev->mouse_sess : &mouse_dev->wheel_sess;
    142        
     142
    143143        async_sess_t *sess =
    144144            async_callback_receive_start(EXCHANGE_SERIALIZE, icall);
     
    170170        mouse->mouse_sess = NULL;
    171171        mouse->wheel_sess = NULL;
    172        
     172
    173173        return mouse;
    174174}
     
    179179{
    180180        assert(mouse_dev != NULL);
    181        
     181
    182182        // hangup session to the console
    183183        if (mouse_dev->mouse_sess != NULL)
    184184                async_hangup(mouse_dev->mouse_sess);
    185        
     185
    186186        if (mouse_dev->wheel_sess != NULL)
    187187                async_hangup(mouse_dev->wheel_sess);
     
    199199                return;
    200200        }
    201        
     201
    202202        int count = ((wheel < 0) ? -wheel : wheel) * ARROWS_PER_SINGLE_WHEEL;
    203203        int i;
    204        
     204
    205205        for (i = 0; i < count; i++) {
    206206                /* Send arrow press and release. */
     
    246246{
    247247        assert(mouse_dev != NULL);
    248        
     248
    249249        if (mouse_dev->mouse_sess == NULL) {
    250250                usb_log_warning(NAME " No console session.\n");
     
    264264                async_exchange_end(exch);
    265265        }
    266        
     266
    267267        if (wheel != 0)
    268268                usb_mouse_send_wheel(mouse_dev, wheel);
    269        
     269
    270270        /*
    271271         * Buttons
     
    274274        usb_hid_report_path_append_item(path, USB_HIDUT_PAGE_BUTTON, 0);
    275275        usb_hid_report_path_set_report_id(path, hid_dev->report_id);
    276        
     276
    277277        usb_hid_report_field_t *field = usb_hid_report_get_sibling(
    278278            hid_dev->report, NULL, path, USB_HID_PATH_COMPARE_END
     
    309309                    USB_HID_REPORT_TYPE_INPUT);
    310310        }
    311        
     311
    312312        usb_hid_report_path_free(path);
    313313
     
    321321        assert(hid_dev != NULL);
    322322        assert(mouse != NULL);
    323        
     323
    324324        /* Create the exposed function. */
    325325        usb_log_debug("Creating DDF function %s...\n", HID_MOUSE_FUN_NAME);
     
    330330                return ENOMEM;
    331331        }
    332        
     332
    333333        fun->ops = &mouse->ops;
    334334        fun->driver_data = mouse;
     
    341341                return rc;
    342342        }
    343        
     343
    344344        usb_log_debug("Adding DDF function to category %s...\n",
    345345            HID_MOUSE_CATEGORY);
     
    352352                return rc;
    353353        }
    354        
     354
    355355        /*
    356356         * Special function for acting as keyboard (wheel)
     
    364364                return ENOMEM;
    365365        }
    366        
     366
    367367        /*
    368368         * Store the initialized HID device and HID ops
     
    379379                return rc;
    380380        }
    381        
     381
    382382        usb_log_debug("Adding DDF function to category %s...\n",
    383383            HID_MOUSE_WHEEL_CATEGORY);
     
    390390                return rc;
    391391        }
    392        
     392
    393393        return EOK;
    394394}
     
    441441{
    442442        usb_log_debug("Initializing HID/Mouse structure...\n");
    443        
     443
    444444        if (hid_dev == NULL) {
    445445                usb_log_error("Failed to init keyboard structure: no structure"
     
    447447                return EINVAL;
    448448        }
    449        
     449
    450450        usb_mouse_t *mouse_dev = usb_mouse_new();
    451451        if (mouse_dev == NULL) {
     
    454454                return ENOMEM;
    455455        }
    456        
     456
    457457        // FIXME: This may not be optimal since stupid hardware vendor may
    458458        // use buttons 1, 2, 3 and 6000 and we would allocate array of
     
    464464            hid_dev->report_id) + 1;
    465465        mouse_dev->buttons = calloc(mouse_dev->buttons_count, sizeof(int32_t));
    466        
     466
    467467        if (mouse_dev->buttons == NULL) {
    468468                usb_log_error(NAME ": out of memory, giving up on device!\n");
     
    474474        // save the Mouse device structure into the HID device structure
    475475        *data = mouse_dev;
    476        
     476
    477477        // set handler for incoming calls
    478478        mouse_dev->ops.default_handler = default_connection_handler;
    479        
     479
    480480        // TODO: how to know if the device supports the request???
    481481        usbhid_req_set_idle(&hid_dev->usb_dev->ctrl_pipe,
    482482            hid_dev->usb_dev->interface_no, IDLE_RATE);
    483        
     483
    484484        int rc = usb_mouse_create_function(hid_dev, mouse_dev);
    485485        if (rc != EOK) {
     
    487487                return rc;
    488488        }
    489        
     489
    490490        return EOK;
    491491}
     
    500500                return false;
    501501        }
    502        
     502
    503503        usb_mouse_t *mouse_dev = (usb_mouse_t *)data;
    504504               
     
    522522            USB_MOUSE_BOOT_REPORT_DESCRIPTOR,
    523523            USB_MOUSE_BOOT_REPORT_DESCRIPTOR_SIZE);
    524        
     524
    525525        if (rc != EOK) {
    526526                usb_log_error("Failed to parse boot report descriptor: %s\n",
     
    528528                return rc;
    529529        }
    530        
     530
    531531        rc = usbhid_req_set_protocol(&hid_dev->usb_dev->ctrl_pipe,
    532532            hid_dev->usb_dev->interface_no, USB_HID_PROTOCOL_BOOT);
    533        
     533
    534534        if (rc != EOK) {
    535535                usb_log_warning("Failed to set boot protocol to the device: "
     
    537537                return rc;
    538538        }
    539        
     539
    540540        return EOK;
    541541}
Note: See TracChangeset for help on using the changeset viewer.