Changeset fa9b606 in mainline for uspace/drv/vhc/hub.c
- Timestamp:
- 2010-12-10T16:46:54Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- ee0d8a8
- Parents:
- 10096231 (diff), ebb98c5 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/vhc/hub.c
r10096231 rfa9b606 37 37 #include <usbvirt/device.h> 38 38 #include <errno.h> 39 #include <str_error.h> 39 40 #include <stdlib.h> 41 #include <driver.h> 40 42 41 43 #include "vhcd.h" 42 44 #include "hub.h" 43 45 #include "hubintern.h" 46 #include "conn.h" 44 47 45 48 … … 148 151 hub_device_t hub_dev; 149 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 150 175 /** Initialize virtual hub. */ 151 void hub_init( void)176 void hub_init(device_t *hc_dev) 152 177 { 153 178 size_t i; … … 165 190 166 191 dprintf(1, "virtual hub (%d ports) created", HUB_PORT_COUNT); 192 193 usb_address_t hub_address = hub_set_address(&virthub_dev); 194 if (hub_address < 0) { 195 dprintf(1, "problem changing hub address (%s)", 196 str_error(hub_address)); 197 } 198 199 dprintf(2, "virtual hub address changed to %d", hub_address); 200 201 char *id; 202 int rc = asprintf(&id, "usb&hub"); 203 if (rc <= 0) { 204 return; 205 } 206 devman_handle_t hub_handle; 207 rc = child_device_register_wrapper(hc_dev, "hub", id, 10, &hub_handle); 208 if (rc != EOK) { 209 free(id); 210 } 211 212 vhc_iface.bind_address(NULL, hub_address, hub_handle); 213 214 dprintf(2, "virtual hub has devman handle %d", (int) hub_handle); 167 215 } 168 216
Note:
See TracChangeset
for help on using the changeset viewer.