Changeset 9014dcd in mainline for uspace/drv/usbhub/usbhub.c


Ignore:
Timestamp:
2011-04-22T12:47:39Z (13 years ago)
Author:
Matus Dekanek <smekideki@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
32aef25b, 54d71e1
Parents:
44b1674
Message:

fix for usb hub
loc in ohci root hub

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/usbhub/usbhub.c

    r44b1674 r9014dcd  
    173173leave:
    174174        /* FIXME: proper interval. */
    175         async_usleep(1000 * 1000 * 10);
     175        async_usleep(1000 * 250);
    176176
    177177        return true;
     
    249249            sizeof (usb_hub_port_t) * (hub_info->port_count + 1));
    250250        size_t port;
    251         for (port = 0; port < hub_info->port_count + 1; port++) {
     251        for (port = 0; port < hub_info->port_count + 1; ++port) {
    252252                usb_hub_port_init(&hub_info->ports[port]);
    253253        }
    254254        if(is_power_switched){
    255255                usb_log_debug("is_power_switched\n");
    256                 if(has_individual_port_powering){
    257                         usb_log_debug("has_individual_port_powering\n");
    258                         for (port = 0; port < hub_info->port_count; port++) {
    259                                 opResult = usb_hub_set_port_feature(hub_info->control_pipe,
    260                                     port+1, USB_HUB_FEATURE_PORT_POWER);
    261                                 if (opResult != EOK) {
    262                                         usb_log_error("cannot power on port %zu: %s.\n",
    263                                             port+1, str_error(opResult));
    264                                 }
     256               
     257                for (port = 1; port <= hub_info->port_count; ++port) {
     258                        usb_log_debug("powering port %d\n",port);
     259                        opResult = usb_hub_set_port_feature(hub_info->control_pipe,
     260                            port, USB_HUB_FEATURE_PORT_POWER);
     261                        if (opResult != EOK) {
     262                                usb_log_error("cannot power on port %zu: %s.\n",
     263                                    port, str_error(opResult));
    265264                        }
    266                 }else{
     265                }
     266                if(!has_individual_port_powering){
    267267                        usb_log_debug("!has_individual_port_powering\n");
    268268                        opResult = usb_hub_set_feature(hub_info->control_pipe,
     
    409409    usb_hub_status_t status) {
    410410        int opResult;
    411         if (usb_hub_is_status(status,USB_HUB_FEATURE_HUB_LOCAL_POWER)) {
     411        if (!usb_hub_is_status(status,USB_HUB_FEATURE_HUB_LOCAL_POWER)) {
    412412                //restart power on hub
    413413                opResult = usb_hub_set_feature(hub_info->control_pipe,
     
    419419        } else {//power reestablished on hub- restart ports
    420420                size_t port;
    421                 for (port = 0; port < hub_info->port_count; ++port) {
     421                for (port = 1; port <= hub_info->port_count; ++port) {
    422422                        opResult = usb_hub_set_port_feature(
    423423                            hub_info->control_pipe,
     
    428428                        }
    429429                }
     430                opResult = usb_hub_clear_feature(hub_info->control_pipe,
     431                    USB_HUB_FEATURE_C_HUB_LOCAL_POWER);
     432                if (opResult != EOK) {
     433                        usb_log_error("cannnot clear hub power change flag: "
     434                            "%d\n",
     435                            opResult);
     436                }
    430437        }
    431438        return opResult;
Note: See TracChangeset for help on using the changeset viewer.