Changeset 361fcec in mainline for uspace/drv/usbhub


Ignore:
Timestamp:
2011-04-29T08:33:43Z (15 years ago)
Author:
Matus Dekanek <smekideki@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
152ec79, a146aa33
Parents:
54d71e1
Message:

removing malloc, pre-creating root hub descriptor and interrupt buffer

Location:
uspace/drv/usbhub
Files:
3 edited

Legend:

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

    r54d71e1 r361fcec  
    5555};
    5656
    57 
     57/**
     58 * usb hub driver operations
     59 *
     60 * The most important one is add_device, which is set to usb_hub_add_device.
     61 */
    5862static usb_driver_ops_t usb_hub_driver_ops = {
    5963        .add_device = usb_hub_add_device
    6064};
    6165
     66/**
     67 * hub endpoints, excluding control endpoint
     68 */
    6269static usb_endpoint_description_t *usb_hub_endpoints[] = {
    6370        &hub_status_change_endpoint_description,
     
    6572};
    6673
     74/**
     75 * static usb hub driver information
     76 */
    6777static usb_driver_t usb_hub_driver = {
    6878        .name = NAME,
  • uspace/drv/usbhub/ports.c

    r54d71e1 r361fcec  
    167167
    168168        //close address
    169         //if (hub->attached_devs[port].address != 0) {
    170169        if(hub->ports[port].attached_device.address >= 0){
    171170                /*uncomment this code to use it when DDF allows device removal
     
    182181                 */
    183182        } else {
    184                 // TODO: is this really reason to print a warning?
    185183                usb_log_warning("Device removed before being registered.\n");
    186184
  • uspace/drv/usbhub/usbhub.c

    r54d71e1 r361fcec  
    7373
    7474
    75 /// \TODO malloc checking
    76 
    7775//*********************************************
    7876//
     
    248246        hub_info->ports = malloc(
    249247            sizeof (usb_hub_port_t) * (hub_info->port_count + 1));
     248        if(!hub_info->ports){
     249                return ENOMEM;
     250        }
    250251        size_t port;
    251252        for (port = 0; port < hub_info->port_count + 1; ++port) {
     
    255256                usb_log_debug("is_power_switched\n");
    256257               
     258                if(!has_individual_port_powering){
     259                        usb_log_debug("!has_individual_port_powering\n");
     260                        opResult = usb_hub_set_feature(hub_info->control_pipe,
     261                            USB_HUB_FEATURE_C_HUB_LOCAL_POWER);
     262                        if (opResult != EOK) {
     263                                usb_log_error("cannot power hub: %s\n",
     264                                    str_error(opResult));
     265                        }
     266                }
     267
    257268                for (port = 1; port <= hub_info->port_count; ++port) {
    258269                        usb_log_debug("Powering port %zu.\n",port);
     
    264275                        }
    265276                }
    266                 if(!has_individual_port_powering){
    267                         usb_log_debug("!has_individual_port_powering\n");
    268                         opResult = usb_hub_set_feature(hub_info->control_pipe,
    269                             USB_HUB_FEATURE_C_HUB_LOCAL_POWER);
    270                         if (opResult != EOK) {
    271                                 usb_log_error("cannot power hub: %s\n",
    272                                     str_error(opResult));
    273                         }
    274                 }
     277               
    275278        }else{
    276                 usb_log_debug("!is_power_switched\n");
     279                usb_log_debug("!is_power_switched, not going to be powered\n");
    277280        }
    278281        usb_log_debug2("freeing data\n");
Note: See TracChangeset for help on using the changeset viewer.