Changeset 72af8da in mainline for uspace/drv/usbmouse/main.c
- Timestamp:
- 2011-03-16T18:50:17Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 42a3a57
- Parents:
- 3e7b7cd (diff), fcf07e6 (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/usbmouse/main.c
r3e7b7cd r72af8da 39 39 #include <str_error.h> 40 40 41 static int usbmouse_add_device(ddf_dev_t *dev) 41 /** Callback when new mouse device is attached and recognised by DDF. 42 * 43 * @param dev Representation of a generic DDF device. 44 * @return Error code. 45 */ 46 static int usbmouse_add_device(usb_device_t *dev) 42 47 { 43 48 int rc = usb_mouse_create(dev); … … 48 53 } 49 54 50 fid_t poll_fibril = fibril_create(usb_mouse_polling_fibril, dev); 51 if (poll_fibril == 0) { 52 usb_log_error("Failed to initialize polling fibril.\n"); 53 /* FIXME: free allocated resources. */ 54 return ENOMEM; 55 usb_log_debug("Polling pipe at endpoint %d.\n", dev->pipes[0].pipe->endpoint_no); 56 57 rc = usb_device_auto_poll(dev, 0, 58 usb_mouse_polling_callback, dev->pipes[0].pipe->max_packet_size, 59 usb_mouse_polling_ended_callback, dev->driver_data); 60 61 if (rc != EOK) { 62 usb_log_error("Failed to start polling fibril: %s.\n", 63 str_error(rc)); 64 return rc; 55 65 } 56 66 57 fibril_add_ready(poll_fibril);58 59 67 usb_log_info("controlling new mouse (handle %llu).\n", 60 dev-> handle);68 dev->ddf_dev->handle); 61 69 62 70 return EOK; 63 71 } 64 72 65 static driver_ops_t mouse_driver_ops = { 73 /** USB mouse driver ops. */ 74 static usb_driver_ops_t mouse_driver_ops = { 66 75 .add_device = usbmouse_add_device, 67 76 }; 68 77 69 static driver_t mouse_driver = { 78 static usb_endpoint_description_t *endpoints[] = { 79 &poll_endpoint_description, 80 NULL 81 }; 82 83 /** USB mouse driver. */ 84 static usb_driver_t mouse_driver = { 70 85 .name = NAME, 71 .driver_ops = &mouse_driver_ops 86 .ops = &mouse_driver_ops, 87 .endpoints = endpoints 72 88 }; 73 89 … … 76 92 usb_log_enable(USB_LOG_LEVEL_DEBUG, NAME); 77 93 78 return ddf_driver_main(&mouse_driver);94 return usb_driver_main(&mouse_driver); 79 95 } 80 96
Note:
See TracChangeset
for help on using the changeset viewer.