Changeset e3e0953 in mainline
- Timestamp:
- 2011-11-07T08:27:24Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 07498c1
- Parents:
- 5723ae49
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/usbhid/mouse/mousedev.c
r5723ae49 re3e0953 220 220 } 221 221 222 int shift_x = get_mouse_axis_move_value(hid_dev->report_id,222 const int shift_x = get_mouse_axis_move_value(hid_dev->report_id, 223 223 &hid_dev->report, USB_HIDUT_USAGE_GENERIC_DESKTOP_X); 224 int shift_y = get_mouse_axis_move_value(hid_dev->report_id,224 const int shift_y = get_mouse_axis_move_value(hid_dev->report_id, 225 225 &hid_dev->report, USB_HIDUT_USAGE_GENERIC_DESKTOP_Y); 226 int wheel = get_mouse_axis_move_value(hid_dev->report_id,226 const int wheel = get_mouse_axis_move_value(hid_dev->report_id, 227 227 &hid_dev->report, USB_HIDUT_USAGE_GENERIC_DESKTOP_WHEEL); 228 228 … … 230 230 async_exch_t *exch = 231 231 async_exchange_begin(mouse_dev->mouse_sess); 232 async_req_2_0(exch, MOUSEEV_MOVE_EVENT, shift_x, shift_y); 233 async_exchange_end(exch); 232 if (exch != NULL) { 233 async_req_2_0(exch, MOUSEEV_MOVE_EVENT, shift_x, shift_y); 234 async_exchange_end(exch); 235 } 234 236 } 235 237 … … 237 239 usb_mouse_send_wheel(mouse_dev, wheel); 238 240 239 /* 240 * Buttons 241 */ 241 /* Buttons */ 242 242 usb_hid_report_path_t *path = usb_hid_report_path(); 243 usb_hid_report_path_append_item(path, USB_HIDUT_PAGE_BUTTON, 0); 243 if (path == NULL) { 244 usb_log_warning("Failed to create USB HID report path.\n"); 245 return true; 246 } 247 int ret = 248 usb_hid_report_path_append_item(path, USB_HIDUT_PAGE_BUTTON, 0); 249 if (ret != EOK) { 250 usb_hid_report_path_free(path); 251 usb_log_warning("Failed to add buttons to report path.\n"); 252 return true; 253 } 244 254 usb_hid_report_path_set_report_id(path, hid_dev->report_id); 245 255 … … 254 264 const unsigned index = field->usage - field->usage_minimum; 255 265 assert(index < mouse_dev->buttons_count); 256 266 257 267 if (mouse_dev->buttons[index] == 0 && field->value != 0) { 258 268 async_exch_t *exch = 259 269 async_exchange_begin(mouse_dev->mouse_sess); 260 async_req_2_0(exch, MOUSEEV_BUTTON_EVENT, field->usage, 1); 261 async_exchange_end(exch); 262 263 mouse_dev->buttons[index] = field->value; 270 if (exch != NULL) { 271 async_req_2_0(exch, MOUSEEV_BUTTON_EVENT, 272 field->usage, 1); 273 async_exchange_end(exch); 274 mouse_dev->buttons[index] = field->value; 275 } 276 264 277 } else if (mouse_dev->buttons[index] != 0 && field->value == 0) { 265 278 async_exch_t *exch = 266 279 async_exchange_begin(mouse_dev->mouse_sess); 267 async_req_2_0(exch, MOUSEEV_BUTTON_EVENT, field->usage, 0); 268 async_exchange_end(exch); 269 270 mouse_dev->buttons[index] = field->value; 280 if (exch != NULL) { 281 async_req_2_0(exch, MOUSEEV_BUTTON_EVENT, 282 field->usage, 0); 283 async_exchange_end(exch); 284 mouse_dev->buttons[index] = field->value; 285 } 271 286 } 272 287 … … 336 351 mouse->mouse_fun->driver_data = NULL; 337 352 ddf_fun_destroy(mouse->mouse_fun); 353 mouse->mouse_fun = NULL; 338 354 return ENOMEM; 339 355 } … … 353 369 mouse->mouse_fun->driver_data = NULL; 354 370 ddf_fun_destroy(mouse->mouse_fun); 371 mouse->mouse_fun = NULL; 355 372 fun->driver_data = NULL; 356 373 ddf_fun_destroy(fun); … … 368 385 mouse->mouse_fun->driver_data = NULL; 369 386 ddf_fun_destroy(mouse->mouse_fun); 387 mouse->mouse_fun = NULL; 370 388 ddf_fun_unbind(fun); 371 389 fun->driver_data = NULL; … … 438 456 return ENOMEM; 439 457 } 440 mouse_dev->mouse_sess = NULL;441 mouse_dev->wheel_sess = NULL;442 mouse_dev->buttons = NULL;443 mouse_dev->buttons_count = 0;444 458 445 459 // FIXME: This may not be optimal since stupid hardware vendor may … … 484 498 { 485 499 if (hid_dev == NULL || data == NULL) { 486 usb_log_error( "Missing argument to the mouse polling callback."487 " \n");500 usb_log_error( 501 "Missing argument to the mouse polling callback.\n"); 488 502 return false; 489 503 }
Note:
See TracChangeset
for help on using the changeset viewer.