Changeset 4fa0a384 in mainline


Ignore:
Timestamp:
2011-04-10T13:26:33Z (13 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
231748a
Parents:
6ee6e6f
Message:

Descriptor retrieval start long transfer by itself

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/usb/src/devdrv.c

    r6ee6e6f r4fa0a384  
    343343/** Retrieve basic descriptors from the device.
    344344 *
    345  * @param[in] ctrl_pipe Control pipe with opened session.
     345 * @param[in] ctrl_pipe Control endpoint pipe.
    346346 * @param[out] descriptors Where to store the descriptors.
    347347 * @return Error code.
     
    351351{
    352352        assert(descriptors != NULL);
    353         assert(usb_pipe_is_session_started(ctrl_pipe));
    354353
    355354        descriptors->configuration = NULL;
    356355
    357356        int rc;
     357
     358        /* It is worth to start a long transfer. */
     359        rc = usb_pipe_start_long_transfer(ctrl_pipe);
     360        if (rc != EOK) {
     361                return rc;
     362        }
    358363
    359364        /* Get the device descriptor. */
    360365        rc = usb_request_get_device_descriptor(ctrl_pipe, &descriptors->device);
    361366        if (rc != EOK) {
    362                 return rc;
     367                goto leave;
    363368        }
    364369
     
    367372            ctrl_pipe, 0, (void **) &descriptors->configuration,
    368373            &descriptors->configuration_size);
    369         if (rc != EOK) {
    370                 return rc;
    371         }
    372 
    373         return EOK;
     374
     375leave:
     376        usb_pipe_end_long_transfer(ctrl_pipe);
     377
     378        return rc;
    374379}
    375380
     
    575580        dev->interface_no = usb_device_get_assigned_interface(dev->ddf_dev);
    576581
    577         /*
    578          * We will do some querying of the device, it is worth to prepare
    579          * the long transfer.
    580          */
    581         rc = usb_pipe_start_long_transfer(&dev->ctrl_pipe);
    582         if (rc != EOK) {
    583                 *errmsg = "transfer start";
    584                 return rc;
    585         }
    586 
    587582        /* Retrieve the descriptors. */
    588583        rc = usb_device_retrieve_descriptors(&dev->ctrl_pipe,
     
    591586                *errmsg = "descriptor retrieval";
    592587        }
    593 
    594         usb_pipe_end_long_transfer(&dev->ctrl_pipe);
    595588
    596589        return rc;
Note: See TracChangeset for help on using the changeset viewer.