Changes in uspace/drv/usbhub/usbhub.c [563fb40:15b0432] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/usbhub/usbhub.c
r563fb40 r15b0432 39 39 40 40 #include <usb_iface.h> 41 #include <usb/ usbdrv.h>41 #include <usb/ddfiface.h> 42 42 #include <usb/descriptor.h> 43 43 #include <usb/recognise.h> 44 #include <usb/ devreq.h>44 #include <usb/request.h> 45 45 #include <usb/classes/hub.h> 46 46 … … 49 49 #include "port_status.h" 50 50 #include "usb/usb.h" 51 52 static int iface_get_hc_handle(device_t *device, devman_handle_t *handle) 53 { 54 return usb_hc_find(device->handle, handle); 55 } 56 57 static usb_iface_t hub_usb_iface = { 58 .get_hc_handle = iface_get_hc_handle 51 #include "usb/pipes.h" 52 #include "usb/classes/classes.h" 53 54 static device_ops_t hub_device_ops = { 55 .interfaces[USB_DEV_IFACE] = &usb_iface_hub_impl 59 56 }; 60 57 61 static device_ops_t hub_device_ops = { 62 .interfaces[USB_DEV_IFACE] = &hub_usb_iface 58 /** Hub status-change endpoint description */ 59 static usb_endpoint_description_t status_change_endpoint_description = { 60 .transfer_type = USB_TRANSFER_INTERRUPT, 61 .direction = USB_DIRECTION_IN, 62 .interface_class = USB_CLASS_HUB, 63 .flags = 0 63 64 }; 65 64 66 65 67 //********************************************* … … 69 71 //********************************************* 70 72 71 usb_hub_info_t * usb_create_hub_info(device_t * device, int hc) { 73 /** 74 * Initialize connnections to host controller, device, and device 75 * control endpoint 76 * @param hub 77 * @param device 78 * @return 79 */ 80 static int usb_hub_init_communication(usb_hub_info_t * hub){ 81 int opResult; 82 opResult = usb_device_connection_initialize_from_device( 83 &hub->device_connection, 84 hub->device); 85 if(opResult != EOK){ 86 dprintf(USB_LOG_LEVEL_ERROR, 87 "could not initialize connection to hc, errno %d",opResult); 88 return opResult; 89 } 90 opResult = usb_hc_connection_initialize_from_device(&hub->connection, 91 hub->device); 92 if(opResult != EOK){ 93 dprintf(USB_LOG_LEVEL_ERROR, 94 "could not initialize connection to device, errno %d",opResult); 95 return opResult; 96 } 97 opResult = usb_endpoint_pipe_initialize_default_control(&hub->endpoints.control, 98 &hub->device_connection); 99 if(opResult != EOK){ 100 dprintf(USB_LOG_LEVEL_ERROR, 101 "could not initialize connection to device endpoint, errno %d",opResult); 102 } 103 return opResult; 104 } 105 106 /** 107 * When entering this function, hub->endpoints.control should be active. 108 * @param hub 109 * @return 110 */ 111 static int usb_hub_process_configuration_descriptors( 112 usb_hub_info_t * hub){ 113 if(hub==NULL) { 114 return EINVAL; 115 } 116 int opResult; 117 118 //device descriptor 119 usb_standard_device_descriptor_t std_descriptor; 120 opResult = usb_request_get_device_descriptor(&hub->endpoints.control, 121 &std_descriptor); 122 if(opResult!=EOK){ 123 dprintf(USB_LOG_LEVEL_ERROR, "could not get device descriptor, %d",opResult); 124 return opResult; 125 } 126 dprintf(USB_LOG_LEVEL_INFO, "hub has %d configurations", 127 std_descriptor.configuration_count); 128 if(std_descriptor.configuration_count<1){ 129 dprintf(USB_LOG_LEVEL_ERROR, "THERE ARE NO CONFIGURATIONS AVAILABLE"); 130 //shouldn`t I return? 131 } 132 133 //configuration descriptor 134 /// \TODO check other configurations 135 usb_standard_configuration_descriptor_t config_descriptor; 136 opResult = usb_request_get_bare_configuration_descriptor( 137 &hub->endpoints.control, 0, 138 &config_descriptor); 139 if(opResult!=EOK){ 140 dprintf(USB_LOG_LEVEL_ERROR, "could not get configuration descriptor, %d",opResult); 141 return opResult; 142 } 143 //set configuration 144 opResult = usb_request_set_configuration(&hub->endpoints.control, 145 config_descriptor.configuration_number); 146 147 if (opResult != EOK) { 148 dprintf(USB_LOG_LEVEL_ERROR, 149 "something went wrong when setting hub`s configuration, %d", 150 opResult); 151 return opResult; 152 } 153 dprintf(USB_LOG_LEVEL_DEBUG, "\tused configuration %d", 154 config_descriptor.configuration_number); 155 156 //full configuration descriptor 157 size_t transferred = 0; 158 uint8_t * descriptors = (uint8_t *)malloc(config_descriptor.total_length); 159 if (descriptors == NULL) { 160 dprintf(USB_LOG_LEVEL_ERROR, "insufficient memory"); 161 return ENOMEM; 162 } 163 opResult = usb_request_get_full_configuration_descriptor(&hub->endpoints.control, 164 0, descriptors, 165 config_descriptor.total_length, &transferred); 166 if(opResult!=EOK){ 167 free(descriptors); 168 dprintf(USB_LOG_LEVEL_ERROR, 169 "could not get full configuration descriptor, %d",opResult); 170 return opResult; 171 } 172 if (transferred != config_descriptor.total_length) { 173 dprintf(USB_LOG_LEVEL_ERROR, 174 "received incorrect full configuration descriptor"); 175 return ELIMIT; 176 } 177 178 /** 179 * Initialize the interrupt in endpoint. 180 * \TODO this code should be checked... 181 */ 182 usb_endpoint_mapping_t endpoint_mapping[1] = { 183 { 184 .pipe = &hub->endpoints.status_change, 185 .description = &status_change_endpoint_description, 186 .interface_no = 187 usb_device_get_assigned_interface(hub->device) 188 } 189 }; 190 opResult = usb_endpoint_pipe_initialize_from_configuration( 191 endpoint_mapping, 1, 192 descriptors, config_descriptor.total_length, 193 &hub->device_connection); 194 if (opResult != EOK) { 195 dprintf(USB_LOG_LEVEL_ERROR, 196 "Failed to initialize status change pipe: %s", 197 str_error(opResult)); 198 return opResult; 199 } 200 if (!endpoint_mapping[0].present) { 201 dprintf(USB_LOG_LEVEL_ERROR,"Not accepting device, " \ 202 "cannot understand what is happenning"); 203 return EREFUSED; 204 } 205 206 free(descriptors); 207 return EOK; 208 209 210 // Initialize the interrupt(=status change) endpoint. 211 /*usb_endpoint_pipe_initialize( 212 &result->endpoints->status_change, 213 &result->device_connection, );USB_TRANSFER_INTERRUPT 214 USB_DIRECTION_IN*/ 215 216 } 217 218 219 /** 220 * Create hub representation from device information. 221 * @param device 222 * @return pointer to created structure or NULL in case of error 223 */ 224 usb_hub_info_t * usb_create_hub_info(device_t * device) { 72 225 usb_hub_info_t* result = usb_new(usb_hub_info_t); 226 result->device = device; 227 int opResult; 228 opResult = usb_hub_init_communication(result); 229 if(opResult != EOK){ 230 free(result); 231 return NULL; 232 } 233 73 234 //result->device = device; 74 235 result->port_count = -1; 75 /// \TODO is this correct? is the device stored?76 236 result->device = device; 77 237 78 79 dprintf(USB_LOG_LEVEL_DEBUG, "phone to hc = %d", hc); 80 if (hc < 0) { 81 return result; 82 } 83 //get some hub info 84 usb_address_t addr = usb_drv_get_my_address(hc, device); 85 dprintf(USB_LOG_LEVEL_DEBUG, "address of newly created hub = %d", addr); 86 /*if(addr<0){ 87 //return result; 88 89 }*/ 90 91 result->address = addr; 238 //result->usb_device = usb_new(usb_hcd_attached_device_info_t); 239 size_t received_size; 92 240 93 241 // get hub descriptor 94 95 242 dprintf(USB_LOG_LEVEL_DEBUG, "creating serialized descripton"); 96 243 void * serialized_descriptor = malloc(USB_HUB_MAX_DESCRIPTOR_SIZE); 97 244 usb_hub_descriptor_t * descriptor; 98 size_t received_size;99 int opResult;100 245 dprintf(USB_LOG_LEVEL_DEBUG, "starting control transaction"); 101 102 opResult = usb_ drv_req_get_descriptor(hc, addr,246 usb_endpoint_pipe_start_session(&result->endpoints.control); 247 opResult = usb_request_get_descriptor(&result->endpoints.control, 103 248 USB_REQUEST_TYPE_CLASS, 104 249 USB_DESCTYPE_HUB, 0, 0, serialized_descriptor, 105 250 USB_HUB_MAX_DESCRIPTOR_SIZE, &received_size); 251 usb_endpoint_pipe_end_session(&result->endpoints.control); 106 252 107 253 if (opResult != EOK) { … … 117 263 return result; 118 264 } 265 266 119 267 dprintf(USB_LOG_LEVEL_INFO, "setting port count to %d",descriptor->ports_count); 120 268 result->port_count = descriptor->ports_count; 121 result->attached_devs = (usb_h ub_attached_device_t*)122 malloc((result->port_count+1) * sizeof(usb_h ub_attached_device_t));269 result->attached_devs = (usb_hc_attached_device_t*) 270 malloc((result->port_count+1) * sizeof(usb_hc_attached_device_t)); 123 271 int i; 124 272 for(i=0;i<result->port_count+1;++i){ 125 result->attached_devs[i]. devman_handle=0;273 result->attached_devs[i].handle=0; 126 274 result->attached_devs[i].address=0; 127 275 } … … 138 286 } 139 287 288 /** 289 * Create hub representation and add it into hub list 290 * @param dev 291 * @return 292 */ 140 293 int usb_add_hub_device(device_t *dev) { 141 294 dprintf(USB_LOG_LEVEL_INFO, "add_hub_device(handle=%d)", (int) dev->handle); 142 295 143 /*144 * We are some (probably deeply nested) hub.145 * Thus, assign our own operations and explore already146 * connected devices.147 */148 296 dev->ops = &hub_device_ops; 149 297 150 //create the hub structure 151 //get hc connection 152 int hc = usb_drv_hc_connect_auto(dev, 0); 153 if (hc < 0) { 154 return hc; 155 } 156 157 usb_hub_info_t * hub_info = usb_create_hub_info(dev, hc); 298 usb_hub_info_t * hub_info = usb_create_hub_info(dev); 299 300 int opResult; 301 302 //perform final configurations 303 usb_endpoint_pipe_start_session(&hub_info->endpoints.control); 304 // process descriptors 305 opResult = usb_hub_process_configuration_descriptors(hub_info); 306 if(opResult != EOK){ 307 dprintf(USB_LOG_LEVEL_ERROR,"could not get condiguration descriptors, %d", 308 opResult); 309 return opResult; 310 } 311 //power ports 312 usb_device_request_setup_packet_t request; 158 313 int port; 159 int opResult;160 usb_target_t target;161 target.address = hub_info->address;162 target.endpoint = 0;163 164 //get configuration descriptor165 // this is not fully correct - there are more configurations166 // and all should be checked167 usb_standard_device_descriptor_t std_descriptor;168 opResult = usb_drv_req_get_device_descriptor(hc, target.address,169 &std_descriptor);170 if(opResult!=EOK){171 dprintf(USB_LOG_LEVEL_ERROR, "could not get device descriptor, %d",opResult);172 return opResult;173 }174 dprintf(USB_LOG_LEVEL_INFO, "hub has %d configurations",std_descriptor.configuration_count);175 if(std_descriptor.configuration_count<1){176 dprintf(USB_LOG_LEVEL_ERROR, "THERE ARE NO CONFIGURATIONS AVAILABLE");177 //shouldn`t I return?178 }179 /// \TODO check other configurations180 usb_standard_configuration_descriptor_t config_descriptor;181 opResult = usb_drv_req_get_bare_configuration_descriptor(hc,182 target.address, 0,183 &config_descriptor);184 if(opResult!=EOK){185 dprintf(USB_LOG_LEVEL_ERROR, "could not get configuration descriptor, %d",opResult);186 return opResult;187 }188 //set configuration189 opResult = usb_drv_req_set_configuration(hc, target.address,190 config_descriptor.configuration_number);191 192 if (opResult != EOK) {193 dprintf(USB_LOG_LEVEL_ERROR, "something went wrong when setting hub`s configuration, %d", opResult);194 }195 196 usb_device_request_setup_packet_t request;197 314 for (port = 1; port < hub_info->port_count+1; ++port) { 198 315 usb_hub_set_power_port_request(&request, port); 199 opResult = usb_drv_sync_control_write(hc, target, &request, NULL, 0); 316 opResult = usb_endpoint_pipe_control_write(&hub_info->endpoints.control, 317 &request,sizeof(usb_device_request_setup_packet_t), NULL, 0); 200 318 dprintf(USB_LOG_LEVEL_INFO, "powering port %d",port); 201 319 if (opResult != EOK) { … … 204 322 } 205 323 //ports powered, hub seems to be enabled 206 207 async_hangup(hc); 324 usb_endpoint_pipe_end_session(&hub_info->endpoints.control); 208 325 209 326 //add the hub to list … … 215 332 //(void)hub_info; 216 333 usb_hub_check_hub_changes(); 217 218 334 219 220 335 dprintf(USB_LOG_LEVEL_INFO, "hub dev added"); 336 //address is lost... 221 337 dprintf(USB_LOG_LEVEL_DEBUG, "\taddress %d, has %d ports ", 222 hub_info->address,338 //hub_info->endpoints.control., 223 339 hub_info->port_count); 224 dprintf(USB_LOG_LEVEL_DEBUG, "\tused configuration %d",config_descriptor.configuration_number);225 340 226 341 return EOK; … … 236 351 237 352 /** 238 * Convenience function for releasing default address and writing debug info239 * (these few lines are used too often to be written again and again).240 * @param hc241 * @return242 */243 inline static int usb_hub_release_default_address(int hc){244 int opResult;245 dprintf(USB_LOG_LEVEL_INFO, "releasing default address");246 opResult = usb_drv_release_default_address(hc);247 if (opResult != EOK) {248 dprintf(USB_LOG_LEVEL_WARNING, "failed to release default address");249 }250 return opResult;251 }252 253 /**254 353 * Reset the port with new device and reserve the default address. 255 354 * @param hc … … 257 356 * @param target 258 357 */ 259 static void usb_hub_init_add_device( int hc, uint16_t port, usb_target_t target) {358 static void usb_hub_init_add_device(usb_hub_info_t * hub, uint16_t port) { 260 359 usb_device_request_setup_packet_t request; 261 360 int opResult; 262 361 dprintf(USB_LOG_LEVEL_INFO, "some connection changed"); 362 assert(hub->endpoints.control.hc_phone); 263 363 //get default address 264 opResult = usb_drv_reserve_default_address(hc); 364 //opResult = usb_drv_reserve_default_address(hc); 365 opResult = usb_hc_reserve_default_address(&hub->connection, USB_SPEED_LOW); 366 265 367 if (opResult != EOK) { 266 368 dprintf(USB_LOG_LEVEL_WARNING, "cannot assign default address, it is probably used"); … … 269 371 //reset port 270 372 usb_hub_set_reset_port_request(&request, port); 271 opResult = usb_ drv_sync_control_write(272 hc, target,273 &request, 373 opResult = usb_endpoint_pipe_control_write( 374 &hub->endpoints.control, 375 &request,sizeof(usb_device_request_setup_packet_t), 274 376 NULL, 0 275 377 ); 276 378 if (opResult != EOK) { 277 379 dprintf(USB_LOG_LEVEL_ERROR, "something went wrong when reseting a port"); 278 usb_hub_release_default_address(hc); 380 //usb_hub_release_default_address(hc); 381 usb_hc_release_default_address(&hub->connection); 279 382 } 280 383 } … … 287 390 */ 288 391 static void usb_hub_finalize_add_device( usb_hub_info_t * hub, 289 int hc, uint16_t port, usb_target_t target) {392 uint16_t port) { 290 393 291 394 int opResult; 292 395 dprintf(USB_LOG_LEVEL_INFO, "finalizing add device"); 293 opResult = usb_hub_clear_port_feature( hc, target.address,396 opResult = usb_hub_clear_port_feature(&hub->endpoints.control, 294 397 port, USB_HUB_FEATURE_C_PORT_RESET); 398 295 399 if (opResult != EOK) { 296 400 dprintf(USB_LOG_LEVEL_ERROR, "failed to clear port reset feature"); 297 usb_hub_release_default_address(hc); 298 return; 299 } 300 301 /* Request address at from host controller. */ 302 usb_address_t new_device_address = usb_drv_request_address(hc); 401 usb_hc_release_default_address(&hub->connection); 402 return; 403 } 404 //create connection to device 405 usb_endpoint_pipe_t new_device_pipe; 406 usb_device_connection_t new_device_connection; 407 usb_device_connection_initialize_on_default_address( 408 &new_device_connection, 409 &hub->connection 410 ); 411 usb_endpoint_pipe_initialize_default_control( 412 &new_device_pipe, 413 &new_device_connection); 414 /// \TODO get highspeed info 415 416 417 418 419 420 /* Request address from host controller. */ 421 usb_address_t new_device_address = usb_hc_request_address( 422 &hub->connection, 423 USB_SPEED_LOW/// \TODO fullspeed?? 424 ); 303 425 if (new_device_address < 0) { 304 426 dprintf(USB_LOG_LEVEL_ERROR, "failed to get free USB address"); 305 427 opResult = new_device_address; 306 usb_h ub_release_default_address(hc);428 usb_hc_release_default_address(&hub->connection); 307 429 return; 308 430 } 309 431 dprintf(USB_LOG_LEVEL_INFO, "setting new address %d",new_device_address); 310 opResult = usb_drv_req_set_address(hc, USB_ADDRESS_DEFAULT, 311 new_device_address); 432 //opResult = usb_drv_req_set_address(hc, USB_ADDRESS_DEFAULT, 433 // new_device_address); 434 opResult = usb_request_set_address(&new_device_pipe,new_device_address); 312 435 313 436 if (opResult != EOK) { 314 437 dprintf(USB_LOG_LEVEL_ERROR, "could not set address for new device"); 315 usb_hub_release_default_address(hc); 316 return; 317 } 318 319 320 opResult = usb_hub_release_default_address(hc); 438 usb_hc_release_default_address(&hub->connection); 439 return; 440 } 441 442 443 //opResult = usb_hub_release_default_address(hc); 444 opResult = usb_hc_release_default_address(&hub->connection); 321 445 if(opResult!=EOK){ 322 446 return; 323 447 } 324 448 325 devman_handle_t hc_handle;326 opResult = usb_drv_find_hc(hub->device, &hc_handle);327 if (opResult != EOK) {328 usb_log_error("Failed to get handle of host controller: %s.\n",329 str_error(opResult));330 return;331 }332 333 449 devman_handle_t child_handle; 334 opResult = usb_device_register_child_in_devman(new_device_address, 335 hc_handle, hub->device, &child_handle); 450 //?? 451 opResult = usb_device_register_child_in_devman(new_device_address, 452 hub->connection.hc_handle, hub->device, &child_handle); 453 336 454 if (opResult != EOK) { 337 455 dprintf(USB_LOG_LEVEL_ERROR, "could not start driver for new device"); 338 456 return; 339 457 } 340 hub->attached_devs[port]. devman_handle = child_handle;458 hub->attached_devs[port].handle = child_handle; 341 459 hub->attached_devs[port].address = new_device_address; 342 460 343 opResult = usb_drv_bind_address(hc, new_device_address, child_handle); 461 //opResult = usb_drv_bind_address(hc, new_device_address, child_handle); 462 opResult = usb_hc_register_device( 463 &hub->connection, 464 &hub->attached_devs[port]); 344 465 if (opResult != EOK) { 345 466 dprintf(USB_LOG_LEVEL_ERROR, "could not assign address of device in hcd"); … … 358 479 */ 359 480 static void usb_hub_removed_device( 360 usb_hub_info_t * hub, int hc, uint16_t port, usb_target_t target) {481 usb_hub_info_t * hub,uint16_t port) { 361 482 //usb_device_request_setup_packet_t request; 362 483 int opResult; … … 365 486 * devide manager 366 487 */ 367 368 hub->attached_devs[port].devman_handle=0; 488 369 489 //close address 370 490 if(hub->attached_devs[port].address!=0){ 371 opResult = usb_drv_release_address(hc,hub->attached_devs[port].address); 491 //opResult = usb_drv_release_address(hc,hub->attached_devs[port].address); 492 opResult = usb_hc_unregister_device( 493 &hub->connection, hub->attached_devs[port].address); 372 494 if(opResult != EOK) { 373 495 dprintf(USB_LOG_LEVEL_WARNING, "could not release address of " \ … … 375 497 } 376 498 hub->attached_devs[port].address = 0; 499 hub->attached_devs[port].handle = 0; 377 500 }else{ 378 501 dprintf(USB_LOG_LEVEL_WARNING, "this is strange, disconnected device had no address"); 379 502 //device was disconnected before it`s port was reset - return default address 380 usb_drv_release_default_address(hc); 503 //usb_drv_release_default_address(hc); 504 usb_hc_release_default_address(&hub->connection); 381 505 } 382 506 } … … 388 512 * @param target 389 513 */ 390 static void usb_hub_process_interrupt(usb_hub_info_t * hub, int hc,391 uint16_t port , usb_address_t address) {514 static void usb_hub_process_interrupt(usb_hub_info_t * hub, 515 uint16_t port) { 392 516 dprintf(USB_LOG_LEVEL_DEBUG, "interrupt at port %d", port); 393 517 //determine type of change 518 usb_endpoint_pipe_t *pipe = &hub->endpoints.control; 519 int opResult = usb_endpoint_pipe_start_session(pipe); 520 521 if(opResult != EOK){ 522 dprintf(USB_LOG_LEVEL_ERROR, "cannot open pipe %d", opResult); 523 } 524 525 /* 394 526 usb_target_t target; 395 527 target.address=address; 396 528 target.endpoint=0; 529 */ 530 397 531 usb_port_status_t status; 398 532 size_t rcvd_size; 399 533 usb_device_request_setup_packet_t request; 400 int opResult;534 //int opResult; 401 535 usb_hub_set_port_status_request(&request, port); 402 536 //endpoint 0 403 537 404 opResult = usb_ drv_sync_control_read(405 hc, target,406 &request, 538 opResult = usb_endpoint_pipe_control_read( 539 pipe, 540 &request, sizeof(usb_device_request_setup_packet_t), 407 541 &status, 4, &rcvd_size 408 542 ); … … 417 551 //something connected/disconnected 418 552 if (usb_port_connect_change(&status)) { 419 opResult = usb_hub_clear_port_feature( hc, target.address,553 opResult = usb_hub_clear_port_feature(pipe, 420 554 port, USB_HUB_FEATURE_C_PORT_CONNECTION); 421 555 // TODO: check opResult 422 556 if (usb_port_dev_connected(&status)) { 423 557 dprintf(USB_LOG_LEVEL_INFO, "some connection changed"); 424 usb_hub_init_add_device(h c, port, target);558 usb_hub_init_add_device(hub, port); 425 559 } else { 426 usb_hub_removed_device(hub, hc, port, target);560 usb_hub_removed_device(hub, port); 427 561 } 428 562 } … … 431 565 dprintf(USB_LOG_LEVEL_INFO, "port reset complete"); 432 566 if (usb_port_enabled(&status)) { 433 usb_hub_finalize_add_device(hub, hc, port, target);567 usb_hub_finalize_add_device(hub, port); 434 568 } else { 435 569 dprintf(USB_LOG_LEVEL_WARNING, "ERROR: port reset, but port still not enabled"); … … 447 581 /// \TODO handle other changes 448 582 /// \TODO debug log for various situations 583 usb_endpoint_pipe_end_session(pipe); 584 449 585 450 586 } … … 464 600 fibril_mutex_unlock(&usb_hub_list_lock); 465 601 usb_hub_info_t * hub_info = ((usb_hub_info_t*)lst_item->data); 602 int opResult; 603 604 opResult = usb_endpoint_pipe_start_session(&hub_info->endpoints.status_change); 605 if(opResult != EOK){ 606 continue; 607 } 466 608 /* 467 609 * Check status change pipe of this hub. 468 610 */ 469 611 /* 470 612 usb_target_t target; 471 613 target.address = hub_info->address; … … 473 615 dprintf(USB_LOG_LEVEL_INFO, "checking changes for hub at addr %d", 474 616 target.address); 475 617 */ 476 618 size_t port_count = hub_info->port_count; 477 619 478 620 /* 479 621 * Connect to respective HC. 480 * /622 * 481 623 int hc = usb_drv_hc_connect_auto(hub_info->device, 0); 482 624 if (hc < 0) { 483 625 continue; 484 } 626 }*/ 485 627 486 628 /// FIXME: count properly … … 489 631 void *change_bitmap = malloc(byte_length); 490 632 size_t actual_size; 491 usb_handle_t handle;633 //usb_handle_t handle; 492 634 493 635 /* 494 636 * Send the request. 495 637 */ 496 int opResult = usb_drv_async_interrupt_in(hc, target, 497 change_bitmap, byte_length, &actual_size, 498 &handle); 499 500 usb_drv_async_wait_for(handle); 638 opResult = usb_endpoint_pipe_read( 639 &hub_info->endpoints.status_change, 640 change_bitmap, byte_length, &actual_size 641 ); 642 643 //usb_drv_async_wait_for(handle); 501 644 502 645 if (opResult != EOK) { … … 511 654 if (interrupt) { 512 655 usb_hub_process_interrupt( 513 hub_info, hc, port, hub_info->address);656 hub_info, port); 514 657 } 515 658 } 659 usb_endpoint_pipe_end_session(&hub_info->endpoints.status_change); 516 660 free(change_bitmap); 517 518 async_hangup(hc); 661 662 663 //async_hangup(hc); 519 664 fibril_mutex_lock(&usb_hub_list_lock); 520 665 }
Note:
See TracChangeset
for help on using the changeset viewer.