Changeset 555499da in mainline for uspace/drv/bus/usb/usbhid/usbhid.c
- Timestamp:
- 2011-11-09T12:48:12Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- e3c78efc
- Parents:
- 8c62a71
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/usbhid/usbhid.c
r8c62a71 r555499da 291 291 292 292 /* We have all subdrivers determined, save them into the hid device */ 293 // TODO Do we really need this complicated stuff if there is293 // TODO Do we really need this complicated stuff if there is 294 294 // max_subdrivers limitation? 295 295 return usb_hid_save_subdrivers(hid_dev, subdrivers, count); 296 296 } 297 298 /*----------------------------------------------------------------------------*/ 299 297 /*----------------------------------------------------------------------------*/ 300 298 static int usb_hid_check_pipes(usb_hid_dev_t *hid_dev, const usb_device_t *dev) 301 299 { 302 300 assert(hid_dev); 303 301 assert(dev); 302 304 303 305 304 if (dev->pipes[USB_HID_KBD_POLL_EP_NO].present) { … … 359 358 360 359 /*----------------------------------------------------------------------------*/ 361 360 /* 361 * This functions initializes required structures from the device's descriptors 362 * and starts new fibril for polling the keyboard for events and another one for 363 * handling auto-repeat of keys. 364 * 365 * During initialization, the keyboard is switched into boot protocol, the idle 366 * rate is set to 0 (infinity), resulting in the keyboard only reporting event 367 * when a key is pressed or released. Finally, the LED lights are turned on 368 * according to the default setup of lock keys. 369 * 370 * @note By default, the keyboards is initialized with Num Lock turned on and 371 * other locks turned off. 372 * 373 * @param hid_dev Device to initialize, non-NULL. 374 * @param dev USB device, non-NULL. 375 * @return Error code. 376 */ 362 377 int usb_hid_init(usb_hid_dev_t *hid_dev, usb_device_t *dev) 363 378 { 364 int rc, i; 379 assert(hid_dev); 380 assert(dev); 365 381 366 382 usb_log_debug("Initializing HID structure...\n"); 367 368 if (hid_dev == NULL) {369 usb_log_error("Failed to init HID structure: no structure given"370 ".\n");371 return EINVAL;372 }373 374 if (dev == NULL) {375 usb_log_error("Failed to init HID structure: no USB device"376 " given.\n");377 return EINVAL;378 }379 383 380 384 usb_hid_report_init(&hid_dev->report); … … 384 388 hid_dev->poll_pipe_index = -1; 385 389 386 rc = usb_hid_check_pipes(hid_dev, dev);390 int rc = usb_hid_check_pipes(hid_dev, dev); 387 391 if (rc != EOK) { 388 392 return rc; … … 449 453 hid_dev->subdriver_count); 450 454 451 for (i = 0; i < hid_dev->subdriver_count; ++i) {455 for (int i = 0; i < hid_dev->subdriver_count; ++i) { 452 456 if (hid_dev->subdrivers[i].init != NULL) { 453 457 usb_log_debug("Initializing subdriver %d.\n",i); … … 560 564 561 565 /*----------------------------------------------------------------------------*/ 562 563 566 void usb_hid_deinit(usb_hid_dev_t *hid_dev) 564 567 {
Note:
See TracChangeset
for help on using the changeset viewer.