Changeset e98e5fc in mainline for uspace/drv/bus/usb/usbhub/usbhub.c
- Timestamp:
- 2015-07-01T03:51:38Z (10 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- e6d7df1
- Parents:
- b303275
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/usbhub/usbhub.c
rb303275 re98e5fc 159 159 } 160 160 hub_dev->running = true; 161 usb_log_info("Controlling hub '%s' (%zu ports).\n", 162 usb_device_get_name(hub_dev->usb_device), hub_dev->port_count); 161 usb_log_info("Controlling hub '%s' (%p: %zu ports).\n", 162 usb_device_get_name(hub_dev->usb_device), hub_dev, 163 hub_dev->port_count); 163 164 164 165 return EOK; … … 190 191 async_usleep(100000); 191 192 if (!tries--) { 192 usb_log_error("Can't remove hub, still running.\n"); 193 usb_log_error("(%p): Can't remove hub, still running.", 194 hub); 193 195 return EBUSY; 194 196 } … … 206 208 const int ret = ddf_fun_unbind(hub->hub_fun); 207 209 if (ret != EOK) { 208 usb_log_error(" Failed to unbind '%s' function: %s.\n",209 HUB_FNC_NAME, str_error(ret));210 usb_log_error("(%p) Failed to unbind '%s' function: %s.", 211 hub, HUB_FNC_NAME, str_error(ret)); 210 212 return ret; 211 213 } 212 214 ddf_fun_destroy(hub->hub_fun); 213 215 214 usb_log_info(" USB hub driver, stopped and cleaned.\n");216 usb_log_info("(%p) USB hub driver stopped and cleaned.", hub); 215 217 return EOK; 216 218 } … … 227 229 uint8_t *change_bitmap, size_t change_bitmap_size, void *arg) 228 230 { 229 usb_log_debug("hub_port_changes_callback\n");231 // usb_log_debug("hub_port_changes_callback\n"); 230 232 usb_hub_dev_t *hub = arg; 231 233 assert(hub); … … 268 270 269 271 /* Get hub descriptor. */ 270 usb_log_debug(" Retrieving descriptor\n");272 usb_log_debug("(%p): Retrieving descriptor.", hub_dev); 271 273 usb_pipe_t *control_pipe = 272 274 usb_device_get_default_pipe(hub_dev->usb_device); … … 279 281 sizeof(usb_hub_descriptor_header_t), &received_size); 280 282 if (opResult != EOK) { 281 usb_log_error(" Failed to receive hub descriptor: %s.\n",282 str_error(opResult));283 usb_log_error("(%p): Failed to receive hub descriptor: %s.\n", 284 hub_dev, str_error(opResult)); 283 285 return opResult; 284 286 } 285 287 286 usb_log_debug("Setting port count to %d.\n", descriptor.port_count); 288 usb_log_debug("(%p): Setting port count to %d.\n", hub_dev, 289 descriptor.port_count); 287 290 hub_dev->port_count = descriptor.port_count; 288 291 … … 303 306 304 307 if (!hub_dev->power_switched) { 305 usb_log_info( 306 "Power switching not supported, ports always powered.\n");308 usb_log_info("(%p): Power switching not supported, " 309 "ports always powered.", hub_dev); 307 310 return EOK; 308 311 } 309 312 310 usb_log_info(" Hub port power switching enabled (%s).\n",313 usb_log_info("(%p): Hub port power switching enabled (%s).\n", hub_dev, 311 314 hub_dev->per_port_power ? "per port" : "ganged"); 312 315 313 316 for (size_t port = 0; port < hub_dev->port_count; ++port) { 314 usb_log_debug(" Powering port %zu.\n", port);317 usb_log_debug("(%p): Powering port %zu.", hub_dev, port); 315 318 const int ret = usb_hub_port_set_feature( 316 319 &hub_dev->ports[port], USB_HUB_FEATURE_PORT_POWER); 317 320 318 321 if (ret != EOK) { 319 usb_log_error("Cannot power on port %u: %s.\n", 320 hub_dev->ports[port].port_number, str_error(ret)); 322 usb_log_error("(%p-%zu): Cannot power on port: %s.\n", 323 hub_dev, hub_dev->ports[port].port_number, 324 str_error(ret)); 321 325 } else { 322 326 if (!hub_dev->per_port_power) { 323 usb_log_debug(" Ganged power switching, "324 "one port is enough. \n");327 usb_log_debug("(%p) Ganged power switching, " 328 "one port is enough.", hub_dev); 325 329 break; 326 330 } … … 351 355 } 352 356 353 // TODO: Make sure that the cast is correct354 357 const size_t config_size = 355 358 usb_device_descriptors(usb_device)->full_config_size; … … 391 394 if (status & USB_HUB_STATUS_OVER_CURRENT) { 392 395 /* Hub should remove power from all ports if it detects OC */ 393 usb_log_warning(" Detected hub over-current condition, "394 "all ports should be powered off." );396 usb_log_warning("(%p) Detected hub over-current condition, " 397 "all ports should be powered off.", hub_dev); 395 398 return; 396 399 } … … 405 408 &hub_dev->ports[port], USB_HUB_FEATURE_PORT_POWER); 406 409 if (ret != EOK) { 407 usb_log_warning(" HUB OVER-CURRENT GONE: Cannot power on"408 " po rt %u: %s\n", hub_dev->ports[port].port_number,409 str_error(ret));410 usb_log_warning("(%p-%u): HUB OVER-CURRENT GONE: Cannot" 411 " power on port: %s\n", hub_dev, 412 hub_dev->ports[port].port_number, str_error(ret)); 410 413 } else { 411 414 if (!hub_dev->per_port_power) … … 426 429 assert(hub_dev); 427 430 assert(hub_dev->usb_device); 428 usb_log_debug(" Global interrupt on a hub\n");431 usb_log_debug("(%p): Global interrupt on th hub.", hub_dev); 429 432 usb_pipe_t *control_pipe = 430 433 usb_device_get_default_pipe(hub_dev->usb_device); … … 438 441 &status, sizeof(usb_hub_status_t), &rcvd_size); 439 442 if (opResult != EOK) { 440 usb_log_error(" Could not get hub status: %s\n",443 usb_log_error("(%p): Could not get hub status: %s.", hub_dev, 441 444 str_error(opResult)); 442 445 return; 443 446 } 444 447 if (rcvd_size != sizeof(usb_hub_status_t)) { 445 usb_log_error("Received status has incorrect size\n"); 448 usb_log_error("(%p): Received status has incorrect size: " 449 "%zu != %zu", hub_dev, rcvd_size, sizeof(usb_hub_status_t)); 446 450 return; 447 451 } … … 456 460 USB_HUB_FEATURE_C_HUB_OVER_CURRENT, 0); 457 461 if (ret != EOK) { 458 usb_log_error(" Failed to clear hub over-current "459 "change flag: %s.\n", str_error(opResult));462 usb_log_error("(%p): Failed to clear hub over-current " 463 "change flag: %s.\n", hub_dev, str_error(opResult)); 460 464 } 461 465 } … … 480 484 USB_HUB_FEATURE_C_HUB_LOCAL_POWER, 0); 481 485 if (opResult != EOK) { 482 usb_log_error(" Failed to clear hub power change "483 "flag: %s.\n", str_error(ret));486 usb_log_error("(%p): Failed to clear hub power change " 487 "flag: %s.\n", hub_dev, str_error(ret)); 484 488 } 485 489 }
Note:
See TracChangeset
for help on using the changeset viewer.