Changeset 355f7c2 in mainline for uspace/srv/hw/bus/usb/hcd/virtual/hub.c
- Timestamp:
- 2010-10-25T07:44:02Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- ca07cd3
- Parents:
- 7a7bfeb3
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/hw/bus/usb/hcd/virtual/hub.c
r7a7bfeb3 r355f7c2 43 43 #include "hubintern.h" 44 44 45 hub_port_t hub_ports[HUB_PORT_COUNT];46 45 47 46 /** Standard device descriptor. */ … … 108 107 }; 109 108 109 /** All hub configuration descriptors. */ 110 110 static usbvirt_device_configuration_extras_t extra_descriptors[] = { 111 111 { … … 137 137 }; 138 138 139 /** Hub as a virtual device. */ 139 140 usbvirt_device_t virthub_dev = { 140 141 .ops = &hub_ops, 141 142 .descriptors = &descriptors, 142 143 }; 143 144 145 /** Hub device. */ 144 146 hub_device_t hub_dev; 145 147 148 /** Initialize virtual hub. */ 146 149 void hub_init(void) 147 150 { … … 156 159 157 160 usbvirt_connect_local(&virthub_dev); 158 //virthub_dev.send_data = send_data; 159 160 printf("%s: virtual hub (%d ports) created.\n", NAME, HUB_PORT_COUNT); 161 } 162 161 162 dprintf(1, "virtual hub (%d ports) created", HUB_PORT_COUNT); 163 } 164 165 /** Connect device to the hub. 166 * 167 * @param device Device to be connected. 168 * @return Port where the device was connected to. 169 */ 163 170 size_t hub_add_device(virtdev_connection_t *device) 164 171 { … … 191 198 } 192 199 193 200 /** Disconnect device from the hub. */ 194 201 void hub_remove_device(virtdev_connection_t *device) 195 202 { … … 209 216 } 210 217 218 /** Tell whether device port is open. 219 * 220 * @return Whether communication to and from the device can go through the hub. 221 */ 211 222 bool hub_can_device_signal(virtdev_connection_t * device) 212 223 { … … 221 232 } 222 233 234 /** Format hub port status. 235 * 236 * @param result Buffer where to store status string. 237 * @param len Number of characters that is possible to store in @p result 238 * (excluding trailing zero). 239 */ 240 void hub_get_port_statuses(char *result, size_t len) 241 { 242 if (len > HUB_PORT_COUNT) { 243 len = HUB_PORT_COUNT; 244 } 245 size_t i; 246 for (i = 0; i < len; i++) { 247 result[i] = hub_port_state_as_char(hub_dev.ports[i].state); 248 } 249 result[len] = 0; 250 } 223 251 224 252 /**
Note:
See TracChangeset
for help on using the changeset viewer.