Changeset 970f6e1 in mainline for uspace/drv/hid/usbhid/usbhid.c
- Timestamp:
- 2018-01-09T18:25:56Z (6 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 4793023
- Parents:
- c386d6d
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/hid/usbhid/usbhid.c
rc386d6d r970f6e1 332 332 * During initialization, the keyboard is switched into boot protocol, the idle 333 333 * rate is set to 0 (infinity), resulting in the keyboard only reporting event 334 * when a key is pressed or released. Finally, the LED lights are turned on 334 * when a key is pressed or released. Finally, the LED lights are turned on 335 335 * according to the default setup of lock keys. 336 336 * 337 * @note By default, the keyboards is initialized with Num Lock turned on and 337 * @note By default, the keyboards is initialized with Num Lock turned on and 338 338 * other locks turned off. 339 339 * … … 354 354 hid_dev->usb_dev = dev; 355 355 hid_dev->poll_pipe_mapping = NULL; 356 357 hid_dev->will_deinit = false; 358 fibril_mutex_initialize(&hid_dev->guard); 359 fibril_condvar_initialize(&hid_dev->poll_end); 356 360 357 361 int rc = usb_hid_check_pipes(hid_dev, dev); … … 492 496 } 493 497 498 bool usb_hid_polling_error_callback(usb_device_t *dev, int err_code, void *arg) 499 { 500 assert(dev); 501 assert(arg); 502 usb_hid_dev_t *hid_dev = arg; 503 504 usb_log_error("Device %s polling error: %s", usb_device_get_name(dev), 505 str_error(err_code)); 506 507 /* Continue polling until the device is about to be removed. */ 508 return hid_dev->running && !hid_dev->will_deinit; 509 } 510 494 511 void usb_hid_polling_ended_callback(usb_device_t *dev, bool reason, void *arg) 495 512 { … … 507 524 508 525 hid_dev->running = false; 526 527 /* Signal polling end to joining thread. */ 528 fibril_mutex_lock(&hid_dev->guard); 529 fibril_condvar_signal(&hid_dev->poll_end); 530 fibril_mutex_unlock(&hid_dev->guard); 509 531 } 510 532 … … 517 539 { 518 540 return hid_dev->report_nr; 541 } 542 543 void usb_hid_prepare_deinit(usb_hid_dev_t *hid_dev) 544 { 545 assert(hid_dev); 546 hid_dev->will_deinit = true; 519 547 } 520 548 … … 524 552 assert(hid_dev->subdrivers != NULL || hid_dev->subdriver_count == 0); 525 553 526 527 usb_log_debug("Subdrivers: %p, subdriver count: %d\n", 554 usb_log_debug("Subdrivers: %p, subdriver count: %d\n", 528 555 hid_dev->subdrivers, hid_dev->subdriver_count); 529 556 … … 541 568 /* Destroy the parser */ 542 569 usb_hid_report_deinit(&hid_dev->report); 543 544 570 } 545 571
Note:
See TracChangeset
for help on using the changeset viewer.