Ignore:
Timestamp:
2012-08-14T18:16:39Z (12 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
669f5cae
Parents:
76d92db1 (diff), 4802dd7 (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.
Message:

Merge mainline changes

File:
1 edited

Legend:

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

    r76d92db1 rcddcc4a3  
    5454#define NAME "mouse"
    5555
    56 /*----------------------------------------------------------------------------*/
     56static void default_connection_handler(ddf_fun_t *, ipc_callid_t, ipc_call_t *);
     57
     58static ddf_dev_ops_t ops = { .default_handler = default_connection_handler };
     59
    5760
    5861const usb_endpoint_description_t usb_hid_mouse_poll_endpoint_description = {
     
    7174static const uint8_t IDLE_RATE = 0;
    7275
    73 /*----------------------------------------------------------------------------*/
     76
    7477static const uint8_t USB_MOUSE_BOOT_REPORT_DESCRIPTOR[] = {
    7578        0x05, 0x01,                    // USAGE_PAGE (Generic Desktop)
     
    101104};
    102105
    103 /*----------------------------------------------------------------------------*/
     106
    104107
    105108/** Default handler for IPC methods not handled by DDF.
     
    143146        }
    144147}
    145 /*----------------------------------------------------------------------------*/
     148
    146149static int get_mouse_axis_move_value(uint8_t rid, usb_hid_report_t *report,
    147150    int32_t usage)
     
    221224                assert(index < mouse_dev->buttons_count);
    222225
    223                 if (mouse_dev->buttons[index] == 0 && field->value != 0) {
     226                if (mouse_dev->buttons[index] != field->value) {
    224227                        async_exch_t *exch =
    225228                            async_exchange_begin(mouse_dev->mouse_sess);
    226229                        if (exch != NULL) {
    227230                                async_req_2_0(exch, MOUSEEV_BUTTON_EVENT,
    228                                     field->usage, 1);
    229                                 async_exchange_end(exch);
    230                                 mouse_dev->buttons[index] = field->value;
    231                         }
    232 
    233                 } else if (mouse_dev->buttons[index] != 0 && field->value == 0) {
    234                         async_exch_t *exch =
    235                             async_exchange_begin(mouse_dev->mouse_sess);
    236                         if (exch != NULL) {
    237                                 async_req_2_0(exch, MOUSEEV_BUTTON_EVENT,
    238                                     field->usage, 0);
     231                                    field->usage, (field->value != 0) ? 1 : 0);
    239232                                async_exchange_end(exch);
    240233                                mouse_dev->buttons[index] = field->value;
     
    252245        return true;
    253246}
    254 /*----------------------------------------------------------------------------*/
     247
    255248#define FUN_UNBIND_DESTROY(fun) \
    256249if (fun) { \
     
    263256        } \
    264257} else (void)0
    265 /*----------------------------------------------------------------------------*/
     258
    266259static int usb_mouse_create_function(usb_hid_dev_t *hid_dev, usb_mouse_t *mouse)
    267260{
     
    279272        }
    280273
    281         fun->ops = &mouse->ops;
     274        fun->ops = &ops;
    282275        fun->driver_data = mouse;
    283276
     
    302295        }
    303296        mouse->mouse_fun = fun;
    304 
    305297        return EOK;
    306298}
     
    345337        return highest_button;
    346338}
    347 /*----------------------------------------------------------------------------*/
     339
    348340int usb_mouse_init(usb_hid_dev_t *hid_dev, void **data)
    349341{
     
    379371        }
    380372
    381         // set handler for incoming calls
    382         mouse_dev->ops.default_handler = default_connection_handler;
    383 
    384373        // TODO: how to know if the device supports the request???
    385374        usbhid_req_set_idle(&hid_dev->usb_dev->ctrl_pipe,
     
    398387        return EOK;
    399388}
    400 /*----------------------------------------------------------------------------*/
     389
    401390bool usb_mouse_polling_callback(usb_hid_dev_t *hid_dev, void *data)
    402391{
     
    411400        return usb_mouse_process_report(hid_dev, mouse_dev);
    412401}
    413 /*----------------------------------------------------------------------------*/
     402
    414403void usb_mouse_deinit(usb_hid_dev_t *hid_dev, void *data)
    415404{
     
    432421        free(mouse_dev);
    433422}
    434 /*----------------------------------------------------------------------------*/
     423
    435424int usb_mouse_set_boot_protocol(usb_hid_dev_t *hid_dev)
    436425{
Note: See TracChangeset for help on using the changeset viewer.