Changeset 4a7a8d4 in mainline for uspace/lib
- Timestamp:
- 2011-05-13T10:31:54Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- aca3489
- Parents:
- 05e21ffc (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. - Location:
- uspace/lib
- Files:
-
- 4 added
- 9 edited
- 50 moved
-
drv/generic/remote_usbhc.c (modified) (8 diffs)
-
drv/include/usb_iface.h (modified) (1 diff)
-
drv/include/usbhc_iface.h (modified) (2 diffs)
-
usb/Makefile (modified) (1 diff)
-
usb/include/usb/ddfiface.h (modified) (1 diff)
-
usb/include/usb/descriptor.h (modified) (1 diff)
-
usb/include/usb/driver.h (added)
-
usb/src/ddfiface.c (modified) (1 diff)
-
usb/src/driver.c (moved) (moved from uspace/app/tester/adt/usbaddrkeep.c ) (2 diffs)
-
usb/src/dump.c (modified) (1 diff)
-
usbdev/Makefile (added)
-
usbdev/include/usb/devdrv.h (moved) (moved from uspace/lib/usb/include/usb/devdrv.h )
-
usbdev/include/usb/devpoll.h (moved) (moved from uspace/lib/usb/include/usb/devpoll.h )
-
usbdev/include/usb/dp.h (moved) (moved from uspace/lib/usb/include/usb/dp.h )
-
usbdev/include/usb/hub.h (moved) (moved from uspace/lib/usb/include/usb/hub.h ) (1 diff)
-
usbdev/include/usb/pipes.h (moved) (moved from uspace/lib/usb/include/usb/pipes.h )
-
usbdev/include/usb/recognise.h (moved) (moved from uspace/lib/usb/include/usb/recognise.h )
-
usbdev/include/usb/request.h (moved) (moved from uspace/lib/usb/include/usb/request.h ) (1 diff)
-
usbdev/include/usb/usbdevice.h (moved) (moved from uspace/lib/usb/include/usb/usbdevice.h ) (1 diff)
-
usbdev/src/altiface.c (moved) (moved from uspace/lib/usb/src/altiface.c )
-
usbdev/src/devdrv.c (moved) (moved from uspace/lib/usb/src/devdrv.c )
-
usbdev/src/devpoll.c (moved) (moved from uspace/lib/usb/src/devpoll.c )
-
usbdev/src/dp.c (moved) (moved from uspace/lib/usb/src/dp.c )
-
usbdev/src/hub.c (moved) (moved from uspace/lib/usb/src/hub.c ) (1 diff)
-
usbdev/src/pipepriv.c (moved) (moved from uspace/lib/usb/src/pipepriv.c )
-
usbdev/src/pipepriv.h (moved) (moved from uspace/lib/usb/src/pipepriv.h )
-
usbdev/src/pipes.c (moved) (moved from uspace/lib/usb/src/pipes.c ) (1 diff)
-
usbdev/src/pipesinit.c (moved) (moved from uspace/lib/usb/src/pipesinit.c )
-
usbdev/src/pipesio.c (moved) (moved from uspace/lib/usb/src/pipesio.c )
-
usbdev/src/recognise.c (moved) (moved from uspace/lib/usb/src/recognise.c )
-
usbdev/src/request.c (moved) (moved from uspace/lib/usb/src/request.c ) (1 diff)
-
usbdev/src/usbdevice.c (moved) (moved from uspace/lib/usb/src/usbdevice.c ) (1 diff)
-
usbhid/Makefile (added)
-
usbhid/include/usb/classes/hid.h (moved) (moved from uspace/lib/usb/include/usb/classes/hid.h ) (1 diff)
-
usbhid/include/usb/classes/hid/iface.h (moved) (moved from uspace/lib/usb/include/usb/classes/hid/iface.h )
-
usbhid/include/usb/classes/hid/utled.h (moved) (moved from uspace/lib/usb/include/usb/classes/hid/utled.h )
-
usbhid/include/usb/classes/hid_report_items.h (moved) (moved from uspace/lib/usb/include/usb/classes/hid_report_items.h )
-
usbhid/include/usb/classes/hiddescriptor.h (moved) (moved from uspace/lib/usb/include/usb/classes/hiddescriptor.h )
-
usbhid/include/usb/classes/hidparser.h (moved) (moved from uspace/lib/usb/include/usb/classes/hidparser.h )
-
usbhid/include/usb/classes/hidpath.h (moved) (moved from uspace/lib/usb/include/usb/classes/hidpath.h )
-
usbhid/include/usb/classes/hidreport.h (moved) (moved from uspace/lib/usb/include/usb/classes/hidreport.h )
-
usbhid/include/usb/classes/hidreq.h (moved) (moved from uspace/lib/usb/include/usb/classes/hidreq.h )
-
usbhid/include/usb/classes/hidtypes.h (moved) (moved from uspace/lib/usb/include/usb/classes/hidtypes.h )
-
usbhid/include/usb/classes/hidut.h (moved) (moved from uspace/lib/usb/include/usb/classes/hidut.h )
-
usbhid/include/usb/classes/hidutkbd.h (moved) (moved from uspace/lib/usb/include/usb/classes/hidutkbd.h )
-
usbhid/src/hiddescriptor.c (moved) (moved from uspace/lib/usb/src/hiddescriptor.c )
-
usbhid/src/hidiface.c (moved) (moved from uspace/lib/usb/src/hidiface.c )
-
usbhid/src/hidparser.c (moved) (moved from uspace/lib/usb/src/hidparser.c )
-
usbhid/src/hidpath.c (moved) (moved from uspace/lib/usb/src/hidpath.c )
-
usbhid/src/hidreport.c (moved) (moved from uspace/lib/usb/src/hidreport.c )
-
usbhid/src/hidreq.c (moved) (moved from uspace/lib/usb/src/hidreq.c )
-
usbhost/Makefile (added)
-
usbhost/include/usb/addrkeep.h (moved) (moved from uspace/lib/usb/include/usb/addrkeep.h )
-
usbhost/include/usb/host/batch.h (moved) (moved from uspace/lib/usb/include/usb/host/batch.h )
-
usbhost/include/usb/host/device_keeper.h (moved) (moved from uspace/lib/usb/include/usb/host/device_keeper.h ) (1 diff)
-
usbhost/include/usb/host/endpoint.h (moved) (moved from uspace/lib/usb/include/usb/host/endpoint.h )
-
usbhost/include/usb/host/usb_endpoint_manager.h (moved) (moved from uspace/lib/usb/include/usb/host/usb_endpoint_manager.h )
-
usbhost/src/addrkeep.c (moved) (moved from uspace/lib/usb/src/addrkeep.c )
-
usbhost/src/batch.c (moved) (moved from uspace/lib/usb/src/host/batch.c )
-
usbhost/src/device_keeper.c (moved) (moved from uspace/lib/usb/src/host/device_keeper.c ) (1 diff)
-
usbhost/src/endpoint.c (moved) (moved from uspace/lib/usb/src/host/endpoint.c )
-
usbhost/src/usb_endpoint_manager.c (moved) (moved from uspace/lib/usb/src/host/usb_endpoint_manager.c )
-
usbvirt/Makefile (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/drv/generic/remote_usbhc.c
r05e21ffc r4a7a8d4 52 52 static void remote_usbhc_request_address(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *); 53 53 static void remote_usbhc_bind_address(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *); 54 static void remote_usbhc_find_by_address(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *); 54 55 static void remote_usbhc_release_address(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *); 55 56 static void remote_usbhc_register_endpoint(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *); … … 61 62 remote_usbhc_request_address, 62 63 remote_usbhc_bind_address, 64 remote_usbhc_find_by_address, 63 65 remote_usbhc_release_address, 64 66 … … 163 165 } 164 166 167 void remote_usbhc_find_by_address(ddf_fun_t *fun, void *iface, 168 ipc_callid_t callid, ipc_call_t *call) 169 { 170 usbhc_iface_t *usb_iface = (usbhc_iface_t *) iface; 171 172 if (!usb_iface->find_by_address) { 173 async_answer_0(callid, ENOTSUP); 174 return; 175 } 176 177 usb_address_t address = (usb_address_t) DEV_IPC_GET_ARG1(*call); 178 devman_handle_t handle; 179 int rc = usb_iface->find_by_address(fun, address, &handle); 180 181 if (rc == EOK) { 182 async_answer_1(callid, EOK, handle); 183 } else { 184 async_answer_0(callid, rc); 185 } 186 } 187 165 188 void remote_usbhc_release_address(ddf_fun_t *fun, void *iface, 166 189 ipc_callid_t callid, ipc_call_t *call) … … 302 325 async_transaction_t *trans = async_transaction_create(callid); 303 326 if (trans == NULL) { 327 async_answer_0(data_callid, ENOMEM); 304 328 async_answer_0(callid, ENOMEM); 305 329 return; … … 314 338 315 339 if (rc != EOK) { 340 async_answer_0(data_callid, rc); 316 341 async_answer_0(callid, rc); 317 342 async_transaction_destroy(trans); … … 460 485 async_transaction_t *trans = async_transaction_create(callid); 461 486 if (trans == NULL) { 487 async_answer_0(data_callid, ENOMEM); 462 488 async_answer_0(callid, ENOMEM); 463 489 free(setup_packet); … … 469 495 trans->buffer = malloc(data_len); 470 496 if (trans->buffer == NULL) { 497 async_answer_0(data_callid, ENOMEM); 471 498 async_answer_0(callid, ENOMEM); 472 499 async_transaction_destroy(trans); … … 480 507 481 508 if (rc != EOK) { 509 async_answer_0(data_callid, rc); 482 510 async_answer_0(callid, rc); 483 511 async_transaction_destroy(trans); -
uspace/lib/drv/include/usb_iface.h
r05e21ffc r4a7a8d4 49 49 * - arbitrary error code if returned by remote implementation 50 50 * - EOK - handle found, first parameter contains the USB address 51 * 52 * The handle must be the one used for binding USB address with 53 * it (IPC_M_USBHC_BIND_ADDRESS), otherwise the host controller 54 * (that this request would eventually reach) would not be able 55 * to find it. 56 * The problem is that this handle is actually assigned to the 57 * function inside driver of the parent device (usually hub driver). 58 * To bypass this problem, the initial caller specify handle as 59 * zero and the first parent assigns the actual value. 60 * See usb_iface_get_address_hub_child_impl() implementation 61 * that could be assigned to device ops of a child device of in a 62 * hub driver. 63 * For example, the USB multi interface device driver (MID) 64 * passes this initial zero without any modification because the 65 * handle must be resolved by its parent. 51 66 */ 52 67 IPC_M_USB_GET_ADDRESS, -
uspace/lib/drv/include/usbhc_iface.h
r05e21ffc r4a7a8d4 105 105 IPC_M_USBHC_BIND_ADDRESS, 106 106 107 /** Get handle binded with given USB address. 108 * Parameters 109 * - USB address 110 * Answer: 111 * - EOK - address binded, first parameter is the devman handle 112 * - ENOENT - address is not in use at the moment 113 */ 114 IPC_M_USBHC_GET_HANDLE_BY_ADDRESS, 115 107 116 /** Release address in use. 108 117 * Arguments: … … 207 216 int (*request_address)(ddf_fun_t *, usb_speed_t, usb_address_t *); 208 217 int (*bind_address)(ddf_fun_t *, usb_address_t, devman_handle_t); 218 int (*find_by_address)(ddf_fun_t *, usb_address_t, devman_handle_t *); 209 219 int (*release_address)(ddf_fun_t *, usb_address_t); 210 220 -
uspace/lib/usb/Makefile
r05e21ffc r4a7a8d4 29 29 USPACE_PREFIX = ../.. 30 30 LIBRARY = libusb 31 LIBS = $(LIBDRV_PREFIX)/libdrv.a 32 EXTRA_CFLAGS += -I$(LIBDRV_PREFIX)/include -Iinclude 31 EXTRA_CFLAGS += \ 32 -I$(LIBDRV_PREFIX)/include \ 33 -Iinclude 33 34 34 35 SOURCES = \ 35 src/addrkeep.c \36 src/altiface.c \37 36 src/class.c \ 38 37 src/ddfiface.c \ 39 38 src/debug.c \ 40 src/devdrv.c \ 41 src/devpoll.c \ 42 src/dp.c \ 39 src/driver.c \ 43 40 src/dump.c \ 44 src/hidiface.c \45 src/hidpath.c \46 src/hidparser.c \47 src/hiddescriptor.c \48 41 src/host.c \ 49 src/hub.c \ 50 src/pipepriv.c \ 51 src/pipes.c \ 52 src/pipesinit.c \ 53 src/pipesio.c \ 54 src/recognise.c \ 55 src/request.c \ 56 src/usb.c \ 57 src/usbdevice.c \ 58 src/hidreq.c \ 59 src/hidreport.c \ 60 src/host/device_keeper.c \ 61 src/host/batch.c \ 62 src/host/endpoint.c \ 63 src/host/usb_endpoint_manager.c 42 src/usb.c 64 43 65 44 include $(USPACE_PREFIX)/Makefile.common -
uspace/lib/usb/include/usb/ddfiface.h
r05e21ffc r4a7a8d4 37 37 38 38 #include <sys/types.h> 39 #include <usb/usbdevice.h>40 39 #include <usb_iface.h> 41 40 -
uspace/lib/usb/include/usb/descriptor.h
r05e21ffc r4a7a8d4 167 167 } __attribute__ ((packed)) usb_standard_endpoint_descriptor_t; 168 168 169 /** Part of standard USB HID descriptor specifying one class descriptor. 170 * 171 * (See HID Specification, p.22) 172 */ 173 typedef struct { 174 /** Type of class-specific descriptor (Report or Physical). */ 175 uint8_t type; 176 /** Length of class-specific descriptor in bytes. */ 177 uint16_t length; 178 } __attribute__ ((packed)) usb_standard_hid_class_descriptor_info_t; 179 180 /** Standard USB HID descriptor. 181 * 182 * (See HID Specification, p.22) 183 * 184 * It is actually only the "header" of the descriptor, it does not contain 185 * the last two mandatory fields (type and length of the first class-specific 186 * descriptor). 187 */ 188 typedef struct { 189 /** Total size of this descriptor in bytes. 190 * 191 * This includes all class-specific descriptor info - type + length 192 * for each descriptor. 193 */ 194 uint8_t length; 195 /** Descriptor type (USB_DESCTYPE_HID). */ 196 uint8_t descriptor_type; 197 /** HID Class Specification release. */ 198 uint16_t spec_release; 199 /** Country code of localized hardware. */ 200 uint8_t country_code; 201 /** Total number of class-specific (i.e. Report and Physical) 202 * descriptors. 203 * 204 * @note There is always only one Report descriptor. 205 */ 206 uint8_t class_desc_count; 207 /** First mandatory class descriptor (Report) info. */ 208 usb_standard_hid_class_descriptor_info_t report_desc_info; 209 } __attribute__ ((packed)) usb_standard_hid_descriptor_t; 210 169 211 #endif 170 212 /** -
uspace/lib/usb/src/ddfiface.c
r05e21ffc r4a7a8d4 37 37 #include <async.h> 38 38 #include <usb/ddfiface.h> 39 #include <usb/driver.h> 39 40 #include <usb/debug.h> 40 41 #include <errno.h> -
uspace/lib/usb/src/driver.c
r05e21ffc r4a7a8d4 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 #include <stdio.h> 30 #include <stdlib.h> 31 #include <usb/addrkeep.h> 29 /** @addtogroup libusb 30 * @{ 31 */ 32 /** @file 33 * 34 */ 35 #include <devman.h> 36 #include <dev_iface.h> 37 #include <usb_iface.h> 38 #include <usb/driver.h> 32 39 #include <errno.h> 33 #include "../tester.h"34 35 #define MAX_ADDRESS 536 40 37 41 38 const char *test_usbaddrkeep(void) 42 /** Find host controller handle that is ancestor of given device. 43 * 44 * @param[in] device_handle Device devman handle. 45 * @param[out] hc_handle Where to store handle of host controller 46 * controlling device with @p device_handle handle. 47 * @return Error code. 48 */ 49 int usb_hc_find(devman_handle_t device_handle, devman_handle_t *hc_handle) 39 50 { 40 int rc; 41 usb_address_keeping_t addresses; 42 43 TPRINTF("Initializing addresses keeping structure...\n"); 44 usb_address_keeping_init(&addresses, MAX_ADDRESS); 45 46 TPRINTF("Requesting address...\n"); 47 usb_address_t addr = usb_address_keeping_request(&addresses); 48 TPRINTF("Address assigned: %d\n", (int) addr); 49 if (addr != 1) { 50 return "have not received expected address 1"; 51 int parent_phone = devman_parent_device_connect(device_handle, 52 IPC_FLAG_BLOCKING); 53 if (parent_phone < 0) { 54 return parent_phone; 51 55 } 52 56 53 TPRINTF("Releasing not assigned address...\n"); 54 rc = usb_address_keeping_release(&addresses, 2); 55 if (rc != ENOENT) { 56 return "have not received expected ENOENT"; 57 devman_handle_t h; 58 int rc = async_req_1_1(parent_phone, DEV_IFACE_ID(USB_DEV_IFACE), 59 IPC_M_USB_GET_HOST_CONTROLLER_HANDLE, &h); 60 61 async_hangup(parent_phone); 62 63 if (rc != EOK) { 64 return rc; 57 65 } 58 66 59 TPRINTF("Releasing acquired address...\n"); 60 rc = usb_address_keeping_release(&addresses, addr); 61 if (rc != EOK) { 62 return "have not received expected EOK"; 67 if (hc_handle != NULL) { 68 *hc_handle = h; 63 69 } 64 70 65 return NULL;71 return EOK; 66 72 } 73 74 /** 75 * @} 76 */ -
uspace/lib/usb/src/dump.c
r05e21ffc r4a7a8d4 41 41 #include <usb/descriptor.h> 42 42 #include <usb/classes/classes.h> 43 #include <usb/classes/hid.h>44 43 45 44 /** Mapping between descriptor id and dumping function. */ -
uspace/lib/usbdev/include/usb/hub.h
r05e21ffc r4a7a8d4 63 63 const usb_hc_attached_device_t *); 64 64 int usb_hc_unregister_device(usb_hc_connection_t *, usb_address_t); 65 int usb_hc_get_handle_by_address(usb_hc_connection_t *, usb_address_t, 66 devman_handle_t *); 65 67 66 68 #endif -
uspace/lib/usbdev/include/usb/request.h
r05e21ffc r4a7a8d4 142 142 143 143 int usb_request_clear_endpoint_halt(usb_pipe_t *, uint16_t); 144 int usb_pipe_clear_halt(usb_pipe_t *, usb_pipe_t *); 145 int usb_request_get_endpoint_status(usb_pipe_t *, usb_pipe_t *, uint16_t *); 144 146 145 147 #endif -
uspace/lib/usbdev/include/usb/usbdevice.h
r05e21ffc r4a7a8d4 50 50 } usb_hc_connection_t; 51 51 52 int usb_hc_find(devman_handle_t, devman_handle_t *);53 54 52 int usb_hc_connection_initialize_from_device(usb_hc_connection_t *, 55 53 ddf_dev_t *); -
uspace/lib/usbdev/src/hub.c
r05e21ffc r4a7a8d4 117 117 DEV_IFACE_ID(USBHC_DEV_IFACE), 118 118 IPC_M_USBHC_RELEASE_ADDRESS, address); 119 } 120 121 /** Get handle of USB device with given address. 122 * 123 * @param[in] connection Opened connection to host controller. 124 * @param[in] address Address of device in question. 125 * @param[out] handle Where to write the device handle. 126 * @return Error code. 127 */ 128 int usb_hc_get_handle_by_address(usb_hc_connection_t *connection, 129 usb_address_t address, devman_handle_t *handle) 130 { 131 CHECK_CONNECTION(connection); 132 133 sysarg_t tmp; 134 int rc = async_req_2_1(connection->hc_phone, 135 DEV_IFACE_ID(USBHC_DEV_IFACE), 136 IPC_M_USBHC_GET_HANDLE_BY_ADDRESS, 137 address, &tmp); 138 if ((rc == EOK) && (handle != NULL)) { 139 *handle = tmp; 140 } 141 142 return rc; 119 143 } 120 144 -
uspace/lib/usbdev/src/pipes.c
r05e21ffc r4a7a8d4 36 36 #include <usb/pipes.h> 37 37 #include <usb/debug.h> 38 #include <usb/driver.h> 38 39 #include <usbhc_iface.h> 39 40 #include <usb_iface.h> -
uspace/lib/usbdev/src/request.c
r05e21ffc r4a7a8d4 885 885 } 886 886 887 /** Clear halt bit of an endpoint pipe (after pipe stall). 888 * 889 * @param ctrl_pipe Control pipe. 890 * @param target_pipe Which pipe is halted and shall be cleared. 891 * @return Error code. 892 */ 893 int usb_pipe_clear_halt(usb_pipe_t *ctrl_pipe, usb_pipe_t *target_pipe) 894 { 895 if ((ctrl_pipe == NULL) || (target_pipe == NULL)) { 896 return EINVAL; 897 } 898 return usb_request_clear_endpoint_halt(ctrl_pipe, 899 target_pipe->endpoint_no); 900 } 901 902 /** Get endpoint status. 903 * 904 * @param[in] ctrl_pipe Control pipe. 905 * @param[in] pipe Of which pipe the status shall be received. 906 * @param[out] status Where to store pipe status (in native endianness). 907 * @return Error code. 908 */ 909 int usb_request_get_endpoint_status(usb_pipe_t *ctrl_pipe, usb_pipe_t *pipe, 910 uint16_t *status) 911 { 912 uint16_t status_tmp; 913 uint16_t pipe_index = (uint16_t) pipe->endpoint_no; 914 int rc = usb_request_get_status(ctrl_pipe, 915 USB_REQUEST_RECIPIENT_ENDPOINT, uint16_host2usb(pipe_index), 916 &status_tmp); 917 if (rc != EOK) { 918 return rc; 919 } 920 921 if (status != NULL) { 922 *status = uint16_usb2host(status_tmp); 923 } 924 925 return EOK; 926 } 927 887 928 /** 888 929 * @} -
uspace/lib/usbdev/src/usbdevice.c
r05e21ffc r4a7a8d4 37 37 #include <usb_iface.h> 38 38 #include <usb/usbdevice.h> 39 #include <usb/driver.h> 39 40 #include <usb/debug.h> 40 41 #include <errno.h> 41 42 #include <assert.h> 42 43 /** Find host controller handle that is ancestor of given device.44 *45 * @param[in] device_handle Device devman handle.46 * @param[out] hc_handle Where to store handle of host controller47 * controlling device with @p device_handle handle.48 * @return Error code.49 */50 int usb_hc_find(devman_handle_t device_handle, devman_handle_t *hc_handle)51 {52 int parent_phone = devman_parent_device_connect(device_handle,53 IPC_FLAG_BLOCKING);54 if (parent_phone < 0) {55 return parent_phone;56 }57 58 devman_handle_t h;59 usb_log_debug("asking for HC handle (my handle is %zu).\n", device_handle);60 int rc = async_req_1_1(parent_phone, DEV_IFACE_ID(USB_DEV_IFACE),61 IPC_M_USB_GET_HOST_CONTROLLER_HANDLE, &h);62 63 async_hangup(parent_phone);64 65 if (rc != EOK) {66 return rc;67 }68 69 if (hc_handle != NULL) {70 *hc_handle = h;71 }72 73 return EOK;74 }75 43 76 44 /** Initialize connection to USB host controller. -
uspace/lib/usbhid/include/usb/classes/hid.h
r05e21ffc r4a7a8d4 69 69 } usb_hid_iface_protocol_t; 70 70 71 /** Part of standard USB HID descriptor specifying one class descriptor.72 *73 * (See HID Specification, p.22)74 */75 typedef struct {76 /** Type of class-specific descriptor (Report or Physical). */77 uint8_t type;78 /** Length of class-specific descriptor in bytes. */79 uint16_t length;80 } __attribute__ ((packed)) usb_standard_hid_class_descriptor_info_t;81 82 /** Standard USB HID descriptor.83 *84 * (See HID Specification, p.22)85 *86 * It is actually only the "header" of the descriptor, it does not contain87 * the last two mandatory fields (type and length of the first class-specific88 * descriptor).89 */90 typedef struct {91 /** Total size of this descriptor in bytes.92 *93 * This includes all class-specific descriptor info - type + length94 * for each descriptor.95 */96 uint8_t length;97 /** Descriptor type (USB_DESCTYPE_HID). */98 uint8_t descriptor_type;99 /** HID Class Specification release. */100 uint16_t spec_release;101 /** Country code of localized hardware. */102 uint8_t country_code;103 /** Total number of class-specific (i.e. Report and Physical)104 * descriptors.105 *106 * @note There is always only one Report descriptor.107 */108 uint8_t class_desc_count;109 /** First mandatory class descriptor (Report) info. */110 usb_standard_hid_class_descriptor_info_t report_desc_info;111 } __attribute__ ((packed)) usb_standard_hid_descriptor_t;112 113 71 114 72 #endif -
uspace/lib/usbhost/include/usb/host/device_keeper.h
r05e21ffc r4a7a8d4 80 80 devman_handle_t handle); 81 81 82 bool usb_device_keeper_find_by_address(usb_device_keeper_t *instance, 83 usb_address_t address, devman_handle_t *handle); 84 82 85 usb_speed_t usb_device_keeper_get_speed(usb_device_keeper_t *instance, 83 86 usb_address_t address); -
uspace/lib/usbhost/src/device_keeper.c
r05e21ffc r4a7a8d4 157 157 return ENOENT; 158 158 } 159 160 /** Find devman handled assigned to USB address. 161 * 162 * @param[in] instance Device keeper structure to use. 163 * @param[in] address Address the caller wants to find. 164 * @param[out] handle Where to store found handle. 165 * @return Whether such address is currently occupied. 166 */ 167 bool usb_device_keeper_find_by_address(usb_device_keeper_t *instance, 168 usb_address_t address, devman_handle_t *handle) 169 { 170 assert(instance); 171 fibril_mutex_lock(&instance->guard); 172 if ((address < 0) || (address >= USB_ADDRESS_COUNT)) { 173 fibril_mutex_unlock(&instance->guard); 174 return false; 175 } 176 if (!instance->devices[address].occupied) { 177 fibril_mutex_unlock(&instance->guard); 178 return false; 179 } 180 181 if (handle != NULL) { 182 *handle = instance->devices[address].handle; 183 } 184 185 fibril_mutex_unlock(&instance->guard); 186 return true; 187 } 188 159 189 /*----------------------------------------------------------------------------*/ 160 190 /** Get speed associated with the address -
uspace/lib/usbvirt/Makefile
r05e21ffc r4a7a8d4 30 30 LIBRARY = libusbvirt 31 31 32 EXTRA_CFLAGS = -I$(LIBUSB_PREFIX)/include -I$(LIBDRV_PREFIX)/include -Iinclude 32 EXTRA_CFLAGS = \ 33 -I$(LIBDRV_PREFIX)/include \ 34 -I$(LIBUSB_PREFIX)/include \ 35 -I$(LIBUSBDEV_PREFIX)/include \ 36 -Iinclude 33 37 34 38 SOURCES = \
Note:
See TracChangeset
for help on using the changeset viewer.
