Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/vhc/hub/hub.c

    r0f21c0c r6cb58e6  
    3434 */
    3535#include <usb/classes/classes.h>
    36 #include <usbvirt/hub.h>
    3736#include <usbvirt/device.h>
    3837#include <errno.h>
    3938#include <str_error.h>
     39#include <assert.h>
    4040#include <stdlib.h>
    41 #include <driver.h>
     41#include <ddf/driver.h>
     42#include <usb/debug.h>
    4243
    4344#include "hub.h"
     
    9596 * @param index Port index (one based).
    9697 */
    97 static void hub_init_port(hub_port_t *port, size_t index)
     98static void hub_init_port(hub_port_t *port, hub_t *hub, size_t index)
    9899{
    99100        port->connected_device = NULL;
     
    101102        port->state = HUB_PORT_STATE_NOT_CONFIGURED;
    102103        port->status_change = 0;
     104        port->hub = hub;
    103105}
    104106
     
    111113        size_t i;
    112114        for (i = 0; i < HUB_PORT_COUNT; i++) {
    113                 hub_init_port(&hub->ports[i], i + 1);
     115                hub_init_port(&hub->ports[i], hub, i + 1);
    114116        }
    115117        hub->custom_data = NULL;
     118        hub->signal_changes = true;
    116119        fibril_mutex_initialize(&hub->guard);
    117120}
     
    228231        }
    229232
     233        usb_log_debug("Setting port %zu to state %d.\n", port_index, state);
     234
    230235        switch (state) {
    231236                case HUB_PORT_STATE_POWERED_OFF:
     
    235240                        break;
    236241                case HUB_PORT_STATE_RESUMING:
     242                        port->state = state;
    237243                        set_port_state_delayed(hub, port_index,
    238244                            10, state, HUB_PORT_STATE_ENABLED);
    239245                        break;
    240246                case HUB_PORT_STATE_RESETTING:
     247                        port->state = state;
    241248                        set_port_state_delayed(hub, port_index,
    242249                            10, state, HUB_PORT_STATE_ENABLED);
     
    414421{
    415422        assert(port != NULL);
     423        uint16_t old_value = port->status_change;
    416424        port->status_change |= change;
     425        usb_log_debug("Changing status change on %zu: %04x => %04x\n",
     426            port->index,
     427            (unsigned int) old_value, (unsigned int) port->status_change);
     428        port->hub->signal_changes = true;
    417429}
    418430
     
    427439        assert(port != NULL);
    428440        port->status_change &= (~change);
     441        port->hub->signal_changes = true;
    429442}
    430443
Note: See TracChangeset for help on using the changeset viewer.