Changeset da68871a in mainline for uspace/drv/bus/usb/usbhid/mouse/mousedev.c
- Timestamp:
- 2012-08-08T08:46:22Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 30c0826
- Parents:
- bc216a0 (diff), 1d01cca (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. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/usbhid/mouse/mousedev.c
rbc216a0 rda68871a 54 54 #define NAME "mouse" 55 55 56 /*----------------------------------------------------------------------------*/ 56 static void default_connection_handler(ddf_fun_t *, ipc_callid_t, ipc_call_t *); 57 58 static ddf_dev_ops_t ops = { .default_handler = default_connection_handler }; 59 57 60 58 61 const usb_endpoint_description_t usb_hid_mouse_poll_endpoint_description = { … … 71 74 static const uint8_t IDLE_RATE = 0; 72 75 73 /*----------------------------------------------------------------------------*/ 76 74 77 static const uint8_t USB_MOUSE_BOOT_REPORT_DESCRIPTOR[] = { 75 78 0x05, 0x01, // USAGE_PAGE (Generic Desktop) … … 101 104 }; 102 105 103 /*----------------------------------------------------------------------------*/ 106 104 107 105 108 /** Default handler for IPC methods not handled by DDF. … … 143 146 } 144 147 } 145 /*----------------------------------------------------------------------------*/ 148 146 149 static int get_mouse_axis_move_value(uint8_t rid, usb_hid_report_t *report, 147 150 int32_t usage) … … 221 224 assert(index < mouse_dev->buttons_count); 222 225 223 if (mouse_dev->buttons[index] == 0 && field->value != 0) {226 if (mouse_dev->buttons[index] != field->value) { 224 227 async_exch_t *exch = 225 228 async_exchange_begin(mouse_dev->mouse_sess); 226 229 if (exch != NULL) { 227 230 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); 239 232 async_exchange_end(exch); 240 233 mouse_dev->buttons[index] = field->value; … … 252 245 return true; 253 246 } 254 /*----------------------------------------------------------------------------*/ 247 255 248 #define FUN_UNBIND_DESTROY(fun) \ 256 249 if (fun) { \ … … 263 256 } \ 264 257 } else (void)0 265 /*----------------------------------------------------------------------------*/ 258 266 259 static int usb_mouse_create_function(usb_hid_dev_t *hid_dev, usb_mouse_t *mouse) 267 260 { … … 279 272 } 280 273 281 fun->ops = & mouse->ops;274 fun->ops = &ops; 282 275 fun->driver_data = mouse; 283 276 … … 302 295 } 303 296 mouse->mouse_fun = fun; 304 305 297 return EOK; 306 298 } … … 345 337 return highest_button; 346 338 } 347 /*----------------------------------------------------------------------------*/ 339 348 340 int usb_mouse_init(usb_hid_dev_t *hid_dev, void **data) 349 341 { … … 379 371 } 380 372 381 // set handler for incoming calls382 mouse_dev->ops.default_handler = default_connection_handler;383 384 373 // TODO: how to know if the device supports the request??? 385 374 usbhid_req_set_idle(&hid_dev->usb_dev->ctrl_pipe, … … 398 387 return EOK; 399 388 } 400 /*----------------------------------------------------------------------------*/ 389 401 390 bool usb_mouse_polling_callback(usb_hid_dev_t *hid_dev, void *data) 402 391 { … … 411 400 return usb_mouse_process_report(hid_dev, mouse_dev); 412 401 } 413 /*----------------------------------------------------------------------------*/ 402 414 403 void usb_mouse_deinit(usb_hid_dev_t *hid_dev, void *data) 415 404 { … … 432 421 free(mouse_dev); 433 422 } 434 /*----------------------------------------------------------------------------*/ 423 435 424 int usb_mouse_set_boot_protocol(usb_hid_dev_t *hid_dev) 436 425 {
Note:
See TracChangeset
for help on using the changeset viewer.