Ignore:
Timestamp:
2010-10-24T16:43:40Z (15 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/conndev.c

    rb8a3cda r7a7bfeb3  
    4242#include "hub.h"
    4343
    44 /** Handle data from device to host.
    45  */
    46 static void handle_data_from_device(ipc_callid_t iid, ipc_call_t icall,
    47     virtdev_connection_t *dev)
    48 {
    49         usb_target_t target = {
    50                 .address = IPC_GET_ARG1(icall),
    51                 .endpoint = IPC_GET_ARG2(icall)
    52         };
    53         size_t len = IPC_GET_ARG3(icall);
    54        
    55         if (!hub_can_device_signal(dev)) {
    56                 ipc_answer_0(iid, EREFUSED);
    57                 return;
    58         }
    59        
    60         dprintf("data from device %d [%d.%d]", dev->id,
    61             target.address, target.endpoint);
    62        
    63         int rc;
    64        
    65         void * buffer = NULL;
    66         if (len > 0) {
    67                 rc = async_data_write_accept(&buffer, false,
    68                     1, USB_MAX_PAYLOAD_SIZE,
    69                     0, &len);
    70                
    71                 if (rc != EOK) {
    72                         ipc_answer_0(iid, rc);
    73                         return;
    74                 }
    75         }
    76        
    77         rc = hc_fillin_transaction_from_device(target, buffer, len);
    78        
    79         ipc_answer_0(iid, rc);
    80 }
    81 
    8244/** Connection handler for communcation with virtual device.
    8345 *
     
    11072                                break;
    11173                       
    112                         case IPC_M_USBVIRT_DATA_FROM_DEVICE:
    113                                 handle_data_from_device(callid, call, dev);
    114                                 break;
    115                        
    11674                        default:
    11775                                ipc_answer_0(callid, EINVAL);
Note: See TracChangeset for help on using the changeset viewer.