Changeset 065064e6 in mainline for uspace/drv/bus/usb/usbhid/usbhid.c
- Timestamp:
- 2011-10-15T12:49:18Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- e3f7418
- Parents:
- 7c95d6f5
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/usbhid/usbhid.c
r7c95d6f5 r065064e6 412 412 /*----------------------------------------------------------------------------*/ 413 413 414 usb_hid_dev_t *usb_hid_new(void) 415 { 416 usb_hid_dev_t *hid_dev = (usb_hid_dev_t *)calloc(1, 417 sizeof(usb_hid_dev_t)); 414 int usb_hid_init(usb_hid_dev_t *hid_dev, usb_device_t *dev) 415 { 416 int rc, i; 417 418 usb_log_debug("Initializing HID structure...\n"); 418 419 419 420 if (hid_dev == NULL) { 420 usb_log_error("No memory!\n"); 421 return NULL; 421 usb_log_error("Failed to init HID structure: no structure given" 422 ".\n"); 423 return EINVAL; 424 } 425 426 if (dev == NULL) { 427 usb_log_error("Failed to init HID structure: no USB device" 428 " given.\n"); 429 return EINVAL; 422 430 } 423 431 … … 426 434 if (hid_dev->report == NULL) { 427 435 usb_log_error("No memory!\n"); 428 free(hid_dev); 429 return NULL; 430 } 431 432 hid_dev->poll_pipe_index = -1; 433 434 return hid_dev; 435 } 436 437 /*----------------------------------------------------------------------------*/ 438 439 int usb_hid_init(usb_hid_dev_t *hid_dev, usb_device_t *dev) 440 { 441 int rc, i; 442 443 usb_log_debug("Initializing HID structure...\n"); 444 445 if (hid_dev == NULL) { 446 usb_log_error("Failed to init HID structure: no structure given" 447 ".\n"); 448 return EINVAL; 449 } 450 451 if (dev == NULL) { 452 usb_log_error("Failed to init HID structure: no USB device" 453 " given.\n"); 454 return EINVAL; 455 } 456 436 return ENOMEM; 437 } 457 438 usb_hid_report_init(hid_dev->report); 458 439 459 440 /* The USB device should already be initialized, save it in structure */ 460 441 hid_dev->usb_dev = dev; 442 hid_dev->poll_pipe_index = -1; 461 443 462 444 rc = usb_hid_check_pipes(hid_dev, dev);
Note:
See TracChangeset
for help on using the changeset viewer.