Changeset 3f3afb9 in mainline for uspace/drv/usbhub


Ignore:
Timestamp:
2011-04-11T20:38:37Z (15 years ago)
Author:
Matus Dekanek <smekideki@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
1324ff3, a39cfb8
Parents:
58226b4 (diff), d91645ab (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:

forgotten hub port powering

Location:
uspace/drv/usbhub
Files:
4 edited

Legend:

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

    r58226b4 r3f3afb9  
    181181                 */
    182182        } else {
    183                 usb_log_warning("this is strange, disconnected device had "
    184                         "no address\n");
    185                 //device was disconnected before it`s port was reset -
    186                 //return default address
    187                 usb_hub_release_default_address(hub);
     183                // TODO: is this really reason to print a warning?
     184                usb_log_warning("Device removed before being registered.\n");
     185
     186                /*
     187                 * Device was removed before port reset completed.
     188                 * We will announce a failed port reset to unblock the
     189                 * port reset callback from new device wrapper.
     190                 */
     191                usb_hub_port_t *the_port = hub->ports + port;
     192                fibril_mutex_lock(&the_port->reset_mutex);
     193                the_port->reset_completed = true;
     194                the_port->reset_okay = false;
     195                fibril_condvar_broadcast(&the_port->reset_cv);
     196                fibril_mutex_unlock(&the_port->reset_mutex);
    188197        }
    189198}
     
    207216                fibril_mutex_lock(&the_port->reset_mutex);
    208217                the_port->reset_completed = true;
     218                the_port->reset_okay = true;
    209219                fibril_condvar_broadcast(&the_port->reset_cv);
    210220                fibril_mutex_unlock(&the_port->reset_mutex);
     
    319329        }
    320330
    321         return EOK;
     331        if (my_port->reset_okay) {
     332                return EOK;
     333        } else {
     334                return ESTALL;
     335        }
    322336}
    323337
  • uspace/drv/usbhub/ports.h

    r58226b4 r3f3afb9  
    5151         */
    5252        bool reset_completed;
     53        /** Whether to announce the port reset as successful. */
     54        bool reset_okay;
    5355
    5456        /** Information about attached device. */
  • uspace/drv/usbhub/usbhub.c

    r58226b4 r3f3afb9  
    179179}
    180180
    181 /**
    182  * release default address used by given hub
    183  *
    184  * Also unsets hub->is_default_address_used. Convenience wrapper function.
    185  * @note hub->connection MUST be open for communication
    186  * @param hub hub representation
    187  * @return error code
    188  */
    189 int usb_hub_release_default_address(usb_hub_info_t * hub) {
    190         int opResult = usb_hc_release_default_address(&hub->connection);
    191         if (opResult != EOK) {
    192                 usb_log_error("could not release default address, errno %d\n",
    193                     opResult);
    194                 return opResult;
    195         }
    196         hub->is_default_address_used = false;
    197         return EOK;
    198 }
    199 
    200181
    201182//*********************************************
     
    266247        for (port = 0; port < hub_info->port_count + 1; port++) {
    267248                usb_hub_port_init(&hub_info->ports[port]);
     249        }
     250        for (port = 0; port < hub_info->port_count; port++) {
    268251                opResult = usb_hub_set_port_feature(hub_info->control_pipe,
    269                     port, USB_HUB_FEATURE_PORT_POWER);
     252                    port+1, USB_HUB_FEATURE_PORT_POWER);
    270253                if (opResult != EOK) {
    271254                        usb_log_error("cannot power on port %d;  %d\n",
    272                             port, opResult);
     255                            port+1, opResult);
    273256                }
    274257        }
  • uspace/drv/usbhub/usbhub.h

    r58226b4 r3f3afb9  
    9898    uint8_t *change_bitmap, size_t change_bitmap_size, void *arg);
    9999
    100 int usb_hub_release_default_address(usb_hub_info_t * hub);
    101 
    102100#endif
    103101/**
Note: See TracChangeset for help on using the changeset viewer.