Changeset 9e195e2c in mainline for uspace/lib/usb/src/host.c
- Timestamp:
- 2011-05-12T09:03:00Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- d59d0bb
- Parents:
- 456aea3 (diff), c372e03 (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. - File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usb/src/host.c
r456aea3 r9e195e2c 1 1 /* 2 * Copyright (c) 201 0Vojtech Horky2 * Copyright (c) 2011 Vojtech Horky 3 3 * All rights reserved. 4 4 * … … 27 27 */ 28 28 29 /** @addtogroup usbvirtkbd29 /** @addtogroup libusb 30 30 * @{ 31 31 */ 32 32 /** 33 33 * @file 34 * @brief Keyboard configuration.34 * Host controller common functions (implementation). 35 35 */ 36 #include <stdio.h> 37 #include <str_error.h> 36 38 #include <errno.h> 39 #include <assert.h> 40 #include <bool.h> 41 #include <usb/host.h> 37 42 #include <usb/descriptor.h> 38 #include "stdreq.h" 39 #include "kbdconfig.h" 43 #include <devman.h> 40 44 41 int req_get_descriptor(usbvirt_device_t *device, 42 const usb_device_request_setup_packet_t *setup_packet, 43 uint8_t *data, size_t *act_size) 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 */ 52 int usb_ddf_get_hc_handle_by_class(size_t class_index, 53 devman_handle_t *hc_handle) 44 54 { 45 if (setup_packet->value_high == USB_DESCTYPE_HID_REPORT) { 46 /* 47 * For simplicity, always return the same 48 * report descriptor. 49 */ 50 usbvirt_control_reply_helper(setup_packet, 51 data, act_size, 52 report_descriptor, report_descriptor_size); 55 char *class_index_str; 56 devman_handle_t hc_handle_tmp; 57 int rc; 53 58 54 return EOK; 59 rc = asprintf(&class_index_str, "%zu", class_index); 60 if (rc < 0) { 61 return ENOMEM; 55 62 } 56 57 /* Let the framework handle all the rest. */ 58 return EFORWARD; 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 } 69 70 if (hc_handle != NULL) { 71 *hc_handle = hc_handle_tmp; 72 } 73 74 return EOK; 59 75 } 60 61 62 76 63 77 /** @}
Note:
See TracChangeset
for help on using the changeset viewer.