Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 647492b in mainline


Ignore:
Timestamp:
2010-12-12T22:12:37Z (11 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master
Children:
1b29d6fa
Parents:
61efb7f
Message:

Fix wrong SET_ADDRESS in hub driver

Also, polling interval resetted back to 10ms.

Location:
uspace/drv/usbhub
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/usbhub/main.c

    r61efb7f r647492b  
    5050        while(true){
    5151                usb_hub_check_hub_changes();
    52                 async_usleep(10000000);
     52                async_usleep(100 * 1000);
    5353        }
    5454        return 0;
  • uspace/drv/usbhub/utils.c

    r61efb7f r647492b  
    506506                int hc, uint16_t port, usb_target_t target) {
    507507
    508         usb_device_request_setup_packet_t request;
    509508        int opResult;
    510509        printf("[usb_hub] finalizing add device\n");
    511         usb_address_t new_device_address =
    512                         usb_drv_request_address(hc);
    513         usb_hub_set_set_address_request
    514                         (&request, new_device_address);
    515         opResult = usb_drv_sync_control_write(
    516                         hc, target,
    517                         &request,
    518                         NULL, 0
    519                         );
     510
     511        /* Request address at from host controller. */
     512        usb_address_t new_device_address = usb_drv_request_address(hc);
     513        if (new_device_address < 0) {
     514                printf("[usb_hub] failed to get free USB address\n");
     515                opResult = new_device_address;
     516                goto release;
     517        }
     518        printf("[usb_hub] setting new address\n");
     519        opResult = usb_drv_req_set_address(hc, USB_ADDRESS_DEFAULT,
     520            new_device_address);
     521
    520522        if (opResult != EOK) {
    521523                printf("[usb_hub] could not set address for new device\n");
    522                 //will retry later...
    523                 return;
    524         }
    525 
     524                goto release;
     525        }
     526
     527release:
     528        printf("[usb_hub] releasing default address\n");
    526529        usb_drv_release_default_address(hc);
     530        if (opResult != EOK) {
     531                return;
     532        }
    527533
    528534        devman_handle_t child_handle;
    529535        opResult = usb_drv_register_child_in_devman(hc, hub->device,
    530         new_device_address, &child_handle);
     536            new_device_address, &child_handle);
    531537        if (opResult != EOK) {
    532538                printf("[usb_hub] could not start driver for new device \n");
     
    543549        printf("[usb_hub] new device address %d, handle %d\n",
    544550            new_device_address, child_handle);
    545         sleep(60);
    546551       
    547552}
     
    629634        //port reset
    630635        if (usb_port_reset_completed(&status)) {
    631                 printf("[usb_hub] finalizing add device\n");
     636                printf("[usb_hub] port reset complete\n");
    632637                if (usb_port_enabled(&status)) {
    633638                        usb_hub_finalize_add_device(hub, hc, port, target);
Note: See TracChangeset for help on using the changeset viewer.