Changeset 3538b0e in mainline
- Timestamp:
- 2011-12-12T13:28:51Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 30ec5ea
- Parents:
- c804484
- Location:
- uspace/lib/usbdev
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usbdev/include/usb/dev/usb_device_connection.h
rc804484 r3538b0e 57 57 { 58 58 assert(connection); 59 60 if (hc_connection == NULL) { 59 if (hc_connection == NULL) 61 60 return EBADMEM; 62 } 63 64 if ((address < 0) || (address >= USB11_ADDRESS_MAX)) { 61 if ((address < 0) || (address >= USB11_ADDRESS_MAX)) 65 62 return EINVAL; 66 }67 63 68 64 connection->hc_connection = hc_connection; … … 70 66 return EOK; 71 67 } 72 /*----------------------------------------------------------------------------*/73 /** Initialize connection to USB device on default address.74 *75 * @param dev_connection Device connection structure to be initialized.76 * @param hc_connection Initialized connection to host controller.77 * @return Error code.78 */79 static inline int usb_device_connection_initialize_on_default_address(80 usb_device_connection_t *connection, usb_hc_connection_t *hc_conn)81 {82 return usb_device_connection_initialize(connection, hc_conn, 0);83 }84 85 68 /*----------------------------------------------------------------------------*/ 86 69 static inline int usb_device_register_endpoint(usb_device_connection_t *conn, -
uspace/lib/usbdev/src/hub.c
rc804484 r3538b0e 230 230 /* Initialize connection to device. */ 231 231 usb_device_connection_t dev_conn; 232 rc = usb_device_connection_initialize _on_default_address(233 &dev_conn, hc_conn );232 rc = usb_device_connection_initialize( 233 &dev_conn, hc_conn, USB_ADDRESS_DEFAULT); 234 234 if (rc != EOK) { 235 235 rc = ENOTCONN; … … 237 237 } 238 238 239 /* Initialize control pipe on default address. Don't register yet. */ 240 usb_pipe_t ctrl_pipe; 241 rc = usb_pipe_initialize_default_control(&ctrl_pipe, &dev_conn); 242 if (rc != EOK) { 243 rc = ENOTCONN; 244 goto leave_release_free_address; 245 } 246 239 247 /* 240 * We will not register control pipe on default address.241 * Th e registration might fail. That means that someone else already242 * registered that endpoint.We will simply wait and try again.248 * The default address request might fail. 249 * That means that someone else is already using that address. 250 * We will simply wait and try again. 243 251 * (Someone else already wants to add a new device.) 244 252 */ 245 usb_pipe_t ctrl_pipe;246 rc = usb_pipe_initialize_default_control(&ctrl_pipe, &dev_conn);247 if (rc != EOK) {248 rc = ENOTCONN;249 goto leave_release_free_address;250 }251 252 253 do { 253 254 rc = usb_hc_request_address(hc_conn, USB_ADDRESS_DEFAULT, … … 262 263 } 263 264 264 /* Register control pipe on default address. */265 /* Register control pipe on default address. 0 means no interval. */ 265 266 rc = usb_pipe_register(&ctrl_pipe, 0); 266 267 if (rc != EOK) { … … 270 271 271 272 struct timeval end_time; 272 273 273 rc = gettimeofday(&end_time, NULL); 274 274 if (rc != EOK) { … … 353 353 */ 354 354 leave_release_default_address: 355 usb_hc_unregister_device(hc_conn, USB_ADDRESS_DEFAULT); 355 if (usb_hc_unregister_device(hc_conn, USB_ADDRESS_DEFAULT) != EOK) 356 usb_log_warning("%s: Failed to unregister defaut device.\n", 357 __FUNCTION__); 356 358 357 359 leave_release_free_address: -
uspace/lib/usbdev/src/pipes.c
rc804484 r3538b0e 31 31 */ 32 32 /** @file 33 * USB endpoint pipes miscellaneousfunctions.33 * USB endpoint pipes functions. 34 34 */ 35 35 #include <usb/dev/pipes.h> -
uspace/lib/usbdev/src/pipesinit.c
rc804484 r3538b0e 31 31 */ 32 32 /** @file 33 * Initialization of endpoint pipes.33 * Non trivial initialization of endpoint pipes. 34 34 * 35 35 */
Note:
See TracChangeset
for help on using the changeset viewer.