Changeset 7fc092a in mainline for uspace/lib/usb/src/recognise.c


Ignore:
Timestamp:
2011-01-27T22:09:29Z (13 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
db7ed07
Parents:
9ee87f6 (diff), 6265a2b (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Changes from development branch

File:
1 edited

Legend:

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

    r9ee87f6 r7fc092a  
    2727 */
    2828
    29 /** @addtogroup libusb usb
     29/** @addtogroup libusb
    3030 * @{
    3131 */
     
    3939#include <errno.h>
    4040
     41/** Callback for getting host controller handle.
     42 *
     43 * @param dev Device in question.
     44 * @param[out] handle Devman handle of the host controller.
     45 * @return Error code.
     46 */
    4147static int usb_iface_get_hc_handle(device_t *dev, devman_handle_t *handle)
    4248{
     
    203209                uint8_t cur_descr_len = current_descriptor[0];
    204210                uint8_t cur_descr_type = current_descriptor[1];
     211
     212                if (cur_descr_len == 0) {
     213                        return ENOENT;
     214                }
    205215               
    206216                position += cur_descr_len;
     
    233243 * @param matches Match ids list to add matches to.
    234244 * @param address USB address of the attached device.
     245 * @param config_count Number of configurations the device has.
    235246 * @return Error code.
    236247 */
     
    338349/** Probe for device kind and register it in devman.
    339350 *
    340  * @param hc Open phone to the host controller.
    341  * @param parent Parent device.
    342  * @param address Address of the (unknown) attached device.
     351 * @param[in] hc Open phone to the host controller.
     352 * @param[in] parent Parent device.
     353 * @param[in] address Address of the (unknown) attached device.
     354 * @param[out] child_handle Handle of the child device.
    343355 * @return Error code.
    344356 */
     
    346358    usb_address_t address, devman_handle_t *child_handle)
    347359{
     360        static size_t device_name_index = 0;
     361
    348362        device_t *child = NULL;
    349363        char *child_name = NULL;
     
    357371
    358372        /*
    359          * TODO: some better child naming
    360          */
    361         rc = asprintf(&child_name, "usb%p", child);
     373         * TODO: Once the device driver framework support persistent
     374         * naming etc., something more descriptive could be created.
     375         */
     376        rc = asprintf(&child_name, "usbdev%02zu", device_name_index);
    362377        if (rc < 0) {
    363378                goto failure;
     
    381396        }
    382397       
     398        device_name_index++;
     399
    383400        return EOK;
    384401
Note: See TracChangeset for help on using the changeset viewer.