Ignore:
Timestamp:
2010-10-24T16:43:40Z (14 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
355f7c2
Parents:
b8a3cda
Message:

Virtual USB overhaul almost complete

The virtual HC, hub and keyboard are rewritten after changes to HCD API.
Comments will be added later.

File:
1 edited

Legend:

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

    rb8a3cda r7a7bfeb3  
    144144hub_device_t hub_dev;
    145145
    146 static int send_data(struct usbvirt_device *dev,
    147             usb_endpoint_t endpoint, void *buffer, size_t size)
    148 {
    149         usb_target_t target = { dev->address, endpoint };
    150         void *my_buffer = NULL;
    151         if (size > 0) {
    152                 my_buffer = malloc(size);
    153                 memcpy(my_buffer, buffer, size);
    154         }
    155         hc_fillin_transaction_from_device(target, my_buffer, size);
    156        
    157         return EOK;
    158 }
    159 
    160146void hub_init(void)
    161147{
     
    170156       
    171157        usbvirt_connect_local(&virthub_dev);
    172         virthub_dev.send_data = send_data;
     158        //virthub_dev.send_data = send_data;
    173159       
    174160        printf("%s: virtual hub (%d ports) created.\n", NAME, HUB_PORT_COUNT);
     
    235221}
    236222
    237 void hub_check_port_changes(void)
    238 {
    239         /* FIXME - what if HUB_PORT_COUNT is greater than 8. */
    240         uint8_t change_map = 0;
    241        
    242         size_t i;
    243         for (i = 0; i < HUB_PORT_COUNT; i++) {
    244                 hub_port_t *port = &hub_dev.ports[i];
    245                
    246                 if (port->status_change != 0) {
    247                         change_map |= (1 << (i + 1));
    248                 }
    249         }
    250        
    251         /* FIXME - do not send when it has not changed since previous run. */
    252         if (change_map != 0) {
    253                 virthub_dev.send_data(&virthub_dev, HUB_STATUS_CHANGE_PIPE,
    254                     &change_map, 1);
    255         }
    256 }
    257223
    258224/**
Note: See TracChangeset for help on using the changeset viewer.