Ignore:
Timestamp:
2010-10-20T21:17:32Z (14 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
6c741e1d
Parents:
08af5a6
Message:

Virtual USB HC has a hub

So far, the hub does not respond to requests and automatically enables
any port device connects to. Will be completed in next revisions (hope
very soon).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/hw/bus/usb/hcd/virtual/devices.c

    r08af5a6 rb8507a1  
    4747
    4848#include "devices.h"
     49#include "hub.h"
    4950
    5051#define list_foreach(pos, head) \
     
    6162virtdev_connection_t *virtdev_recognise(int id, int phone)
    6263{
    63         virtdev_connection_t * dev = NULL;
    64         switch (id) {
    65                 case USBVIRT_DEV_KEYBOARD_ID:
    66                         dev = virtdev_add_device(phone);
    67                         break;
    68                 default:
    69                         break;
    70         }
     64        virtdev_connection_t * dev = virtdev_add_device(phone);
    7165       
    7266        /*
     
    9892        list_append(&dev->link, &devices);
    9993       
     94        hub_add_device(dev);
     95       
    10096        return dev;
    10197}
     
    105101void virtdev_destroy_device(virtdev_connection_t *dev)
    106102{
     103        hub_remove_device(dev);
    107104        list_remove(&dev->link);
    108105        free(dev);
     
    119116                virtdev_connection_t *dev
    120117                    = list_get_instance(pos, virtdev_connection_t, link);
     118               
     119                if (!hub_can_device_signal(dev)) {
     120                        continue;
     121                }
    121122               
    122123                ipc_call_t answer_data;
     
    143144       
    144145        /*
     146         * Send the data to the virtual hub as well
     147         * (if the address matches).
     148         */
     149        if (virthub_dev.address == transaction->target.address) {
     150                virthub_dev.receive_data(&virthub_dev, transaction->target.endpoint,
     151                    transaction->buffer, transaction->len);
     152        }
     153       
     154        /*
    145155         * TODO: maybe screw some transactions to get more
    146156         * real-life image.
Note: See TracChangeset for help on using the changeset viewer.