Changeset bd575647 in mainline for uspace/lib/usbdev/src/hub.c
- Timestamp:
- 2011-12-11T16:30:42Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 7d5ef94
- Parents:
- 2c202c5
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usbdev/src/hub.c
r2c202c5 rbd575647 63 63 } while (false) 64 64 65 /** Ask host controller for free address assignment.66 *67 * @param connection Opened connection to host controller.68 * @param preferred Preferred SUB address.69 * @param strict Fail if the preferred address is not avialable.70 * @param speed Speed of the new device (device that will be assigned71 * the returned address).72 * @return Assigned USB address or negative error code.73 */74 usb_address_t usb_hc_request_address(usb_hc_connection_t *connection,75 usb_address_t preferred, bool strict, usb_speed_t speed)76 {77 CHECK_CONNECTION(connection);78 79 async_exch_t *exch = async_exchange_begin(connection->hc_sess);80 if (!exch)81 return (usb_address_t)ENOMEM;82 83 usb_address_t address = preferred;84 const int ret = usbhc_request_address(exch, &address, strict, speed);85 86 async_exchange_end(exch);87 return ret == EOK ? address : ret;88 }89 65 90 66 /** Inform host controller about new device. … … 97 73 const usb_hub_attached_device_t *attached_device) 98 74 { 99 CHECK_CONNECTION(connection);75 // CHECK_CONNECTION(connection); 100 76 if (attached_device == NULL || attached_device->fun == NULL) 101 77 return EINVAL; … … 120 96 usb_address_t address) 121 97 { 122 CHECK_CONNECTION(connection);98 // CHECK_CONNECTION(connection); 123 99 124 100 async_exch_t *exch = async_exchange_begin(connection->hc_sess); … … 166 142 167 143 /* TODO: prevent others from accessing the wire now. */ 168 if (usb_pipe_unregister(pipe , hc_conn) != EOK) {144 if (usb_pipe_unregister(pipe) != EOK) { 169 145 usb_log_warning( 170 146 "Failed to unregister the old pipe on address change.\n"); … … 172 148 /* The address is already changed so set it in the wire */ 173 149 pipe->wire->address = new_address; 174 rc = usb_pipe_register(pipe, 0 , hc_conn);150 rc = usb_pipe_register(pipe, 0); 175 151 if (rc != EOK) 176 152 return EADDRNOTAVAIL; … … 288 264 289 265 /* Register control pipe on default address. */ 290 rc = usb_pipe_register(&ctrl_pipe, 0 , &hc_conn);266 rc = usb_pipe_register(&ctrl_pipe, 0); 291 267 if (rc != EOK) { 292 268 rc = ENOTCONN; … … 385 361 leave_release_free_address: 386 362 /* This might be either 0:0 or dev_addr:0 */ 387 if (usb_pipe_unregister(&ctrl_pipe , &hc_conn) != EOK)363 if (usb_pipe_unregister(&ctrl_pipe) != EOK) 388 364 usb_log_warning("%s: Failed to unregister default pipe.\n", 389 365 __FUNCTION__);
Note:
See TracChangeset
for help on using the changeset viewer.