Changes in uspace/drv/uhci-rhd/port.c [563ead9:5f94a0c] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/uhci-rhd/port.c
r563ead9 r5f94a0c 36 36 #include <errno.h> 37 37 #include <str_error.h> 38 #include <time.h> 38 39 #include <async.h> 39 40 40 41 #include <usb/usb.h> /* usb_address_t */ 41 #include <usb/ dev/hub.h> /* usb_hc_new_device_wrapper */42 #include <usb/hub.h> /* usb_hc_new_device_wrapper */ 42 43 #include <usb/debug.h> 43 44 … … 81 82 * @param[in] number Port number. 82 83 * @param[in] usec Polling interval. 83 * @param[in] rh Pointer to ddf instance ofthe root hub driver.84 * @param[in] rh Pointer to ddf instance fo the root hub driver. 84 85 * @return Error code. 85 86 * … … 90 91 { 91 92 assert(port); 92 char *id_string; 93 asprintf(&id_string, "Port (%p - %u)", port, number); 94 if (id_string == NULL) { 93 asprintf(&port->id_string, "Port (%p - %u)", port, number); 94 if (port->id_string == NULL) { 95 95 return ENOMEM; 96 96 } 97 97 98 port->id_string = id_string;99 98 port->address = address; 100 99 port->number = number; … … 106 105 usb_hc_connection_initialize_from_device(&port->hc_connection, rh); 107 106 if (ret != EOK) { 108 usb_log_error("%s: failed to initialize connection to HC.", 109 port->id_string); 110 free(id_string); 107 usb_log_error("Failed to initialize connection to HC."); 111 108 return ret; 112 109 } … … 116 113 usb_log_error("%s: failed to create polling fibril.", 117 114 port->id_string); 118 free(id_string);119 115 return ENOMEM; 120 116 } … … 136 132 assert(port); 137 133 free(port->id_string); 138 / / TODO: Kill fibril here134 /* TODO: Kill fibril here */ 139 135 return; 140 136 } … … 154 150 155 151 /* Read register value */ 156 const port_status_t port_status = 157 uhci_port_read_status(instance); 152 port_status_t port_status = uhci_port_read_status(instance); 158 153 159 154 /* Print the value if it's interesting */ … … 166 161 usb_log_debug("%s: Connected change detected: %x.\n", 167 162 instance->id_string, port_status); 163 164 int rc = 165 usb_hc_connection_open(&instance->hc_connection); 166 if (rc != EOK) { 167 usb_log_error("%s: Failed to connect to HC.", 168 instance->id_string); 169 continue; 170 } 168 171 169 172 /* Remove any old device */ … … 172 175 instance->id_string); 173 176 uhci_port_remove_device(instance); 174 }175 176 int ret =177 usb_hc_connection_open(&instance->hc_connection);178 if (ret != EOK) {179 usb_log_error("%s: Failed to connect to HC.",180 instance->id_string);181 continue;182 177 } 183 178 … … 195 190 } 196 191 197 r et= usb_hc_connection_close(&instance->hc_connection);198 if (r et!= EOK) {192 rc = usb_hc_connection_close(&instance->hc_connection); 193 if (rc != EOK) { 199 194 usb_log_error("%s: Failed to disconnect.", 200 195 instance->id_string); … … 214 209 int uhci_port_reset_enable(int portno, void *arg) 215 210 { 216 uhci_port_t *port = arg; 217 assert(port); 211 uhci_port_t *port = (uhci_port_t *) arg; 218 212 219 213 usb_log_debug2("%s: new_device_enable_port.\n", port->id_string); … … 289 283 usb_log_error("%s: Don't know how to remove device %" PRIun ".\n", 290 284 port->id_string, port->attached_device); 291 port->attached_device = 0;292 285 return ENOTSUP; 293 286 }
Note:
See TracChangeset
for help on using the changeset viewer.