Changes in / [11658b64:a9b6bec] in mainline
- Location:
- uspace
- Files:
-
- 11 added
- 14 deleted
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/virtusbkbd/Makefile
r11658b64 ra9b6bec 33 33 34 34 LIBS = $(LIBUSB_PREFIX)/libusb.a $(LIBUSBVIRT_PREFIX)/libusbvirt.a 35 EXTRA_CFLAGS = -I$(LIBUSB_PREFIX)/include -I$(LIB USBVIRT_PREFIX)/include-I$(LIBDRV_PREFIX)/include35 EXTRA_CFLAGS = -I$(LIBUSB_PREFIX)/include -I$(LIB_PREFIX) -I$(LIBDRV_PREFIX)/include 36 36 37 37 SOURCES = \ -
uspace/app/virtusbkbd/stdreq.c
r11658b64 ra9b6bec 39 39 #include "kbdconfig.h" 40 40 41 int stdreq_on_get_descriptor(struct usbvirt_device *dev, 41 static int on_get_descriptor(struct usbvirt_device *dev, 42 usb_device_request_setup_packet_t *request, uint8_t *data); 43 44 usbvirt_standard_device_request_ops_t standard_request_ops = { 45 .on_get_status = NULL, 46 .on_clear_feature = NULL, 47 .on_set_feature = NULL, 48 .on_set_address = NULL, 49 .on_get_descriptor = on_get_descriptor, 50 .on_set_descriptor = NULL, 51 .on_get_configuration = NULL, 52 .on_set_configuration = NULL, 53 .on_get_interface = NULL, 54 .on_set_interface = NULL, 55 .on_synch_frame = NULL 56 }; 57 58 59 static int on_get_descriptor(struct usbvirt_device *dev, 42 60 usb_device_request_setup_packet_t *request, uint8_t *data) 43 61 { -
uspace/app/virtusbkbd/stdreq.h
r11658b64 ra9b6bec 38 38 #include <usbvirt/device.h> 39 39 40 int stdreq_on_get_descriptor(usbvirt_device_t *, 41 usb_device_request_setup_packet_t *, uint8_t *); 40 extern usbvirt_standard_device_request_ops_t standard_request_ops; 42 41 43 42 #endif -
uspace/app/virtusbkbd/virtusbkbd.c
r11658b64 ra9b6bec 76 76 } 77 77 78 static int on_class_request(struct usbvirt_device *dev, 79 usb_device_request_setup_packet_t *request, uint8_t *data) 80 { 81 printf("%s: class request (%d)\n", NAME, (int) request->request); 82 83 return EOK; 84 } 78 85 79 86 /** Compares current and last status of pressed keys. … … 131 138 } 132 139 133 static usbvirt_control_transfer_handler_t endpoint_zero_handlers[] = {134 {135 .request_type = USBVIRT_MAKE_CONTROL_REQUEST_TYPE(136 USB_DIRECTION_IN,137 USBVIRT_REQUEST_TYPE_STANDARD,138 USBVIRT_REQUEST_RECIPIENT_DEVICE),139 .request = USB_DEVREQ_GET_DESCRIPTOR,140 .name = "GetDescriptor",141 .callback = stdreq_on_get_descriptor142 },143 {144 .request_type = USBVIRT_MAKE_CONTROL_REQUEST_TYPE(145 USB_DIRECTION_IN,146 USBVIRT_REQUEST_TYPE_CLASS,147 USBVIRT_REQUEST_RECIPIENT_DEVICE),148 .request = USB_DEVREQ_GET_DESCRIPTOR,149 .name = "GetDescriptor",150 .callback = stdreq_on_get_descriptor151 },152 USBVIRT_CONTROL_TRANSFER_HANDLER_LAST153 };154 140 155 141 /** Keyboard callbacks. … … 157 143 */ 158 144 static usbvirt_device_ops_t keyboard_ops = { 159 .control_transfer_handlers = endpoint_zero_handlers, 145 .standard_request_ops = &standard_request_ops, 146 .on_class_device_request = on_class_request, 160 147 .on_data = on_incoming_data, 161 148 .on_data_request = on_request_for_data … … 270 257 271 258 printf("%s: Simulating keyboard events...\n", NAME); 272 fibril_sleep(10);273 259 while (1) { 274 260 kb_process_events(&status, keyboard_events, keyboard_events_count, -
uspace/drv/usbhub/utils.c
r11658b64 ra9b6bec 552 552 return; 553 553 } 554 printf("[usb_hub] new device address %d, handle % zu\n",554 printf("[usb_hub] new device address %d, handle %d\n", 555 555 new_device_address, child_handle); 556 556 -
uspace/drv/vhc/Makefile
r11658b64 ra9b6bec 33 33 $(LIBDRV_PREFIX)/libdrv.a 34 34 EXTRA_CFLAGS += \ 35 -I$(LIB USBVIRT_PREFIX)/include\35 -I$(LIB_PREFIX) \ 36 36 -I$(LIBUSB_PREFIX)/include \ 37 37 -I$(LIBDRV_PREFIX)/include … … 39 39 40 40 SOURCES = \ 41 hub/hub.c \42 hub/virthub.c \43 hub/virthubops.c \44 41 conndev.c \ 45 42 connhost.c \ … … 48 45 hc.c \ 49 46 hcd.c \ 50 hub.c 47 hub.c \ 48 hubops.c 51 49 52 50 include $(USPACE_PREFIX)/Makefile.common -
uspace/drv/vhc/connhost.c
r11658b64 ra9b6bec 102 102 transfer->out_callback = callback; 103 103 104 hc_add_transaction_to_device(false, target, transfer_type,buffer, size,104 hc_add_transaction_to_device(false, target, buffer, size, 105 105 universal_callback, transfer); 106 106 … … 122 122 transfer->out_callback = callback; 123 123 124 hc_add_transaction_to_device(true, target, transfer_type,buffer, size,124 hc_add_transaction_to_device(true, target, buffer, size, 125 125 universal_callback, transfer); 126 126 … … 142 142 transfer->in_callback = callback; 143 143 144 hc_add_transaction_from_device(target, transfer_type,buffer, size,144 hc_add_transaction_from_device(target, buffer, size, 145 145 universal_callback, transfer); 146 146 -
uspace/drv/vhc/devices.c
r11658b64 ra9b6bec 47 47 #include "devices.h" 48 48 #include "hub.h" 49 #include "hub/virthub.h"50 49 #include "vhcd.h" 51 50 … … 70 69 list_append(&dev->link, &devices); 71 70 72 virthub_connect_device(&virtual_hub_device,dev);71 hub_add_device(dev); 73 72 74 73 return dev; … … 79 78 void virtdev_destroy_device(virtdev_connection_t *dev) 80 79 { 81 virthub_disconnect_device(&virtual_hub_device,dev);80 hub_remove_device(dev); 82 81 list_remove(&dev->link); 83 82 free(dev); … … 95 94 = list_get_instance(pos, virtdev_connection_t, link); 96 95 97 if (! virthub_is_device_enabled(&virtual_hub_device,dev)) {96 if (!hub_can_device_signal(dev)) { 98 97 continue; 99 98 } … … 146 145 * (if the address matches). 147 146 */ 148 if (virt ual_hub_device.address == transaction->target.address) {147 if (virthub_dev.address == transaction->target.address) { 149 148 size_t tmp; 150 149 dprintf(1, "sending `%s' transaction to hub", … … 152 151 switch (transaction->type) { 153 152 case USBVIRT_TRANSACTION_SETUP: 154 virtual_hub_device.transaction_setup( 155 &virtual_hub_device, 153 virthub_dev.transaction_setup(&virthub_dev, 156 154 transaction->target.endpoint, 157 155 transaction->buffer, transaction->len); … … 159 157 160 158 case USBVIRT_TRANSACTION_IN: 161 virtual_hub_device.transaction_in( 162 &virtual_hub_device, 159 virthub_dev.transaction_in(&virthub_dev, 163 160 transaction->target.endpoint, 164 161 transaction->buffer, transaction->len, … … 170 167 171 168 case USBVIRT_TRANSACTION_OUT: 172 virtual_hub_device.transaction_out( 173 &virtual_hub_device, 169 virthub_dev.transaction_out(&virthub_dev, 174 170 transaction->target.endpoint, 175 171 transaction->buffer, transaction->len); -
uspace/drv/vhc/hc.c
r11658b64 ra9b6bec 68 68 static link_t transaction_list; 69 69 70 #define TRANSACTION_FORMAT "T[%d .%d %s/%s (%d)]"70 #define TRANSACTION_FORMAT "T[%d:%d %s (%d)]" 71 71 #define TRANSACTION_PRINTF(t) \ 72 72 (t).target.address, (t).target.endpoint, \ 73 usb_str_transfer_type((t).transfer_type), \74 73 usbvirt_str_transaction_type((t).type), \ 75 74 (int)(t).len … … 77 76 #define transaction_get_instance(lnk) \ 78 77 list_get_instance(lnk, transaction_t, link) 79 80 #define HUB_STATUS_MAX_LEN (HUB_PORT_COUNT + 64)81 78 82 79 static inline unsigned int pseudo_random(unsigned int *seed) … … 102 99 /** Host controller manager main function. 103 100 */ 104 static int hc_manager_fibril(void *arg)101 void hc_manager(void) 105 102 { 106 103 list_initialize(&transaction_list); … … 117 114 } 118 115 119 char ports[HUB_STATUS_MAX_LEN + 1]; 120 virthub_get_status(&virtual_hub_device, ports, HUB_STATUS_MAX_LEN); 116 char ports[HUB_PORT_COUNT + 2]; 117 hub_get_port_statuses(ports, HUB_PORT_COUNT + 1); 118 dprintf(4, "virtual hub: addr=%d ports=%s", 119 virthub_dev.address, ports); 121 120 122 121 link_t *first_transaction_link = transaction_list.next; … … 126 125 127 126 128 dprintf(0, "about to process " TRANSACTION_FORMAT " [%s]",127 dprintf(0, "about to process " TRANSACTION_FORMAT " (vhub:%s)", 129 128 TRANSACTION_PRINTF(*transaction), ports); 130 129 … … 139 138 free(transaction); 140 139 } 141 142 assert(false && "unreachable");143 return EOK;144 }145 146 void hc_manager(void)147 {148 fid_t fid = fibril_create(hc_manager_fibril, NULL);149 if (fid == 0) {150 printf(NAME ": failed to start HC manager fibril\n");151 return;152 }153 fibril_add_ready(fid);154 140 } 155 141 … … 157 143 */ 158 144 static transaction_t *transaction_create(usbvirt_transaction_type_t type, 159 usb_target_t target, usb_transfer_type_t transfer_type,145 usb_target_t target, 160 146 void * buffer, size_t len, 161 147 hc_transaction_done_callback_t callback, void * arg) … … 165 151 list_initialize(&transaction->link); 166 152 transaction->type = type; 167 transaction->transfer_type = transfer_type;168 153 transaction->target = target; 169 154 transaction->buffer = buffer; … … 181 166 */ 182 167 void hc_add_transaction_to_device(bool setup, usb_target_t target, 183 usb_transfer_type_t transfer_type,184 168 void * buffer, size_t len, 185 169 hc_transaction_done_callback_t callback, void * arg) 186 170 { 187 171 transaction_t *transaction = transaction_create( 188 setup ? USBVIRT_TRANSACTION_SETUP : USBVIRT_TRANSACTION_OUT, 189 target, transfer_type, 172 setup ? USBVIRT_TRANSACTION_SETUP : USBVIRT_TRANSACTION_OUT, target, 190 173 buffer, len, callback, arg); 191 174 list_append(&transaction->link, &transaction_list); … … 195 178 */ 196 179 void hc_add_transaction_from_device(usb_target_t target, 197 usb_transfer_type_t transfer_type,198 180 void * buffer, size_t len, 199 181 hc_transaction_done_callback_t callback, void * arg) 200 182 { 201 183 transaction_t *transaction = transaction_create(USBVIRT_TRANSACTION_IN, 202 target, transfer_type, 203 buffer, len, callback, arg); 184 target, buffer, len, callback, arg); 204 185 list_append(&transaction->link, &transaction_list); 205 186 } -
uspace/drv/vhc/hc.h
r11658b64 ra9b6bec 55 55 /** Transaction type. */ 56 56 usbvirt_transaction_type_t type; 57 /** Transfer type. */58 usb_transfer_type_t transfer_type;59 57 /** Device address. */ 60 58 usb_target_t target; … … 73 71 void hc_manager(void); 74 72 75 void hc_add_transaction_to_device(bool setup, 76 usb_target_t target, usb_transfer_type_t transfer_type, 73 void hc_add_transaction_to_device(bool setup, usb_target_t target, 77 74 void * buffer, size_t len, 78 75 hc_transaction_done_callback_t callback, void * arg); 79 76 80 void hc_add_transaction_from_device( 81 usb_target_t target, usb_transfer_type_t transfer_type, 77 void hc_add_transaction_from_device(usb_target_t target, 82 78 void * buffer, size_t len, 83 79 hc_transaction_done_callback_t callback, void * arg); -
uspace/drv/vhc/hcd.c
r11658b64 ra9b6bec 79 79 * Initialize our hub and announce its presence. 80 80 */ 81 virtual_hub_device_init(dev);81 hub_init(dev); 82 82 83 83 printf("%s: virtual USB host controller ready.\n", NAME); … … 95 95 }; 96 96 97 /** Fibril wrapper for HC transaction manager. 98 * 99 * @param arg Not used. 100 * @return Nothing, return argument is unreachable. 101 */ 102 static int hc_manager_fibril(void *arg) 103 { 104 hc_manager(); 105 return EOK; 106 } 97 107 98 108 int main(int argc, char * argv[]) 99 109 { 110 printf("%s: virtual USB host controller driver.\n", NAME); 111 112 usb_dprintf_enable(NAME, 0); 113 114 fid_t fid = fibril_create(hc_manager_fibril, NULL); 115 if (fid == 0) { 116 printf("%s: failed to start HC manager fibril\n", NAME); 117 return ENOMEM; 118 } 119 fibril_add_ready(fid); 120 100 121 /* 101 122 * Temporary workaround. Wait a little bit to be the last driver 102 123 * in devman output. 103 124 */ 104 sleep(5); 105 106 usb_dprintf_enable(NAME, 0); 107 108 printf(NAME ": virtual USB host controller driver.\n"); 109 110 hc_manager(); 125 sleep(4); 111 126 112 127 return driver_main(&vhc_driver); -
uspace/drv/vhc/hub.c
r11658b64 ra9b6bec 40 40 #include <stdlib.h> 41 41 #include <driver.h> 42 #include <usb/usbdrv.h> 43 42 43 #include "vhcd.h" 44 44 #include "hub.h" 45 #include "hub/virthub.h" 46 #include "vhcd.h" 47 48 usbvirt_device_t virtual_hub_device; 49 50 static int hub_register_in_devman_fibril(void *arg); 51 52 void virtual_hub_device_init(device_t *hc_dev) 53 { 54 virthub_init(&virtual_hub_device); 55 56 /* 57 * We need to register the root hub. 58 * This must be done in separate fibril because the device 59 * we are connecting to are ourselves and we cannot connect 60 * before leaving the add_device() function. 61 */ 62 fid_t root_hub_registration 63 = fibril_create(hub_register_in_devman_fibril, hc_dev); 64 if (root_hub_registration == 0) { 65 printf(NAME ": failed to register root hub\n"); 45 #include "hubintern.h" 46 #include "conn.h" 47 48 49 /** Standard device descriptor. */ 50 usb_standard_device_descriptor_t std_device_descriptor = { 51 .length = sizeof(usb_standard_device_descriptor_t), 52 .descriptor_type = USB_DESCTYPE_DEVICE, 53 .usb_spec_version = 0x110, 54 .device_class = USB_CLASS_HUB, 55 .device_subclass = 0, 56 .device_protocol = 0, 57 .max_packet_size = 64, 58 .configuration_count = 1 59 }; 60 61 /** Standard interface descriptor. */ 62 usb_standard_interface_descriptor_t std_interface_descriptor = { 63 .length = sizeof(usb_standard_interface_descriptor_t), 64 .descriptor_type = USB_DESCTYPE_INTERFACE, 65 .interface_number = 0, 66 .alternate_setting = 0, 67 .endpoint_count = 1, 68 .interface_class = USB_CLASS_HUB, 69 .interface_subclass = 0, 70 .interface_protocol = 0, 71 .str_interface = 0 72 }; 73 74 hub_descriptor_t hub_descriptor = { 75 .length = sizeof(hub_descriptor_t), 76 .type = USB_DESCTYPE_HUB, 77 .port_count = HUB_PORT_COUNT, 78 .characteristics = 0, 79 .power_on_warm_up = 50, /* Huh? */ 80 .max_current = 100, /* Huh again. */ 81 .removable_device = { 0 }, 82 .port_power = { 0xFF } 83 }; 84 85 /** Endpoint descriptor. */ 86 usb_standard_endpoint_descriptor_t endpoint_descriptor = { 87 .length = sizeof(usb_standard_endpoint_descriptor_t), 88 .descriptor_type = USB_DESCTYPE_ENDPOINT, 89 .endpoint_address = HUB_STATUS_CHANGE_PIPE | 128, 90 .attributes = USB_TRANSFER_INTERRUPT, 91 .max_packet_size = 8, 92 .poll_interval = 0xFF 93 }; 94 95 /** Standard configuration descriptor. */ 96 usb_standard_configuration_descriptor_t std_configuration_descriptor = { 97 .length = sizeof(usb_standard_configuration_descriptor_t), 98 .descriptor_type = USB_DESCTYPE_CONFIGURATION, 99 .total_length = 100 sizeof(usb_standard_configuration_descriptor_t) 101 + sizeof(std_interface_descriptor) 102 + sizeof(hub_descriptor) 103 + sizeof(endpoint_descriptor) 104 , 105 .interface_count = 1, 106 .configuration_number = HUB_CONFIGURATION_ID, 107 .str_configuration = 0, 108 .attributes = 128, /* denotes bus-powered device */ 109 .max_power = 50 110 }; 111 112 /** All hub configuration descriptors. */ 113 static usbvirt_device_configuration_extras_t extra_descriptors[] = { 114 { 115 .data = (uint8_t *) &std_interface_descriptor, 116 .length = sizeof(std_interface_descriptor) 117 }, 118 { 119 .data = (uint8_t *) &hub_descriptor, 120 .length = sizeof(hub_descriptor) 121 }, 122 { 123 .data = (uint8_t *) &endpoint_descriptor, 124 .length = sizeof(endpoint_descriptor) 125 } 126 }; 127 128 /** Hub configuration. */ 129 usbvirt_device_configuration_t configuration = { 130 .descriptor = &std_configuration_descriptor, 131 .extra = extra_descriptors, 132 .extra_count = sizeof(extra_descriptors)/sizeof(extra_descriptors[0]) 133 }; 134 135 /** Hub standard descriptors. */ 136 usbvirt_descriptors_t descriptors = { 137 .device = &std_device_descriptor, 138 .configuration = &configuration, 139 .configuration_count = 1, 140 }; 141 142 /** Hub as a virtual device. */ 143 usbvirt_device_t virthub_dev = { 144 .ops = &hub_ops, 145 .descriptors = &descriptors, 146 .lib_debug_level = 0, 147 .lib_debug_enabled_tags = USBVIRT_DEBUGTAG_ALL 148 }; 149 150 /** Hub device. */ 151 hub_device_t hub_dev; 152 153 static usb_address_t hub_set_address(usbvirt_device_t *hub) 154 { 155 usb_address_t new_address; 156 int rc = vhc_iface.request_address(NULL, &new_address); 157 if (rc != EOK) { 158 return rc; 159 } 160 161 usb_device_request_setup_packet_t setup_packet = { 162 .request_type = 0, 163 .request = USB_DEVREQ_SET_ADDRESS, 164 .index = 0, 165 .length = 0, 166 }; 167 setup_packet.value = new_address; 168 169 hub->transaction_setup(hub, 0, &setup_packet, sizeof(setup_packet)); 170 hub->transaction_in(hub, 0, NULL, 0, NULL); 171 172 return new_address; 173 } 174 175 /** Initialize virtual hub. */ 176 void hub_init(device_t *hc_dev) 177 { 178 size_t i; 179 180 for (i = 0; i < HUB_PORT_COUNT; i++) { 181 hub_port_t *port = &hub_dev.ports[i]; 182 183 port->index = (int) i + 1; 184 port->device = NULL; 185 port->state = HUB_PORT_STATE_NOT_CONFIGURED; 186 port->status_change = 0; 187 fibril_mutex_initialize(&port->guard); 188 } 189 190 usbvirt_connect_local(&virthub_dev); 191 192 dprintf(1, "virtual hub (%d ports) created", HUB_PORT_COUNT); 193 194 usb_address_t hub_address = hub_set_address(&virthub_dev); 195 if (hub_address < 0) { 196 dprintf(1, "problem changing hub address (%s)", 197 str_error(hub_address)); 198 } 199 200 dprintf(2, "virtual hub address changed to %d", hub_address); 201 202 char *id; 203 int rc = asprintf(&id, "usb&hub"); 204 if (rc <= 0) { 66 205 return; 67 206 } 68 69 fibril_add_ready(root_hub_registration);70 }71 72 /** Register root hub in devman.73 *74 * @param arg Host controller device (type <code>device_t *</code>).75 * @return Error code.76 */77 int hub_register_in_devman_fibril(void *arg)78 {79 device_t *hc_dev = (device_t *) arg;80 81 int hc = usb_drv_hc_connect(hc_dev, IPC_FLAG_BLOCKING);82 if (hc < 0) {83 printf(NAME ": failed to register root hub\n");84 return hc;85 }86 87 usb_drv_reserve_default_address(hc);88 89 usb_address_t hub_address = usb_drv_request_address(hc);90 usb_drv_req_set_address(hc, USB_ADDRESS_DEFAULT, hub_address);91 92 usb_drv_release_default_address(hc);93 94 207 devman_handle_t hub_handle; 95 usb_drv_register_child_in_devman(hc, hc_dev, hub_address, &hub_handle); 96 usb_drv_bind_address(hc, hub_address, hub_handle); 97 98 return EOK; 99 } 100 208 rc = child_device_register_wrapper(hc_dev, "hub", id, 10, &hub_handle); 209 if (rc != EOK) { 210 free(id); 211 } 212 213 vhc_iface.bind_address(NULL, hub_address, hub_handle); 214 215 dprintf(2, "virtual hub has devman handle %d", (int) hub_handle); 216 } 217 218 /** Connect device to the hub. 219 * 220 * @param device Device to be connected. 221 * @return Port where the device was connected to. 222 */ 223 size_t hub_add_device(virtdev_connection_t *device) 224 { 225 size_t i; 226 for (i = 0; i < HUB_PORT_COUNT; i++) { 227 hub_port_t *port = &hub_dev.ports[i]; 228 fibril_mutex_lock(&port->guard); 229 230 if (port->device != NULL) { 231 fibril_mutex_unlock(&port->guard); 232 continue; 233 } 234 235 port->device = device; 236 237 /* 238 * TODO: 239 * If the hub was configured, we can normally 240 * announce the plug-in. 241 * Otherwise, we will wait until hub is configured 242 * and announce changes in single burst. 243 */ 244 //if (port->state == HUB_PORT_STATE_DISCONNECTED) { 245 port->state = HUB_PORT_STATE_DISABLED; 246 set_port_status_change_nl(port, HUB_STATUS_C_PORT_CONNECTION); 247 //} 248 249 fibril_mutex_unlock(&port->guard); 250 251 return i; 252 } 253 254 return (size_t)-1; 255 } 256 257 /** Disconnect device from the hub. */ 258 void hub_remove_device(virtdev_connection_t *device) 259 { 260 size_t i; 261 for (i = 0; i < HUB_PORT_COUNT; i++) { 262 hub_port_t *port = &hub_dev.ports[i]; 263 264 if (port->device != device) { 265 continue; 266 } 267 268 port->device = NULL; 269 port->state = HUB_PORT_STATE_DISCONNECTED; 270 271 set_port_status_change(port, HUB_STATUS_C_PORT_CONNECTION); 272 } 273 } 274 275 /** Tell whether device port is open. 276 * 277 * @return Whether communication to and from the device can go through the hub. 278 */ 279 bool hub_can_device_signal(virtdev_connection_t * device) 280 { 281 size_t i; 282 for (i = 0; i < HUB_PORT_COUNT; i++) { 283 if (hub_dev.ports[i].device == device) { 284 return hub_dev.ports[i].state == HUB_PORT_STATE_ENABLED; 285 } 286 } 287 288 return false; 289 } 290 291 /** Format hub port status. 292 * 293 * @param result Buffer where to store status string. 294 * @param len Number of characters that is possible to store in @p result 295 * (excluding trailing zero). 296 */ 297 void hub_get_port_statuses(char *result, size_t len) 298 { 299 if (len > HUB_PORT_COUNT) { 300 len = HUB_PORT_COUNT; 301 } 302 size_t i; 303 for (i = 0; i < len; i++) { 304 result[i] = hub_port_state_as_char(hub_dev.ports[i].state); 305 } 306 result[len] = 0; 307 } 101 308 102 309 /** -
uspace/drv/vhc/hub.h
r11658b64 ra9b6bec 40 40 41 41 #include "devices.h" 42 #include "hub/hub.h"43 #include "hub/virthub.h"44 42 45 extern usbvirt_device_t virtual_hub_device; 43 #define HUB_PORT_COUNT 2 46 44 47 void virtual_hub_device_init(device_t *); 45 #define BITS2BYTES(bits) \ 46 (bits ? ((((bits)-1)>>3)+1) : 0) 47 48 extern usbvirt_device_t virthub_dev; 49 50 void hub_init(device_t *); 51 size_t hub_add_device(virtdev_connection_t *); 52 void hub_remove_device(virtdev_connection_t *); 53 bool hub_can_device_signal(virtdev_connection_t *); 54 void hub_get_port_statuses(char *result, size_t len); 48 55 49 56 #endif -
uspace/lib/c/generic/devman.c
r11658b64 ra9b6bec 230 230 231 231 if (flags & IPC_FLAG_BLOCKING) { 232 phone = async_connect_me_to_blocking(PHONE_NS, SERVICE_DEVMAN,232 phone = ipc_connect_me_to_blocking(PHONE_NS, SERVICE_DEVMAN, 233 233 DEVMAN_CONNECT_TO_DEVICE, handle); 234 234 } else { 235 phone = async_connect_me_to(PHONE_NS, SERVICE_DEVMAN,235 phone = ipc_connect_me_to(PHONE_NS, SERVICE_DEVMAN, 236 236 DEVMAN_CONNECT_TO_DEVICE, handle); 237 237 } -
uspace/lib/usb/src/usbdrv.c
r11658b64 ra9b6bec 72 72 devman_handle_t handle; 73 73 74 rc = devman_device_get_handle("/virt/usbhc", &handle, flags);74 rc = devman_device_get_handle("/virt/usbhc", &handle, 0); 75 75 if (rc != EOK) { 76 76 return rc; 77 77 } 78 78 79 int phone = devman_device_connect(handle, flags);79 int phone = devman_device_connect(handle, 0); 80 80 81 81 return phone; -
uspace/lib/usbvirt/Makefile
r11658b64 ra9b6bec 31 31 32 32 LIBS = $(LIBUSB_PREFIX)/libusb.a 33 EXTRA_CFLAGS = -I$(LIBUSB_PREFIX)/include -Iinclude33 EXTRA_CFLAGS = -I$(LIBUSB_PREFIX)/include 34 34 35 35 SOURCES = \ 36 src/callback.c \37 src/ctrlpipe.c \38 src/debug.c \39 src/main.c \40 s rc/stdreq.c \41 src/transaction.c36 callback.c \ 37 ctrlpipe.c \ 38 debug.c \ 39 main.c \ 40 stdreq.c \ 41 transaction.c 42 42 43 43 include $(USPACE_PREFIX)/Makefile.common
Note:
See TracChangeset
for help on using the changeset viewer.