Changeset a6567ed in mainline for uspace/drv/usbmouse/init.c
- Timestamp:
- 2011-03-02T18:54:49Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 820aba32
- Parents:
- d70e0a3c
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/usbmouse/init.c
rd70e0a3c ra6567ed 36 36 #include "mouse.h" 37 37 #include <usb/debug.h> 38 #include <usb/classes/classes.h> 38 39 #include <usb/classes/hid.h> 39 40 #include <usb/request.h> 40 41 #include <errno.h> 41 42 42 #if 043 43 /** Mouse polling endpoint description for boot protocol subclass. */ 44 44 static usb_endpoint_description_t poll_endpoint_description = { … … 50 50 .flags = 0 51 51 }; 52 #endif 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_interface 81 } 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 return EOK; 95 } 53 96 54 97 … … 76 119 } 77 120 78 /* FIXME: initialize to the proper endpoint. */ 79 rc = usb_endpoint_pipe_initialize(&mouse->poll_pipe, &mouse->wire, 80 1, USB_TRANSFER_INTERRUPT, 8, USB_DIRECTION_IN); 121 rc = usb_endpoint_pipe_start_session(&mouse->ctrl_pipe); 122 if (rc != EOK) { 123 goto leave; 124 } 125 126 rc = intialize_poll_pipe(mouse, usb_device_get_assigned_interface(dev)); 127 128 /* We can ignore error here. */ 129 usb_endpoint_pipe_end_session(&mouse->ctrl_pipe); 130 81 131 if (rc != EOK) { 82 132 goto leave;
Note:
See TracChangeset
for help on using the changeset viewer.