Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 11349a85 in mainline


Ignore:
Timestamp:
2011-05-08T19:02:07Z (11 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master
Children:
511cfc8
Parents:
8855939
Message:

Use non-printed debug statement to wait the right amount of time (nasty-way)

Fixes bug #98
UHCI rh tries multiple(4) times to initialize a device.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/uhci-rhd/port.c

    r8855939 r11349a85  
    212212
    213213        /*
    214          * Resets from root ports should be nominally 50ms
     214         * Resets from root ports should be nominally 50ms (USB spec 7.1.7.3)
    215215         */
    216216        {
     
    223223                port_status &= ~STATUS_IN_RESET;
    224224                uhci_port_write_status(port, port_status);
    225                 usb_log_debug("%s: Reset Signal stop.\n", port->id_string);
    226         }
    227 
     225                while (uhci_port_read_status(port) & STATUS_IN_RESET);
     226                // TODO: find a better way to waste time (it should be less than
     227                // 10ms, if we reschedule it takes too much time (random
     228                // interrupts can be solved by multiple attempts).
     229                usb_log_debug2("%s: Reset Signal stop.\n", port->id_string);
     230        }
    228231        /* Enable the port. */
    229232        uhci_port_set_enabled(port, true);
     233
     234        /* Reset recovery period,
     235         * devices do not have to respond during this period
     236         */
     237        async_usleep(10000);
    230238        return EOK;
    231239}
     
    246254        usb_log_debug("%s: Detected new device.\n", port->id_string);
    247255
     256        int ret, count = 0;
    248257        usb_address_t dev_addr;
    249         int ret = usb_hc_new_device_wrapper(port->rh, &port->hc_connection,
    250             speed, uhci_port_reset_enable, port->number, port,
    251             &dev_addr, &port->attached_device, NULL, NULL, NULL);
     258        do {
     259                ret = usb_hc_new_device_wrapper(port->rh, &port->hc_connection,
     260                    speed, uhci_port_reset_enable, port->number, port,
     261                    &dev_addr, &port->attached_device, NULL, NULL, NULL);
     262        } while (ret != EOK && ++count < 4);
    252263
    253264        if (ret != EOK) {
Note: See TracChangeset for help on using the changeset viewer.