Changeset b8507a1 in mainline
- Timestamp:
- 2010-10-20T21:17:32Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 6c741e1d
- Parents:
- 08af5a6
- Location:
- uspace/srv/hw/bus/usb/hcd/virtual
- Files:
-
- 4 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/hw/bus/usb/hcd/virtual/Makefile
r08af5a6 rb8507a1 28 28 29 29 USPACE_PREFIX = ../../../../../.. 30 LIBS = $(LIBUSB_PREFIX)/libusb.a 30 LIBS = $(LIBUSB_PREFIX)/libusb.a $(LIBUSBVIRT_PREFIX)/libusbvirt.a 31 31 EXTRA_CFLAGS = -I$(LIB_PREFIX) 32 32 BINARY = vhcd … … 37 37 devices.c \ 38 38 hc.c \ 39 hcd.c 39 hcd.c \ 40 hub.c \ 41 hubops.c 40 42 41 43 include $(USPACE_PREFIX)/Makefile.common -
uspace/srv/hw/bus/usb/hcd/virtual/conndev.c
r08af5a6 rb8507a1 40 40 #include "conn.h" 41 41 #include "hc.h" 42 #include "hub.h" 42 43 43 /** Handle data from device to function.44 /** Handle data from device to host. 44 45 */ 45 46 static void handle_data_from_device(ipc_callid_t iid, ipc_call_t icall, … … 50 51 .endpoint = IPC_GET_ARG2(icall) 51 52 }; 53 54 if (!hub_can_device_signal(dev)) { 55 ipc_answer_0(iid, EREFUSED); 56 return; 57 } 52 58 53 59 dprintf("data from device %d [%d.%d]", dev->id, -
uspace/srv/hw/bus/usb/hcd/virtual/devices.c
r08af5a6 rb8507a1 47 47 48 48 #include "devices.h" 49 #include "hub.h" 49 50 50 51 #define list_foreach(pos, head) \ … … 61 62 virtdev_connection_t *virtdev_recognise(int id, int phone) 62 63 { 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); 71 65 72 66 /* … … 98 92 list_append(&dev->link, &devices); 99 93 94 hub_add_device(dev); 95 100 96 return dev; 101 97 } … … 105 101 void virtdev_destroy_device(virtdev_connection_t *dev) 106 102 { 103 hub_remove_device(dev); 107 104 list_remove(&dev->link); 108 105 free(dev); … … 119 116 virtdev_connection_t *dev 120 117 = list_get_instance(pos, virtdev_connection_t, link); 118 119 if (!hub_can_device_signal(dev)) { 120 continue; 121 } 121 122 122 123 ipc_call_t answer_data; … … 143 144 144 145 /* 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 /* 145 155 * TODO: maybe screw some transactions to get more 146 156 * real-life image. -
uspace/srv/hw/bus/usb/hcd/virtual/hcd.c
r08af5a6 rb8507a1 48 48 #include "hc.h" 49 49 #include "devices.h" 50 #include "hub.h" 50 51 #include "conn.h" 51 52 … … 135 136 } 136 137 138 hub_init(); 139 137 140 printf("%s: accepting connections.\n", NAME); 138 141 hc_manager(); -
uspace/srv/hw/bus/usb/hcd/virtual/vhcd.h
r08af5a6 rb8507a1 36 36 #define VHCD_VHCD_H_ 37 37 38 #include <stdio.h> 39 38 40 #define NAME "hcd-virt" 39 41 #define NAMESPACE "usb"
Note:
See TracChangeset
for help on using the changeset viewer.