Changeset cc5908e in mainline for uspace/lib/usb/src/host.c


Ignore:
Timestamp:
2011-05-07T14:28:51Z (13 years ago)
Author:
Matej Klonfar <maklf@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
252cf2a, 68b614e
Parents:
bd2394b (diff), 7205209 (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:

Development changes merged

File:
1 moved

Legend:

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

    rbd2394b rcc5908e  
    11/*
    2  * Copyright (c) 2010 Vojtech Horky
     2 * Copyright (c) 2011 Vojtech Horky
    33 * All rights reserved.
    44 *
     
    2727 */
    2828
    29 /** @addtogroup usbvirtkbd
     29/** @addtogroup libusb
    3030 * @{
    3131 */
    32 /** @file
    33  * @brief USB keyboard configuration.
     32/**
     33 * @file
     34 * Host controller common functions (implementation).
    3435 */
    35 #ifndef VUK_KBDCONFIG_H_
    36 #define VUK_KBDCONFIG_H_
     36#include <stdio.h>
     37#include <str_error.h>
     38#include <errno.h>
     39#include <assert.h>
     40#include <bool.h>
     41#include <usb/host.h>
     42#include <usb/descriptor.h>
     43#include <devman.h>
    3744
    38 #include <usb/descriptor.h>
    39 #include "report.h"
    40 #include "descriptor.h"
     45/** Get host controller handle by its class index.
     46 *
     47 * @param class_index Class index for the host controller.
     48 * @param hc_handle Where to store the HC handle
     49 *      (can be NULL for existence test only).
     50 * @return Error code.
     51 */
     52int usb_ddf_get_hc_handle_by_class(size_t class_index,
     53    devman_handle_t *hc_handle)
     54{
     55        char *class_index_str;
     56        devman_handle_t hc_handle_tmp;
     57        int rc;
    4158
    42 extern usb_standard_device_descriptor_t std_device_descriptor;
     59        rc = asprintf(&class_index_str, "%zu", class_index);
     60        if (rc < 0) {
     61                return ENOMEM;
     62        }
     63        rc = devman_device_get_handle_by_class("usbhc", class_index_str,
     64            &hc_handle_tmp, 0);
     65        free(class_index_str);
     66        if (rc != EOK) {
     67                return rc;
     68        }
    4369
    44 extern usb_standard_configuration_descriptor_t std_configuration_descriptor;
     70        if (hc_handle != NULL) {
     71                *hc_handle = hc_handle_tmp;
     72        }
    4573
    46 extern usb_standard_interface_descriptor_t std_interface_descriptor;
     74        return EOK;
     75}
    4776
    48 extern usb_standard_endpoint_descriptor_t endpoint_descriptor;
    49 
    50 
    51 extern hid_descriptor_t hid_descriptor;
    52 
    53 extern report_descriptor_data_t report_descriptor;
    54 extern size_t report_descriptor_size;
    55 
    56 
    57 #endif
    58 /**
    59  * @}
     77/** @}
    6078 */
Note: See TracChangeset for help on using the changeset viewer.