Changeset 7fc092a in mainline for uspace/lib/usb
- Timestamp:
- 2011-01-27T22:09:29Z (15 years ago)
- 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. - Location:
- uspace/lib/usb
- Files:
-
- 3 added
- 29 edited
- 2 moved
-
Makefile (modified) (2 diffs)
-
include/usb/addrkeep.h (modified) (1 diff, 1 prop)
-
include/usb/classes/classes.h (modified) (1 diff)
-
include/usb/classes/hid.h (modified) (7 diffs)
-
include/usb/classes/hidparser.h (modified) (4 diffs)
-
include/usb/classes/hidut.h (modified) (1 diff)
-
include/usb/classes/hidutkbd.h (modified) (1 diff)
-
include/usb/classes/hub.h (modified) (2 diffs)
-
include/usb/debug.h (modified) (2 diffs)
-
include/usb/descriptor.h (modified) (1 diff)
-
include/usb/devreq.h (modified) (1 diff)
-
include/usb/dp.h (moved) (moved from uspace/srv/net/il/arp/arp_module.h ) (2 diffs)
-
include/usb/hcd.h (modified) (1 diff, 1 prop)
-
include/usb/hcdhubd.h (modified) (1 diff)
-
include/usb/usb.h (modified) (1 diff)
-
include/usb/usbdrv.h (modified) (1 diff)
-
include/usb/usbmem.h (moved) (moved from uspace/srv/net/il/arp/arp_header.h ) (2 diffs)
-
src/addrkeep.c (modified) (1 diff)
-
src/class.c (modified) (1 diff)
-
src/debug.c (modified) (1 diff)
-
src/dp.c (added)
-
src/drvpsync.c (modified) (1 diff)
-
src/dump.c (added)
-
src/hcdhubd.c (modified) (1 diff)
-
src/hcdhubd_private.h (modified) (1 diff)
-
src/hcdrv.c (modified) (1 diff)
-
src/hidparser.c (modified) (6 diffs)
-
src/localdrv.c (modified) (1 diff)
-
src/recognise.c (modified) (8 diffs)
-
src/remotedrv.c (modified) (1 diff)
-
src/usb.c (modified) (1 diff)
-
src/usbdrv.c (modified) (1 diff)
-
src/usbdrvreq.c (modified) (3 diffs)
-
src/usbmem.c (added)
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usb/Makefile
r9ee87f6 r7fc092a 36 36 src/class.c \ 37 37 src/debug.c \ 38 src/dp.c \ 38 39 src/drvpsync.c \ 40 src/dump.c \ 39 41 src/hcdhubd.c \ 40 42 src/hcdrv.c \ … … 45 47 src/usb.c \ 46 48 src/usbdrvreq.c \ 47 src/usbdrv.c 49 src/usbdrv.c \ 50 src/usbmem.c 48 51 49 52 include $(USPACE_PREFIX)/Makefile.common -
uspace/lib/usb/include/usb/addrkeep.h
-
Property mode
changed from
100644to120000
r9ee87f6 r7fc092a 1 /* 2 * Copyright (c) 2010 Vojtech Horky 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 9 * - Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * - Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * - The name of the author may not be used to endorse or promote products 15 * derived from this software without specific prior written permission. 16 * 17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 */ 28 29 /** @addtogroup libusb usb 30 * @{ 31 */ 32 /** @file 33 * @brief HC driver. 34 */ 35 #ifndef LIBUSB_HCD_H_ 36 #define LIBUSB_HCD_H_ 37 38 #include <usb/usb.h> 39 #include <fibril_synch.h> 40 #include <devman.h> 41 42 /** Info about used address. */ 43 typedef struct { 44 /** Linked list member. */ 45 link_t link; 46 /** Address. */ 47 usb_address_t address; 48 /** Corresponding devman handle. */ 49 devman_handle_t devman_handle; 50 } usb_address_keeping_used_t; 51 52 /** Structure for keeping track of free and used USB addresses. */ 53 typedef struct { 54 /** Head of list of used addresses. */ 55 link_t used_addresses; 56 /** Upper bound for USB addresses. */ 57 usb_address_t max_address; 58 /** Mutex protecting used address. */ 59 fibril_mutex_t used_addresses_guard; 60 /** Condition variable for used addresses. */ 61 fibril_condvar_t used_addresses_condvar; 62 63 /** Condition variable mutex for default address. */ 64 fibril_mutex_t default_condvar_guard; 65 /** Condition variable for default address. */ 66 fibril_condvar_t default_condvar; 67 /** Whether is default address available. */ 68 bool default_available; 69 } usb_address_keeping_t; 70 71 void usb_address_keeping_init(usb_address_keeping_t *, usb_address_t); 72 73 void usb_address_keeping_reserve_default(usb_address_keeping_t *); 74 void usb_address_keeping_release_default(usb_address_keeping_t *); 75 76 usb_address_t usb_address_keeping_request(usb_address_keeping_t *); 77 int usb_address_keeping_release(usb_address_keeping_t *, usb_address_t); 78 void usb_address_keeping_devman_bind(usb_address_keeping_t *, usb_address_t, 79 devman_handle_t); 80 usb_address_t usb_address_keeping_find(usb_address_keeping_t *, 81 devman_handle_t); 82 83 84 #endif 1 hcd.h -
Property mode
changed from
-
uspace/lib/usb/include/usb/classes/classes.h
r9ee87f6 r7fc092a 27 27 */ 28 28 29 /** @addtogroup libusb usb29 /** @addtogroup libusb 30 30 * @{ 31 31 */ -
uspace/lib/usb/include/usb/classes/hid.h
r9ee87f6 r7fc092a 27 27 */ 28 28 29 /** @addtogroup libusb usb29 /** @addtogroup libusb 30 30 * @{ 31 31 */ … … 39 39 #include <driver.h> 40 40 #include <usb/classes/hidparser.h> 41 #include <usb/descriptor.h> 41 42 42 43 /** USB/HID device requests. */ … … 63 64 */ 64 65 typedef struct { 65 /** Type of class descriptor (Report or Physical). */66 uint8_t class_descriptor_type;67 /** Length of class descriptor. */68 uint16_t class_descriptor_length;69 } __attribute__ ((packed)) usb_standard_hid_ descriptor_class_item_t;66 /** Type of class-specific descriptor (Report or Physical). */ 67 uint8_t type; 68 /** Length of class-specific descriptor in bytes. */ 69 uint16_t length; 70 } __attribute__ ((packed)) usb_standard_hid_class_descriptor_info_t; 70 71 71 72 /** Standard USB HID descriptor. … … 73 74 * (See HID Specification, p.22) 74 75 * 75 * It is actually only the "header" of the descriptor, as it may have arbitrary 76 * length if more than one class descritor is provided. 76 * It is actually only the "header" of the descriptor, it does not contain 77 * the last two mandatory fields (type and length of the first class-specific 78 * descriptor). 77 79 */ 78 80 typedef struct { 79 /** Size of this descriptor in bytes. */ 81 /** Total size of this descriptor in bytes. 82 * 83 * This includes all class-specific descriptor info - type + length 84 * for each descriptor. 85 */ 80 86 uint8_t length; 81 87 /** Descriptor type (USB_DESCTYPE_HID). */ … … 85 91 /** Country code of localized hardware. */ 86 92 uint8_t country_code; 87 /** Total number of class (i.e. Report and Physical) descriptors. */ 88 uint8_t class_count; 89 /** First mandatory class descriptor info. */ 90 usb_standard_hid_descriptor_class_item_t class_descriptor; 93 /** Total number of class-specific (i.e. Report and Physical) 94 * descriptors. 95 * 96 * @note There is always only one Report descriptor. 97 */ 98 uint8_t class_desc_count; 99 /** First mandatory class descriptor (Report) info. */ 100 usb_standard_hid_class_descriptor_info_t report_desc_info; 91 101 } __attribute__ ((packed)) usb_standard_hid_descriptor_t; 92 102 103 /** 104 * 105 */ 106 typedef struct { 107 usb_standard_interface_descriptor_t iface_desc; 108 usb_standard_endpoint_descriptor_t *endpoints; 109 usb_standard_hid_descriptor_t hid_desc; 110 uint8_t *report_desc; 111 //usb_standard_hid_class_descriptor_info_t *class_desc_info; 112 //uint8_t **class_descs; 113 } usb_hid_iface_t; 114 115 /** 116 * 117 */ 118 typedef struct { 119 usb_standard_configuration_descriptor_t config_descriptor; 120 usb_hid_iface_t *interfaces; 121 } usb_hid_configuration_t; 93 122 94 123 /** … … 99 128 typedef struct { 100 129 device_t *device; 130 usb_hid_configuration_t *conf; 101 131 usb_address_t address; 102 132 usb_endpoint_t poll_endpoint; … … 104 134 } usb_hid_dev_kbd_t; 105 135 136 // TODO: more configurations! 137 106 138 #endif 107 139 /** -
uspace/lib/usb/include/usb/classes/hidparser.h
r9ee87f6 r7fc092a 27 27 */ 28 28 29 /** @addtogroup libusb usb29 /** @addtogroup libusb 30 30 * @{ 31 31 */ … … 38 38 #include <stdint.h> 39 39 40 /** 41 * Description of report items 42 */ 43 typedef struct { 44 45 uint8_t usage_min; 46 uint8_t usage_max; 47 uint8_t logical_min; 48 uint8_t logical_max; 49 uint8_t size; 50 uint8_t count; 51 uint8_t offset; 52 53 } usb_hid_report_item_t; 54 55 40 56 /** HID report parser structure. */ 41 57 typedef struct { 42 58 } usb_hid_report_parser_t; 59 43 60 44 61 /** HID parser callbacks for IN items. */ … … 50 67 * @param arg Custom argument. 51 68 */ 52 void (*keyboard)(const uint 16_t *key_codes, size_t count, void *arg);69 void (*keyboard)(const uint8_t *key_codes, size_t count, const uint8_t modifiers, void *arg); 53 70 } usb_hid_report_in_callbacks_t; 71 72 #define USB_HID_BOOT_KEYBOARD_NUM_LOCK 0x01 73 #define USB_HID_BOOT_KEYBOARD_CAPS_LOCK 0x02 74 #define USB_HID_BOOT_KEYBOARD_SCROLL_LOCK 0x04 75 #define USB_HID_BOOT_KEYBOARD_COMPOSE 0x08 76 #define USB_HID_BOOT_KEYBOARD_KANA 0x10 77 78 /* 79 * modifiers definitions 80 */ 81 82 int usb_hid_boot_keyboard_input_report(const uint8_t *data, size_t size, 83 const usb_hid_report_in_callbacks_t *callbacks, void *arg); 84 85 int usb_hid_boot_keyboard_output_report(uint8_t leds, uint8_t *data, size_t size); 54 86 55 87 int usb_hid_parse_report_descriptor(usb_hid_report_parser_t *parser, … … 60 92 const usb_hid_report_in_callbacks_t *callbacks, void *arg); 61 93 94 95 int usb_hid_free_report_parser(usb_hid_report_parser_t *parser); 96 62 97 #endif 63 98 /** -
uspace/lib/usb/include/usb/classes/hidut.h
r9ee87f6 r7fc092a 27 27 */ 28 28 29 /** @addtogroup libusb usb29 /** @addtogroup libusb 30 30 * @{ 31 31 */ -
uspace/lib/usb/include/usb/classes/hidutkbd.h
r9ee87f6 r7fc092a 27 27 */ 28 28 29 /** @addtogroup libusb usb29 /** @addtogroup libusb 30 30 * @{ 31 31 */ -
uspace/lib/usb/include/usb/classes/hub.h
r9ee87f6 r7fc092a 27 27 */ 28 28 29 /** @addtogroup libusb usb29 /** @addtogroup libusb 30 30 * @{ 31 31 */ … … 68 68 * For more information see Universal Serial Bus Specification Revision 1.1 chapter 11.16.2 69 69 */ 70 typedef struct hub_descriptor_type{70 typedef struct usb_hub_descriptor_type { 71 71 /** Number of bytes in this descriptor, including this byte */ 72 72 //uint8_t bDescLength; -
uspace/lib/usb/include/usb/debug.h
r9ee87f6 r7fc092a 27 27 */ 28 28 29 /** @addtogroup libusb usb29 /** @addtogroup libusb 30 30 * @{ 31 31 */ … … 35 35 #ifndef LIBUSB_DEBUG_H_ 36 36 #define LIBUSB_DEBUG_H_ 37 #include <stdio.h> 38 #include <usb/usb.h> 37 39 38 40 void usb_dprintf(const char *tag, int level, const char *format, ...); 39 41 void usb_dprintf_enable(const char *tag, int level); 40 42 43 void usb_dump_standard_descriptor(FILE *, const char *, const char *, 44 const uint8_t *, size_t); 41 45 42 46 #endif 47 /** 48 * @} 49 */ 50 -
uspace/lib/usb/include/usb/descriptor.h
r9ee87f6 r7fc092a 27 27 */ 28 28 29 /** @addtogroup libusb usb29 /** @addtogroup libusb 30 30 * @{ 31 31 */ -
uspace/lib/usb/include/usb/devreq.h
r9ee87f6 r7fc092a 27 27 */ 28 28 29 /** @addtogroup libusb usb29 /** @addtogroup libusb 30 30 * @{ 31 31 */ -
uspace/lib/usb/include/usb/dp.h
r9ee87f6 r7fc092a 1 1 /* 2 * Copyright (c) 20 09 Lukas Mejdrech2 * Copyright (c) 2011 Vojtech Horky 3 3 * All rights reserved. 4 4 * … … 27 27 */ 28 28 29 /** @addtogroup arp29 /** @addtogroup libusb 30 30 * @{ 31 31 */ 32 /** @file 33 * @brief USB descriptor parser. 34 */ 35 #ifndef LIBUSB_DP_H_ 36 #define LIBUSB_DP_H_ 32 37 33 /** @file 34 * ARP module functions. 35 * The functions are used as ARP module entry points. 36 */ 38 #include <sys/types.h> 39 #include <usb/usb.h> 40 #include <usb/descriptor.h> 37 41 38 #ifndef NET_ARP_MODULE_H_ 39 #define NET_ARP_MODULE_H_ 42 typedef struct { 43 int child; 44 int parent; 45 } usb_dp_descriptor_nesting_t; 40 46 41 #include <ipc/ipc.h> 42 #include <async.h> 47 typedef struct { 48 usb_dp_descriptor_nesting_t *nesting; 49 } usb_dp_parser_t; 43 50 44 extern int arp_initialize(async_client_conn_t); 45 extern int arp_message_standalone(ipc_callid_t, ipc_call_t *, ipc_call_t *, 46 size_t *); 51 typedef struct { 52 uint8_t *data; 53 size_t size; 54 void *arg; 55 } usb_dp_parser_data_t; 56 57 uint8_t *usb_dp_get_nested_descriptor(usb_dp_parser_t *, 58 usb_dp_parser_data_t *, uint8_t *); 59 uint8_t *usb_dp_get_sibling_descriptor(usb_dp_parser_t *, 60 usb_dp_parser_data_t *, uint8_t *, uint8_t *); 47 61 48 62 #endif 49 50 /** @}63 /** 64 * @} 51 65 */ -
uspace/lib/usb/include/usb/hcd.h
-
Property mode
changed from
120000to100644
r9ee87f6 r7fc092a 1 addrkeep.h 1 /* 2 * Copyright (c) 2010 Vojtech Horky 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 9 * - Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * - Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * - The name of the author may not be used to endorse or promote products 15 * derived from this software without specific prior written permission. 16 * 17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 */ 28 29 /** @addtogroup libusb 30 * @{ 31 */ 32 /** @file 33 * @brief HC driver. 34 */ 35 #ifndef LIBUSB_HCD_H_ 36 #define LIBUSB_HCD_H_ 37 38 #include <usb/usb.h> 39 #include <fibril_synch.h> 40 #include <devman.h> 41 42 /** Info about used address. */ 43 typedef struct { 44 /** Linked list member. */ 45 link_t link; 46 /** Address. */ 47 usb_address_t address; 48 /** Corresponding devman handle. */ 49 devman_handle_t devman_handle; 50 } usb_address_keeping_used_t; 51 52 /** Structure for keeping track of free and used USB addresses. */ 53 typedef struct { 54 /** Head of list of used addresses. */ 55 link_t used_addresses; 56 /** Upper bound for USB addresses. */ 57 usb_address_t max_address; 58 /** Mutex protecting used address. */ 59 fibril_mutex_t used_addresses_guard; 60 /** Condition variable for used addresses. */ 61 fibril_condvar_t used_addresses_condvar; 62 63 /** Condition variable mutex for default address. */ 64 fibril_mutex_t default_condvar_guard; 65 /** Condition variable for default address. */ 66 fibril_condvar_t default_condvar; 67 /** Whether is default address available. */ 68 bool default_available; 69 } usb_address_keeping_t; 70 71 void usb_address_keeping_init(usb_address_keeping_t *, usb_address_t); 72 73 void usb_address_keeping_reserve_default(usb_address_keeping_t *); 74 void usb_address_keeping_release_default(usb_address_keeping_t *); 75 76 usb_address_t usb_address_keeping_request(usb_address_keeping_t *); 77 int usb_address_keeping_release(usb_address_keeping_t *, usb_address_t); 78 void usb_address_keeping_devman_bind(usb_address_keeping_t *, usb_address_t, 79 devman_handle_t); 80 usb_address_t usb_address_keeping_find(usb_address_keeping_t *, 81 devman_handle_t); 82 83 #endif 84 /** 85 * @} 86 */ -
Property mode
changed from
-
uspace/lib/usb/include/usb/hcdhubd.h
r9ee87f6 r7fc092a 27 27 */ 28 28 29 /** @addtogroup libusb usb29 /** @addtogroup libusb 30 30 * @{ 31 31 */ -
uspace/lib/usb/include/usb/usb.h
r9ee87f6 r7fc092a 27 27 */ 28 28 29 /** @addtogroup libusb usb29 /** @addtogroup libusb 30 30 * @{ 31 31 */ -
uspace/lib/usb/include/usb/usbdrv.h
r9ee87f6 r7fc092a 27 27 */ 28 28 29 /** @addtogroup libusb usb29 /** @addtogroup libusb 30 30 * @{ 31 31 */ -
uspace/lib/usb/include/usb/usbmem.h
r9ee87f6 r7fc092a 1 1 /* 2 * Copyright (c) 20 09 Lukas Mejdrech2 * Copyright (c) 2010 Matus Dekanek 3 3 * All rights reserved. 4 4 * … … 27 27 */ 28 28 29 /** @addtogroup arp 30 * @{ 29 #ifndef USBMEM_H 30 #define USBMEM_H 31 32 33 // group should be changed - this is not usb specific 34 /** @addtogroup usb 35 * @{ 31 36 */ 32 33 /** @file 34 * ARP protocol header. 35 * Based on the RFC 826. 37 /** @file definitions of special memory management, used mostly in usb stack 38 * 39 * USB HCD needs traslation between physical and virtual addresses. These 40 * functions implement such functionality. For each allocated virtual address 41 * the memory manager gets also it`s physical translation and remembers it. 42 * Addresses allocated byt this manager can be therefore translated from and to 43 * physical addresses. 44 * Typical use: 45 * void * address = mman_malloc(some_size); 46 * void * physical_address = mman_getPA(address); 47 * void * the_same_address = mman_getVA(physical_address); 48 * void * null_address = mman_getPA(non_existing_address); 49 * mman_free(address); 50 * // physical_address, adress and the_same_address are no longer valid here 51 * 52 * 53 * @note Addresses allocated by this memory manager should be as well 54 * deallocated byt it. 55 * 36 56 */ 37 38 #ifndef NET_ARP_HEADER_H_39 #define NET_ARP_HEADER_H_40 57 41 58 #include <sys/types.h> 42 59 43 /** Type definition of an ARP protocol header. 44 * @see arp_header 45 */ 46 typedef struct arp_header arp_header_t;60 extern void * mman_malloc( 61 size_t size, 62 size_t alignment, 63 unsigned long max_physical_address); 47 64 48 /** ARP protocol header. */ 49 struct arp_header { 50 /** 51 * Hardware type identifier. 52 * @see hardware.h 53 */ 54 uint16_t hardware; 55 56 /** Protocol identifier. */ 57 uint16_t protocol; 58 /** Hardware address length in bytes. */ 59 uint8_t hardware_length; 60 /** Protocol address length in bytes. */ 61 uint8_t protocol_length; 62 63 /** 64 * ARP packet type. 65 * @see arp_oc.h 66 */ 67 uint16_t operation; 68 } __attribute__ ((packed)); 65 extern void * mman_getVA(void * addr); 69 66 70 #endif 67 extern void * mman_getPA(void * addr); 68 69 extern void mman_free(void * addr); 70 71 72 73 74 71 75 72 76 /** @} 73 77 */ 78 79 80 #endif /* USBMEM_H */ 81 -
uspace/lib/usb/src/addrkeep.c
r9ee87f6 r7fc092a 27 27 */ 28 28 29 /** @addtogroup libusb usb29 /** @addtogroup libusb 30 30 * @{ 31 31 */ -
uspace/lib/usb/src/class.c
r9ee87f6 r7fc092a 27 27 */ 28 28 29 /** @addtogroup libusb usb29 /** @addtogroup libusb 30 30 * @{ 31 31 */ -
uspace/lib/usb/src/debug.c
r9ee87f6 r7fc092a 27 27 */ 28 28 29 /** @addtogroup libusb usb29 /** @addtogroup libusb 30 30 * @{ 31 31 */ -
uspace/lib/usb/src/drvpsync.c
r9ee87f6 r7fc092a 27 27 */ 28 28 29 /** @addtogroup libusb usb29 /** @addtogroup libusb 30 30 * @{ 31 31 */ -
uspace/lib/usb/src/hcdhubd.c
r9ee87f6 r7fc092a 27 27 */ 28 28 29 /** @addtogroup libusb usb29 /** @addtogroup libusb 30 30 * @{ 31 31 */ -
uspace/lib/usb/src/hcdhubd_private.h
r9ee87f6 r7fc092a 27 27 */ 28 28 29 /** @addtogroup libusb usb29 /** @addtogroup libusb 30 30 * @{ 31 31 */ -
uspace/lib/usb/src/hcdrv.c
r9ee87f6 r7fc092a 27 27 */ 28 28 29 /** @addtogroup libusb usb29 /** @addtogroup libusb 30 30 * @{ 31 31 */ -
uspace/lib/usb/src/hidparser.c
r9ee87f6 r7fc092a 27 27 */ 28 28 29 /** @addtogroup libusb usb29 /** @addtogroup libusb 30 30 * @{ 31 31 */ … … 40 40 * @param parser Opaque HID report parser structure. 41 41 * @param data Data describing the report. 42 * @param size Size of the descriptor in bytes.43 42 * @return Error code. 44 43 */ … … 55 54 * @param parser Opaque HID report parser structure. 56 55 * @param data Data for the report. 57 * @param size Size of the data in bytes.58 56 * @param callbacks Callbacks for report actions. 59 57 * @param arg Custom argument (passed through to the callbacks). … … 66 64 int i; 67 65 68 // TODO: parse report 66 /* main parsing loop */ 67 while(0){ 68 } 69 69 70 uint16_t keys[6]; 70 71 uint8_t keys[6]; 71 72 72 73 for (i = 0; i < 6; ++i) { … … 74 75 } 75 76 76 callbacks->keyboard(keys, 6, arg); 77 77 callbacks->keyboard(keys, 6, 0, arg); 78 79 return EOK; 80 } 81 82 /** Free the HID report parser structure 83 * 84 * @param parser Opaque HID report parser structure 85 * @return Error code 86 */ 87 int usb_hid_free_report_parser(usb_hid_report_parser_t *parser) 88 { 89 78 90 return EOK; 79 91 } … … 81 93 82 94 /** 95 * Parse input report. 96 * 97 * @param data Data for report 98 * @param size Size of report 99 * @param callbacks Callbacks for report actions 100 * @param arg Custom arguments 101 * 102 * @return Error code 103 */ 104 int usb_hid_boot_keyboard_input_report(const uint8_t *data, size_t size, 105 const usb_hid_report_in_callbacks_t *callbacks, void *arg) 106 { 107 int i; 108 usb_hid_report_item_t item; 109 110 /* fill item due to the boot protocol report descriptor */ 111 // modifier keys are in the first byte 112 uint8_t modifiers = data[0]; 113 114 item.offset = 2; /* second byte is reserved */ 115 item.size = 8; 116 item.count = 6; 117 item.usage_min = 0; 118 item.usage_max = 255; 119 item.logical_min = 0; 120 item.logical_max = 255; 121 122 if(size != 8){ 123 return -1; 124 } 125 126 uint8_t keys[6]; 127 for(i=item.offset; i<item.count; i++) { 128 keys[i-2] = data[i]; 129 } 130 131 callbacks->keyboard(keys, 6, modifiers, arg); 132 return EOK; 133 } 134 135 /** 136 * Makes output report for keyboard boot protocol 137 * 138 * @param leds 139 * @param output Output report data buffer 140 * @param size Size of the output buffer 141 * @return Error code 142 */ 143 int usb_hid_boot_keyboard_output_report(uint8_t leds, uint8_t *data, size_t size) 144 { 145 if(size != 1){ 146 return -1; 147 } 148 149 /* used only first five bits, others are only padding*/ 150 *data = leds; 151 return EOK; 152 } 153 154 /** 83 155 * @} 84 156 */ -
uspace/lib/usb/src/localdrv.c
r9ee87f6 r7fc092a 27 27 */ 28 28 29 /** @addtogroup libusb usb29 /** @addtogroup libusb 30 30 * @{ 31 31 */ -
uspace/lib/usb/src/recognise.c
r9ee87f6 r7fc092a 27 27 */ 28 28 29 /** @addtogroup libusb usb29 /** @addtogroup libusb 30 30 * @{ 31 31 */ … … 39 39 #include <errno.h> 40 40 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 */ 41 47 static int usb_iface_get_hc_handle(device_t *dev, devman_handle_t *handle) 42 48 { … … 203 209 uint8_t cur_descr_len = current_descriptor[0]; 204 210 uint8_t cur_descr_type = current_descriptor[1]; 211 212 if (cur_descr_len == 0) { 213 return ENOENT; 214 } 205 215 206 216 position += cur_descr_len; … … 233 243 * @param matches Match ids list to add matches to. 234 244 * @param address USB address of the attached device. 245 * @param config_count Number of configurations the device has. 235 246 * @return Error code. 236 247 */ … … 338 349 /** Probe for device kind and register it in devman. 339 350 * 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. 343 355 * @return Error code. 344 356 */ … … 346 358 usb_address_t address, devman_handle_t *child_handle) 347 359 { 360 static size_t device_name_index = 0; 361 348 362 device_t *child = NULL; 349 363 char *child_name = NULL; … … 357 371 358 372 /* 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); 362 377 if (rc < 0) { 363 378 goto failure; … … 381 396 } 382 397 398 device_name_index++; 399 383 400 return EOK; 384 401 -
uspace/lib/usb/src/remotedrv.c
r9ee87f6 r7fc092a 27 27 */ 28 28 29 /** @addtogroup libusb usb29 /** @addtogroup libusb 30 30 * @{ 31 31 */ -
uspace/lib/usb/src/usb.c
r9ee87f6 r7fc092a 27 27 */ 28 28 29 /** @addtogroup libusb usb29 /** @addtogroup libusb 30 30 * @{ 31 31 */ -
uspace/lib/usb/src/usbdrv.c
r9ee87f6 r7fc092a 27 27 */ 28 28 29 /** @addtogroup libusb usb29 /** @addtogroup libusb 30 30 * @{ 31 31 */ -
uspace/lib/usb/src/usbdrvreq.c
r9ee87f6 r7fc092a 27 27 */ 28 28 29 /** @addtogroup libusb usb29 /** @addtogroup libusb 30 30 * @{ 31 31 */ … … 60 60 #define PREPARE_SETUP_PACKET(name, p_direction, p_type, p_recipient, \ 61 61 p_request, p_value, p_index, p_length) \ 62 usb_device_request_setup_packet_t setup_packet= { \62 usb_device_request_setup_packet_t name = { \ 63 63 .request_type = \ 64 64 ((p_direction) == USB_DIRECTION_IN ? 128 : 0) \ … … 188 188 * @param[in] phone Open phone to HC driver. 189 189 * @param[in] old_address Current address. 190 * @param[in] address Address to be set.190 * @param[in] new_address Address to be set. 191 191 * @return Error code. 192 192 */
Note:
See TracChangeset
for help on using the changeset viewer.
