Changes in / [6c6a95d2:3b543d5] in mainline
- Location:
- uspace/drv
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/ohci/root_hub.c
r6c6a95d2 r3b543d5 108 108 109 109 static const uint32_t hub_clear_feature_valid_mask = 110 110 (1 << USB_HUB_FEATURE_C_HUB_LOCAL_POWER) | 111 111 (1 << USB_HUB_FEATURE_C_HUB_OVER_CURRENT); 112 112 113 113 static const uint32_t hub_clear_feature_by_writing_one_mask = 114 114 1 << USB_HUB_FEATURE_C_HUB_LOCAL_POWER; 115 115 116 116 static const uint32_t hub_set_feature_valid_mask = 117 117 (1 << USB_HUB_FEATURE_C_HUB_OVER_CURRENT) | 118 118 (1 << USB_HUB_FEATURE_C_HUB_LOCAL_POWER); 119 119 120 120 121 121 static const uint32_t hub_set_feature_direct_mask = 122 122 (1 << USB_HUB_FEATURE_C_HUB_OVER_CURRENT); 123 123 124 124 static const uint32_t port_set_feature_valid_mask = 125 125 (1 << USB_HUB_FEATURE_PORT_ENABLE) | 126 126 (1 << USB_HUB_FEATURE_PORT_SUSPEND) | 127 127 (1 << USB_HUB_FEATURE_PORT_RESET) | … … 129 129 130 130 static const uint32_t port_clear_feature_valid_mask = 131 131 (1 << USB_HUB_FEATURE_PORT_CONNECTION) | 132 132 (1 << USB_HUB_FEATURE_PORT_SUSPEND) | 133 133 (1 << USB_HUB_FEATURE_PORT_OVER_CURRENT) | … … 142 142 143 143 static const uint32_t port_status_change_mask = 144 (1<< USB_HUB_FEATURE_C_PORT_CONNECTION) |145 (1 << USB_HUB_FEATURE_C_PORT_ENABLE) |146 (1 << USB_HUB_FEATURE_C_PORT_OVER_CURRENT) |147 (1 << USB_HUB_FEATURE_C_PORT_RESET) |148 (1 << USB_HUB_FEATURE_C_PORT_SUSPEND);144 (1 << USB_HUB_FEATURE_C_PORT_CONNECTION) | 145 (1 << USB_HUB_FEATURE_C_PORT_ENABLE) | 146 (1 << USB_HUB_FEATURE_C_PORT_OVER_CURRENT) | 147 (1 << USB_HUB_FEATURE_C_PORT_RESET) | 148 (1 << USB_HUB_FEATURE_C_PORT_SUSPEND); 149 149 150 150 … … 153 153 static int rh_init_descriptors(rh_t *instance); 154 154 155 static void rh_check_port_connectivity(rh_t * instance); 156 155 157 static int process_get_port_status_request(rh_t *instance, uint16_t port, 156 158 usb_transfer_batch_t * request); 157 159 158 160 static int process_get_hub_status_request(rh_t *instance, 159 161 usb_transfer_batch_t * request); 160 162 161 163 static int process_get_status_request(rh_t *instance, 162 164 usb_transfer_batch_t * request); 163 165 164 166 static void create_interrupt_mask_in_instance(rh_t *instance); 165 167 166 168 static int process_get_descriptor_request(rh_t *instance, 167 169 usb_transfer_batch_t *request); 168 170 169 171 static int process_get_configuration_request(rh_t *instance, 170 172 usb_transfer_batch_t *request); 171 173 172 174 static int process_hub_feature_set_request(rh_t *instance, uint16_t feature); 173 175 174 176 static int process_hub_feature_clear_request(rh_t *instance, 175 177 uint16_t feature); 176 178 177 179 static int process_port_feature_set_request(rh_t *instance, 178 180 uint16_t feature, uint16_t port); 179 181 180 182 static int process_port_feature_clear_request(rh_t *instance, 181 183 uint16_t feature, uint16_t port); 182 184 183 185 static int process_address_set_request(rh_t *instance, 184 186 uint16_t address); 185 187 186 188 static int process_request_with_output(rh_t *instance, 187 189 usb_transfer_batch_t *request); 188 190 189 191 static int process_request_with_input(rh_t *instance, 190 192 usb_transfer_batch_t *request); 191 193 192 194 static int process_request_without_data(rh_t *instance, 193 195 usb_transfer_batch_t *request); 194 196 195 197 static int process_ctrl_request(rh_t *instance, usb_transfer_batch_t *request); … … 198 200 199 201 static bool is_zeros(void * buffer, size_t size); 200 201 202 202 203 203 /** Root hub initialization … … 210 210 (instance->registers->rh_desc_a >> RHDA_NDS_SHIFT) & RHDA_NDS_MASK; 211 211 int opResult = rh_init_descriptors(instance); 212 if (opResult != EOK){212 if (opResult != EOK) { 213 213 return opResult; 214 214 } … … 216 216 instance->registers->rh_desc_a |= RHDA_NPS_FLAG; 217 217 instance->unfinished_interrupt_transfer = NULL; 218 instance->interrupt_mask_size = (instance->port_count + 8) /8;218 instance->interrupt_mask_size = (instance->port_count + 8) / 8; 219 219 instance->interrupt_buffer = malloc(instance->interrupt_mask_size); 220 if (!instance->interrupt_buffer)220 if (!instance->interrupt_buffer) 221 221 return ENOMEM; 222 222 rh_check_port_connectivity(instance); 223 223 224 224 225 usb_log_info("OHCI root hub with %d ports.\n", instance->port_count); 226 225 227 return EOK; 226 228 } … … 245 247 usb_log_info("Root hub got INTERRUPT packet\n"); 246 248 create_interrupt_mask_in_instance(instance); 247 if (is_zeros(instance->interrupt_buffer,248 instance->interrupt_mask_size)) {249 if (is_zeros(instance->interrupt_buffer, 250 instance->interrupt_mask_size)) { 249 251 usb_log_debug("no changes..\n"); 250 252 instance->unfinished_interrupt_transfer = request; 251 253 //will be finished later 252 } else{254 } else { 253 255 usb_log_debug("processing changes..\n"); 254 256 process_interrupt_mask_in_instance(instance, request); … … 256 258 opResult = EOK; 257 259 } else { 260 258 261 opResult = EINVAL; 259 262 usb_transfer_batch_finish_error(request, opResult); … … 271 274 */ 272 275 void rh_interrupt(rh_t *instance) { 273 if(!instance->unfinished_interrupt_transfer){ 276 if (!instance->unfinished_interrupt_transfer) { 277 274 278 return; 275 279 } … … 292 296 static int create_serialized_hub_descriptor(rh_t *instance) { 293 297 size_t size = 7 + 294 ((instance->port_count + 7 )/ 8) * 2;295 size_t var_size = (instance->port_count + 7 )/ 8;298 ((instance->port_count + 7) / 8) * 2; 299 size_t var_size = (instance->port_count + 7) / 8; 296 300 uint8_t * result = (uint8_t*) malloc(size); 297 if (!result) return ENOMEM;301 if (!result) return ENOMEM; 298 302 299 303 bzero(result, size); … … 305 309 uint32_t hub_desc_reg = instance->registers->rh_desc_a; 306 310 result[3] = 307 308 309 310 311 311 ((hub_desc_reg >> 8) % 2) + 312 (((hub_desc_reg >> 9) % 2) << 1) + 313 (((hub_desc_reg >> 10) % 2) << 2) + 314 (((hub_desc_reg >> 11) % 2) << 3) + 315 (((hub_desc_reg >> 12) % 2) << 4); 312 316 result[4] = 0; 313 317 result[5] = /*descriptor->pwr_on_2_good_time*/ 50; 314 318 result[6] = 50; 315 319 316 int port;320 size_t port; 317 321 for (port = 1; port <= instance->port_count; ++port) { 318 322 uint8_t is_non_removable = 319 323 instance->registers->rh_desc_b >> port % 2; 320 324 result[7 + port / 8] += 321 325 is_non_removable << (port % 8); 322 326 } 323 327 size_t i; … … 327 331 instance->hub_descriptor = result; 328 332 instance->descriptor_size = size; 333 329 334 return EOK; 330 335 } … … 340 345 static int rh_init_descriptors(rh_t *instance) { 341 346 memcpy(&instance->descriptors.device, &ohci_rh_device_descriptor, 342 343 347 sizeof (ohci_rh_device_descriptor) 348 ); 344 349 usb_standard_configuration_descriptor_t descriptor; 345 350 memcpy(&descriptor, &ohci_rh_conf_descriptor, 346 351 sizeof (ohci_rh_conf_descriptor)); 347 352 348 353 int opResult = create_serialized_hub_descriptor(instance); 349 if (opResult != EOK){354 if (opResult != EOK) { 350 355 return opResult; 351 356 } 352 357 descriptor.total_length = 353 354 355 356 358 sizeof (usb_standard_configuration_descriptor_t) + 359 sizeof (usb_standard_endpoint_descriptor_t) + 360 sizeof (usb_standard_interface_descriptor_t) + 361 instance->descriptor_size; 357 362 358 363 uint8_t * full_config_descriptor = 359 360 if (!full_config_descriptor){364 (uint8_t*) malloc(descriptor.total_length); 365 if (!full_config_descriptor) { 361 366 return ENOMEM; 362 367 } 363 368 memcpy(full_config_descriptor, &descriptor, sizeof (descriptor)); 364 369 memcpy(full_config_descriptor + sizeof (descriptor), 365 370 &ohci_rh_iface_descriptor, sizeof (ohci_rh_iface_descriptor)); 366 371 memcpy(full_config_descriptor + sizeof (descriptor) + 367 368 372 sizeof (ohci_rh_iface_descriptor), 373 &ohci_rh_ep_descriptor, sizeof (ohci_rh_ep_descriptor)); 369 374 memcpy(full_config_descriptor + sizeof (descriptor) + 370 371 372 373 375 sizeof (ohci_rh_iface_descriptor) + 376 sizeof (ohci_rh_ep_descriptor), 377 instance->hub_descriptor, instance->descriptor_size); 378 374 379 instance->descriptors.configuration = full_config_descriptor; 375 380 instance->descriptors.configuration_size = descriptor.total_length; 376 return EOK; 377 } 381 382 return EOK; 383 } 384 /*----------------------------------------------------------------------------*/ 385 386 /** 387 * check whether there are connected devices on ports and if yes, indicate 388 * connection change 389 * 390 * @param instance 391 */ 392 static void rh_check_port_connectivity(rh_t * instance) { 393 size_t port; 394 for (port = 1; port < instance->port_count; ++port) { 395 bool connected = 396 ((instance->registers->rh_port_status[port - 1]) & 397 (1 << USB_HUB_FEATURE_PORT_CONNECTION)) != 0; 398 if (connected) { 399 usb_log_debug("port %d has connected device\n", port); 400 instance->registers->rh_port_status[port - 1] = 401 instance->registers->rh_port_status[port - 1] 402 | (1 << USB_HUB_FEATURE_C_PORT_CONNECTION); 403 usb_log_debug("change indicated to status " 404 "register\n"); 405 } 406 } 407 } 408 409 378 410 /*----------------------------------------------------------------------------*/ 379 411 … … 389 421 */ 390 422 static int process_get_port_status_request(rh_t *instance, uint16_t port, 391 423 usb_transfer_batch_t * request) { 392 424 if (port < 1 || port > instance->port_count) 393 425 return EINVAL; … … 398 430 int i; 399 431 for (i = 0; i < instance->port_count; ++i) { 432 400 433 usb_log_debug("port status %d,x%x\n", 401 402 434 instance->registers->rh_port_status[i], 435 instance->registers->rh_port_status[i]); 403 436 } 404 437 #endif … … 417 450 */ 418 451 static int process_get_hub_status_request(rh_t *instance, 419 452 usb_transfer_batch_t * request) { 420 453 uint32_t * uint32_buffer = (uint32_t*) request->data_buffer; 421 454 request->transfered_size = 4; … … 423 456 uint32_t mask = 1 | (1 << 1) | (1 << 16) | (1 << 17); 424 457 uint32_buffer[0] = mask & instance->registers->rh_status; 458 425 459 return EOK; 426 460 } … … 437 471 */ 438 472 static int process_get_status_request(rh_t *instance, 439 473 usb_transfer_batch_t * request) { 440 474 size_t buffer_size = request->buffer_size; 441 475 usb_device_request_setup_packet_t * request_packet = 442 443 476 (usb_device_request_setup_packet_t*) 477 request->setup_buffer; 444 478 445 479 usb_hub_bm_request_type_t request_type = request_packet->request_type; … … 453 487 if (request_type == USB_HUB_REQ_TYPE_GET_PORT_STATUS) 454 488 return process_get_port_status_request(instance, 455 request_packet->index, 456 request); 489 request_packet->index, 490 request); 491 457 492 return ENOTSUP; 458 493 } … … 472 507 uint8_t * bitmap = (uint8_t*) (instance->interrupt_buffer); 473 508 uint32_t mask = (1 << (USB_HUB_FEATURE_C_HUB_LOCAL_POWER + 16)) 474 509 | (1 << (USB_HUB_FEATURE_C_HUB_OVER_CURRENT + 16)); 475 510 bzero(bitmap, instance->interrupt_mask_size); 476 511 if (instance->registers->rh_status & mask) { 477 512 bitmap[0] = 1; 478 513 } 479 int port;514 size_t port; 480 515 mask = port_status_change_mask; 481 516 for (port = 1; port <= instance->port_count; ++port) { 482 517 if (mask & instance->registers->rh_port_status[port - 1]) { 518 483 519 bitmap[(port) / 8] += 1 << (port % 8); 484 520 } … … 497 533 */ 498 534 static int process_get_descriptor_request(rh_t *instance, 499 535 usb_transfer_batch_t *request) { 500 536 usb_device_request_setup_packet_t * setup_request = 501 537 (usb_device_request_setup_packet_t*) request->setup_buffer; 502 538 size_t size; 503 539 const void * result_descriptor = NULL; … … 543 579 { 544 580 usb_log_debug("USB_DESCTYPE_EINVAL %d \n", 545 581 setup_request->value); 546 582 usb_log_debug("\ttype %d\n\trequest %d\n\tvalue " 547 548 549 550 551 552 553 583 "%d\n\tindex %d\n\tlen %d\n ", 584 setup_request->request_type, 585 setup_request->request, 586 setup_request_value, 587 setup_request->index, 588 setup_request->length 589 ); 554 590 return EINVAL; 555 591 } … … 560 596 request->transfered_size = size; 561 597 memcpy(request->data_buffer, result_descriptor, size); 598 562 599 return EOK; 563 600 } … … 573 610 */ 574 611 static int process_get_configuration_request(rh_t *instance, 575 612 usb_transfer_batch_t *request) { 576 613 //set and get configuration requests do not have any meaning, only dummy 577 614 //values are returned … … 580 617 request->data_buffer[0] = 1; 581 618 request->transfered_size = 1; 619 582 620 return EOK; 583 621 } … … 592 630 */ 593 631 static int process_hub_feature_set_request(rh_t *instance, 594 632 uint16_t feature) { 595 633 if (!((1 << feature) & hub_set_feature_valid_mask)) 596 634 return EINVAL; 597 if (feature == USB_HUB_FEATURE_C_HUB_LOCAL_POWER)635 if (feature == USB_HUB_FEATURE_C_HUB_LOCAL_POWER) 598 636 feature = USB_HUB_FEATURE_C_HUB_LOCAL_POWER << 16; 599 637 instance->registers->rh_status = 600 (instance->registers->rh_status | (1 << feature)) 601 & (~hub_clear_feature_by_writing_one_mask); 638 (instance->registers->rh_status | (1 << feature)) 639 & (~hub_clear_feature_by_writing_one_mask); 640 602 641 return EOK; 603 642 } … … 612 651 */ 613 652 static int process_hub_feature_clear_request(rh_t *instance, 614 653 uint16_t feature) { 615 654 if (!((1 << feature) & hub_clear_feature_valid_mask)) 616 655 return EINVAL; … … 618 657 if ((1 << feature) & hub_set_feature_direct_mask) { 619 658 instance->registers->rh_status = 620 621 659 (instance->registers->rh_status & (~(1 << feature))) 660 & (~hub_clear_feature_by_writing_one_mask); 622 661 } else {//the feature is cleared by writing '1' 662 623 663 instance->registers->rh_status = 624 625 626 664 (instance->registers->rh_status 665 & (~hub_clear_feature_by_writing_one_mask)) 666 | (1 << feature); 627 667 } 628 668 return EOK; … … 640 680 */ 641 681 static int process_port_feature_set_request(rh_t *instance, 642 682 uint16_t feature, uint16_t port) { 643 683 if (!((1 << feature) & port_set_feature_valid_mask)) 644 684 return EINVAL; … … 646 686 return EINVAL; 647 687 instance->registers->rh_port_status[port - 1] = 648 649 688 (instance->registers->rh_port_status[port - 1] | (1 << feature)) 689 & (~port_clear_feature_valid_mask); 650 690 /// \TODO any error? 691 651 692 return EOK; 652 693 } … … 663 704 */ 664 705 static int process_port_feature_clear_request(rh_t *instance, 665 706 uint16_t feature, uint16_t port) { 666 707 if (!((1 << feature) & port_clear_feature_valid_mask)) 667 708 return EINVAL; … … 673 714 feature = USB_HUB_FEATURE_PORT_OVER_CURRENT; 674 715 instance->registers->rh_port_status[port - 1] = 675 676 677 716 (instance->registers->rh_port_status[port - 1] 717 & (~port_clear_feature_valid_mask)) 718 | (1 << feature); 678 719 /// \TODO any error? 720 679 721 return EOK; 680 722 } … … 689 731 */ 690 732 static int process_address_set_request(rh_t *instance, 691 733 uint16_t address) { 692 734 instance->address = address; 735 693 736 return EOK; 694 737 } … … 705 748 */ 706 749 static int process_request_with_output(rh_t *instance, 707 750 usb_transfer_batch_t *request) { 708 751 usb_device_request_setup_packet_t * setup_request = 709 752 (usb_device_request_setup_packet_t*) request->setup_buffer; 710 753 if (setup_request->request == USB_DEVREQ_GET_STATUS) { 711 754 usb_log_debug("USB_DEVREQ_GET_STATUS\n"); … … 718 761 if (setup_request->request == USB_DEVREQ_GET_CONFIGURATION) { 719 762 usb_log_debug("USB_DEVREQ_GET_CONFIGURATION\n"); 763 720 764 return process_get_configuration_request(instance, request); 721 765 } … … 734 778 */ 735 779 static int process_request_with_input(rh_t *instance, 736 780 usb_transfer_batch_t *request) { 737 781 usb_device_request_setup_packet_t * setup_request = 738 782 (usb_device_request_setup_packet_t*) request->setup_buffer; 739 783 request->transfered_size = 0; 740 784 if (setup_request->request == USB_DEVREQ_SET_DESCRIPTOR) { … … 744 788 //set and get configuration requests do not have any meaning, 745 789 //only dummy values are returned 790 746 791 return EOK; 747 792 } … … 760 805 */ 761 806 static int process_request_without_data(rh_t *instance, 762 807 usb_transfer_batch_t *request) { 763 808 usb_device_request_setup_packet_t * setup_request = 764 809 (usb_device_request_setup_packet_t*) request->setup_buffer; 765 810 request->transfered_size = 0; 766 811 if (setup_request->request == USB_DEVREQ_CLEAR_FEATURE) { … … 768 813 usb_log_debug("USB_HUB_REQ_TYPE_SET_HUB_FEATURE\n"); 769 814 return process_hub_feature_clear_request(instance, 770 815 setup_request->value); 771 816 } 772 817 if (setup_request->request_type == USB_HUB_REQ_TYPE_SET_PORT_FEATURE) { 773 818 usb_log_debug("USB_HUB_REQ_TYPE_SET_PORT_FEATURE\n"); 774 819 return process_port_feature_clear_request(instance, 775 776 820 setup_request->value, 821 setup_request->index); 777 822 } 778 823 usb_log_debug("USB_HUB_REQ_TYPE_INVALID %d\n", 779 824 setup_request->request_type); 780 825 return EINVAL; 781 826 } … … 784 829 usb_log_debug("USB_HUB_REQ_TYPE_SET_HUB_FEATURE\n"); 785 830 return process_hub_feature_set_request(instance, 786 831 setup_request->value); 787 832 } 788 833 if (setup_request->request_type == USB_HUB_REQ_TYPE_SET_PORT_FEATURE) { 789 834 usb_log_debug("USB_HUB_REQ_TYPE_SET_PORT_FEATURE\n"); 790 835 return process_port_feature_set_request(instance, 791 792 836 setup_request->value, 837 setup_request->index); 793 838 } 794 839 usb_log_debug("USB_HUB_REQ_TYPE_INVALID %d\n", 795 840 setup_request->request_type); 796 841 return EINVAL; 797 842 } … … 799 844 usb_log_debug("USB_DEVREQ_SET_ADDRESS\n"); 800 845 return process_address_set_request(instance, 801 846 setup_request->value); 802 847 } 803 848 usb_log_debug("USB_DEVREQ_SET_ENOTSUP %d\n", 804 setup_request->request_type); 849 setup_request->request_type); 850 805 851 return ENOTSUP; 806 852 } … … 836 882 } 837 883 usb_log_info("CTRL packet: %s.\n", 838 839 884 usb_debug_str_buffer( 885 (const uint8_t *) request->setup_buffer, 8, 8)); 840 886 usb_device_request_setup_packet_t * setup_request = 841 842 887 (usb_device_request_setup_packet_t*) 888 request->setup_buffer; 843 889 switch (setup_request->request) { 844 890 case USB_DEVREQ_GET_STATUS: … … 847 893 usb_log_debug("processing request with output\n"); 848 894 opResult = process_request_with_output( 849 895 instance, request); 850 896 break; 851 897 case USB_DEVREQ_CLEAR_FEATURE: … … 853 899 case USB_DEVREQ_SET_ADDRESS: 854 900 usb_log_debug("processing request without " 855 901 "additional data\n"); 856 902 opResult = process_request_without_data( 857 903 instance, request); 858 904 break; 859 905 case USB_DEVREQ_SET_DESCRIPTOR: 860 906 case USB_DEVREQ_SET_CONFIGURATION: 861 907 usb_log_debug("processing request with " 862 908 "input\n"); 863 909 opResult = process_request_with_input( 864 instance, request); 910 instance, request); 911 865 912 break; 866 913 default: 867 914 usb_log_warning("received unsuported request: " 868 869 870 915 "%d\n", 916 setup_request->request 917 ); 871 918 opResult = ENOTSUP; 872 919 } … … 888 935 * @return 889 936 */ 890 static int process_interrupt_mask_in_instance(rh_t *instance, usb_transfer_batch_t * request) {937 static int process_interrupt_mask_in_instance(rh_t *instance, usb_transfer_batch_t * request) { 891 938 memcpy(request->data_buffer, instance->interrupt_buffer, 892 939 instance->interrupt_mask_size); … … 894 941 instance->unfinished_interrupt_transfer = NULL; 895 942 usb_transfer_batch_finish_error(request, EOK); 943 896 944 return EOK; 897 945 } … … 907 955 * @return 908 956 */ 909 static bool is_zeros(void * buffer, size_t size) {910 if (!buffer) return true;911 if (!size) return true;957 static bool is_zeros(void * buffer, size_t size) { 958 if (!buffer) return true; 959 if (!size) return true; 912 960 size_t i; 913 for (i=0;i<size;++i){914 if (((char*)buffer)[i])961 for (i = 0; i < size; ++i) { 962 if (((char*) buffer)[i]) 915 963 return false; 916 964 } -
uspace/drv/ohci/root_hub.h
r6c6a95d2 r3b543d5 51 51 usb_address_t address; 52 52 /** hub port count */ 53 int port_count;53 size_t port_count; 54 54 /** hubs descriptors */ 55 55 usb_device_descriptors_t descriptors; -
uspace/drv/usbhid/main.c
r6c6a95d2 r3b543d5 202 202 printf(NAME ": HelenOS USB HID driver.\n"); 203 203 204 usb_log_enable(USB_LOG_LEVEL_DEBUG, NAME);204 //usb_log_enable(USB_LOG_LEVEL_DEBUG, NAME); 205 205 206 206 return usb_driver_main(&usb_hid_driver); -
uspace/drv/usbhub/ports.c
r6c6a95d2 r3b543d5 137 137 &status, USB_HUB_FEATURE_C_PORT_OVER_CURRENT,false); 138 138 /// \TODO what about port power change? 139 unsigned int bit_idx; 140 for(bit_idx = 16;bit_idx<32;++bit_idx){ 141 if(status & (1<<bit_idx)){ 142 usb_log_info( 143 "there was unsupported change on port %d: %d\n", 144 port, bit_idx); 145 int opResult = usb_hub_clear_port_feature( 146 hub->control_pipe, 147 port, USB_HUB_FEATURE_C_PORT_CONNECTION); 148 if (opResult != EOK) { 149 usb_log_warning( 150 "could not clear port flag %d: %d\n", 151 bit_idx, opResult 152 ); 153 } 154 usb_port_status_set_bit( 155 &status, bit_idx,false); 156 } 157 } 139 158 if (status >> 16) { 140 159 usb_log_info("there was unsupported change on port %d: %X\n", 141 160 port, status); 142 143 161 } 144 162 } … … 222 240 "Port %zu reset complete but port not enabled.\n", 223 241 (size_t) port); 242 } 243 /* Clear the port reset change. */ 244 int rc = usb_hub_clear_port_feature(hub->control_pipe, 245 port, USB_HUB_FEATURE_C_PORT_RESET); 246 if (rc != EOK) { 247 usb_log_error("Failed to clear port %d reset feature: %s.\n", 248 port, str_error(rc)); 224 249 } 225 250 } … … 319 344 fibril_mutex_unlock(&my_port->reset_mutex); 320 345 321 /* Clear the port reset change. */322 rc = usb_hub_clear_port_feature(hub->control_pipe,323 port_no, USB_HUB_FEATURE_C_PORT_RESET);324 if (rc != EOK) {325 usb_log_error("Failed to clear port %d reset feature: %s.\n",326 port_no, str_error(rc));327 return rc;328 }329 330 346 if (my_port->reset_okay) { 331 347 return EOK;
Note:
See TracChangeset
for help on using the changeset viewer.