Changeset 308a5d5 in mainline for uspace/drv/usbhub/usbhub.c


Ignore:
Timestamp:
2011-04-24T15:38:10Z (13 years ago)
Author:
Lubos Slovak <lubos.slovak@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
94c0dcbd
Parents:
9b78020 (diff), 564a2b3 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Changes from development

File:
1 edited

Legend:

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

    r9b78020 r308a5d5  
    105105        }
    106106
    107         //usb_pipe_start_session(hub_info->control_pipe);
    108107        //set hub configuration
    109108        opResult = usb_hub_set_configuration(hub_info);
     
    122121                return opResult;
    123122        }
    124         //usb_pipe_end_session(hub_info->control_pipe);
    125 
    126123
    127124        usb_log_debug("Creating 'hub' function in DDF.\n");
     
    176173leave:
    177174        /* FIXME: proper interval. */
    178         async_usleep(1000 * 1000 * 10);
     175        async_usleep(1000 * 250);
    179176
    180177        return true;
     
    218215        // get hub descriptor
    219216        usb_log_debug("creating serialized descriptor\n");
    220         //void * serialized_descriptor = malloc(USB_HUB_MAX_DESCRIPTOR_SIZE);
    221217        uint8_t serialized_descriptor[USB_HUB_MAX_DESCRIPTOR_SIZE];
    222218        usb_hub_descriptor_t * descriptor;
     
    253249            sizeof (usb_hub_port_t) * (hub_info->port_count + 1));
    254250        size_t port;
    255         for (port = 0; port < hub_info->port_count + 1; port++) {
     251        for (port = 0; port < hub_info->port_count + 1; ++port) {
    256252                usb_hub_port_init(&hub_info->ports[port]);
    257253        }
    258254        if(is_power_switched){
    259255                usb_log_debug("is_power_switched\n");
    260                 if(has_individual_port_powering){
    261                         usb_log_debug("has_individual_port_powering\n");
    262                         for (port = 0; port < hub_info->port_count; port++) {
    263                                 opResult = usb_hub_set_port_feature(hub_info->control_pipe,
    264                                     port+1, USB_HUB_FEATURE_PORT_POWER);
    265                                 if (opResult != EOK) {
    266                                         usb_log_error("cannot power on port %zu: %s.\n",
    267                                             port+1, str_error(opResult));
    268                                 }
     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));
    269264                        }
    270                 }else{
     265                }
     266                if(!has_individual_port_powering){
    271267                        usb_log_debug("!has_individual_port_powering\n");
    272268                        opResult = usb_hub_set_feature(hub_info->control_pipe,
     
    281277        }
    282278        usb_log_debug2("freeing data\n");
    283         //free(serialized_descriptor);
    284         //free(descriptor->devices_removable);
    285279        free(descriptor);
    286280        return EOK;
     
    415409    usb_hub_status_t status) {
    416410        int opResult;
    417         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)) {
    418412                //restart power on hub
    419413                opResult = usb_hub_set_feature(hub_info->control_pipe,
     
    425419        } else {//power reestablished on hub- restart ports
    426420                size_t port;
    427                 for (port = 0; port < hub_info->port_count; ++port) {
     421                for (port = 1; port <= hub_info->port_count; ++port) {
    428422                        opResult = usb_hub_set_port_feature(
    429423                            hub_info->control_pipe,
     
    434428                        }
    435429                }
     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                }
    436437        }
    437438        return opResult;
Note: See TracChangeset for help on using the changeset viewer.