Changes in uspace/drv/usbmouse/init.c [bc1c6fb:489c3e7] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/usbmouse/init.c
rbc1c6fb r489c3e7 42 42 43 43 /** Mouse polling endpoint description for boot protocol subclass. */ 44 staticusb_endpoint_description_t poll_endpoint_description = {44 usb_endpoint_description_t poll_endpoint_description = { 45 45 .transfer_type = USB_TRANSFER_INTERRUPT, 46 46 .direction = USB_DIRECTION_IN, … … 50 50 .flags = 0 51 51 }; 52 53 /** Initialize poll pipe.54 *55 * Expects that session is already started on control pipe zero.56 *57 * @param mouse Mouse device.58 * @param my_interface Interface number.59 * @return Error code.60 */61 static int intialize_poll_pipe(usb_mouse_t *mouse, int my_interface)62 {63 assert(usb_endpoint_pipe_is_session_started(&mouse->ctrl_pipe));64 65 int rc;66 67 void *config_descriptor;68 size_t config_descriptor_size;69 70 rc = usb_request_get_full_configuration_descriptor_alloc(71 &mouse->ctrl_pipe, 0, &config_descriptor, &config_descriptor_size);72 if (rc != EOK) {73 return rc;74 }75 76 usb_endpoint_mapping_t endpoint_mapping[1] = {77 {78 .pipe = &mouse->poll_pipe,79 .description = &poll_endpoint_description,80 .interface_no = my_interface81 }82 };83 84 rc = usb_endpoint_pipe_initialize_from_configuration(endpoint_mapping,85 1, config_descriptor, config_descriptor_size, &mouse->wire);86 if (rc != EOK) {87 return rc;88 }89 90 if (!endpoint_mapping[0].present) {91 return ENOENT;92 }93 94 mouse->poll_interval_us = 1000 * endpoint_mapping[0].descriptor->poll_interval;95 96 usb_log_debug("prepared polling endpoint %d (interval %zu).\n",97 mouse->poll_pipe.endpoint_no, mouse->poll_interval_us);98 99 return EOK;100 }101 52 102 53 static void default_connection_handler(ddf_fun_t *, ipc_callid_t, ipc_call_t *); … … 143 94 * @return Error code. 144 95 */ 145 int usb_mouse_create( ddf_dev_t *dev)96 int usb_mouse_create(usb_device_t *dev) 146 97 { 147 98 usb_mouse_t *mouse = malloc(sizeof(usb_mouse_t)); … … 149 100 return ENOMEM; 150 101 } 151 mouse->dev ice= dev;102 mouse->dev = dev; 152 103 mouse->console_phone = -1; 153 104 154 105 int rc; 155 106 156 /* Initialize the backing connection. */157 rc = usb_device_connection_initialize_from_device(&mouse->wire, dev);158 if (rc != EOK) {159 goto leave;160 }161 162 /* Initialize the default control pipe. */163 rc = usb_endpoint_pipe_initialize_default_control(&mouse->ctrl_pipe,164 &mouse->wire);165 if (rc != EOK) {166 goto leave;167 }168 169 rc = usb_endpoint_pipe_start_session(&mouse->ctrl_pipe);170 if (rc != EOK) {171 goto leave;172 }173 174 rc = intialize_poll_pipe(mouse, usb_device_get_assigned_interface(dev));175 176 /* We can ignore error here. */177 usb_endpoint_pipe_end_session(&mouse->ctrl_pipe);178 179 if (rc != EOK) {180 goto leave;181 }182 183 107 /* Create DDF function. */ 184 mouse->mouse_fun = ddf_fun_create(dev , fun_exposed, "mouse");108 mouse->mouse_fun = ddf_fun_create(dev->ddf_dev, fun_exposed, "mouse"); 185 109 if (mouse->mouse_fun == NULL) { 186 110 rc = ENOMEM;
Note:
See TracChangeset
for help on using the changeset viewer.