Changeset cd4ae1e in mainline for uspace/drv/vhc/hub/hub.c


Ignore:
Timestamp:
2011-04-28T13:14:14Z (13 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
54d71e1, a146aa33
Parents:
74f00b6 (diff), c82135a8 (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:

Better virtual USB HID; USB-virt rewritten

The new virtual USB HID is easily extensible with new interfaces that
might provide different report descriptors.

The virtual host controller was completely rewritten together
with the libusbvirt.

The documentation is missing and the code would deserver some refactoring.
That will appear later.

File:
1 edited

Legend:

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

    r74f00b6 rcd4ae1e  
    3434 */
    3535#include <usb/classes/classes.h>
    36 #include <usbvirt/hub.h>
    3736#include <usbvirt/device.h>
    3837#include <errno.h>
     
    4140#include <stdlib.h>
    4241#include <ddf/driver.h>
     42#include <usb/debug.h>
    4343
    4444#include "hub.h"
     
    9696 * @param index Port index (one based).
    9797 */
    98 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)
    9999{
    100100        port->connected_device = NULL;
     
    102102        port->state = HUB_PORT_STATE_NOT_CONFIGURED;
    103103        port->status_change = 0;
     104        port->hub = hub;
    104105}
    105106
     
    112113        size_t i;
    113114        for (i = 0; i < HUB_PORT_COUNT; i++) {
    114                 hub_init_port(&hub->ports[i], i + 1);
     115                hub_init_port(&hub->ports[i], hub, i + 1);
    115116        }
    116117        hub->custom_data = NULL;
     118        hub->signal_changes = true;
    117119        fibril_mutex_initialize(&hub->guard);
    118120}
     
    229231        }
    230232
     233        usb_log_debug("Setting port %zu to state %d.\n", port_index, state);
     234
    231235        switch (state) {
    232236                case HUB_PORT_STATE_POWERED_OFF:
     
    236240                        break;
    237241                case HUB_PORT_STATE_RESUMING:
     242                        port->state = state;
    238243                        set_port_state_delayed(hub, port_index,
    239244                            10, state, HUB_PORT_STATE_ENABLED);
    240245                        break;
    241246                case HUB_PORT_STATE_RESETTING:
     247                        port->state = state;
    242248                        set_port_state_delayed(hub, port_index,
    243249                            10, state, HUB_PORT_STATE_ENABLED);
     
    415421{
    416422        assert(port != NULL);
     423        uint16_t old_value = port->status_change;
    417424        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;
    418429}
    419430
     
    428439        assert(port != NULL);
    429440        port->status_change &= (~change);
     441        port->hub->signal_changes = true;
    430442}
    431443
Note: See TracChangeset for help on using the changeset viewer.