Changeset 3538b0e in mainline for uspace/lib/usbdev/src/hub.c


Ignore:
Timestamp:
2011-12-12T13:28:51Z (12 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
30ec5ea
Parents:
c804484
Message:

libusbdev: Cleanup.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/usbdev/src/hub.c

    rc804484 r3538b0e  
    230230        /* Initialize connection to device. */
    231231        usb_device_connection_t dev_conn;
    232         rc = usb_device_connection_initialize_on_default_address(
    233             &dev_conn, hc_conn);
     232        rc = usb_device_connection_initialize(
     233            &dev_conn, hc_conn, USB_ADDRESS_DEFAULT);
    234234        if (rc != EOK) {
    235235                rc = ENOTCONN;
     
    237237        }
    238238
     239        /* Initialize control pipe on default address. Don't register yet. */
     240        usb_pipe_t ctrl_pipe;
     241        rc = usb_pipe_initialize_default_control(&ctrl_pipe, &dev_conn);
     242        if (rc != EOK) {
     243                rc = ENOTCONN;
     244                goto leave_release_free_address;
     245        }
     246
    239247        /*
    240          * We will not register control pipe on default address.
    241          * The registration might fail. That means that someone else already
    242          * registered that endpoint. We will simply wait and try again.
     248         * The default address request might fail.
     249         * That means that someone else is already using that address.
     250         * We will simply wait and try again.
    243251         * (Someone else already wants to add a new device.)
    244252         */
    245         usb_pipe_t ctrl_pipe;
    246         rc = usb_pipe_initialize_default_control(&ctrl_pipe, &dev_conn);
    247         if (rc != EOK) {
    248                 rc = ENOTCONN;
    249                 goto leave_release_free_address;
    250         }
    251 
    252253        do {
    253254                rc = usb_hc_request_address(hc_conn, USB_ADDRESS_DEFAULT,
     
    262263        }
    263264
    264         /* Register control pipe on default address. */
     265        /* Register control pipe on default address. 0 means no interval. */
    265266        rc = usb_pipe_register(&ctrl_pipe, 0);
    266267        if (rc != EOK) {
     
    270271
    271272        struct timeval end_time;
    272 
    273273        rc = gettimeofday(&end_time, NULL);
    274274        if (rc != EOK) {
     
    353353         */
    354354leave_release_default_address:
    355         usb_hc_unregister_device(hc_conn, USB_ADDRESS_DEFAULT);
     355        if (usb_hc_unregister_device(hc_conn, USB_ADDRESS_DEFAULT) != EOK)
     356                usb_log_warning("%s: Failed to unregister defaut device.\n",
     357                    __FUNCTION__);
    356358
    357359leave_release_free_address:
Note: See TracChangeset for help on using the changeset viewer.