USB library for HID devices
[USB]

Library for writing USB HID drivers. More...


Files

file  consumer.c
 UUSB multimedia key usage, to string mapping.
file  consumer.h
 USB multimedia key usage to string mapping.
file  core.h
 USB HID Usage Tables.
file  hid.h
 USB HID device related types.
file  hiddescriptor.c
 HID report descriptor and report data parser implementation.
file  hidiface.c
 Client functions for accessing USB HID interface (implementation).
file  hidparser.c
 USB HID report data parser implementation.
file  hidparser.h
 USB HID report descriptor and report data parser.
file  hidpath.c
 HID report descriptor and report data parser implementation.
file  hidreport.c
 USB HID keyboard device structure and API.
file  hidreport.h
 USB HID report parser initialization from descriptors.
file  iface.h
 Client functions for accessing USB HID interface.
file  kbdgen.h
 USB HID key codes.
file  led.h
 USB HID Usage Tables - LED page.
file  request.h
 HID class-specific requests.

Defines

#define __NONPRINT(name, usage_id)   USB_HIDUT_KBD_KEY(name, usage_id, 0, 0, 0, 0)
#define INSIDE_DELIMITER_SET   2
 Parser is in the set of local items.
#define OUTSIDE_DELIMITER_SET   0
 Second delimiter tag was read.
#define START_DELIMITER_SET   1
 First delimiter tag was read.
#define USB_HID_NEW_REPORT_ITEM   1
 The new report item flag.
#define USB_HID_NO_ACTION   2
 No special action after the report descriptor tag is processed should be done.
#define USB_HID_RESET_OFFSET   3
#define USB_HID_SAME_USAGE(usage1, usage2)   ((usage1 == usage2) || (usage1 == 0) || (usage2 == 0))
 Compares two usages if they are same or not or one of the usages is not set.
#define USB_HID_SAME_USAGE_PAGE(page1, page2)   ((page1 == page2) || (page1 == 0) || (page2 == 0))
 Compares two usage pages if they are same or not or one of them is not set.
#define USB_HID_UNKNOWN_TAG   -99
 Unknown tag was founded in report descriptor data.
#define USB_HIDUT_KBD_KEY(name, usage_id, letter, letter_caps, letter_mod1, letter_mod2)
 Declare keyboard key.

Enumerations

enum  usb_hid_iface_protocol_t
 USB/HID interface protocols.
enum  usb_hid_protocol_t
enum  usb_hid_request_t
 USB/HID device requests.
enum  usb_hid_subclass_t
 USB/HID subclass constants.
enum  usb_hid_usage_led_t
enum  usb_hidut_usage_consumer_t
enum  usb_hidut_usage_generic_desktop_t
 Usages for Generic Desktop Page.
enum  usb_hidut_usage_page_t
 USB/HID Usage Pages.

Functions

void usb_hid_descriptor_print (usb_hid_report_t *report)
 Prints content of given report descriptor in human readable format.
void usb_hid_descriptor_print_list (link_t *head)
 Prints content of given list of report items.
void usb_hid_free_report (usb_hid_report_t *report)
 Frees the HID report descriptor parser structure.
void usb_hid_free_report_list (link_t *head)
 Releases whole linked list of report items.
uint8_t usb_hid_get_next_report_id (usb_hid_report_t *report, uint8_t report_id, usb_hid_report_type_t type)
 Returns next report_id of report of specified type.
static int usb_hid_get_report_descriptor (usb_device_t *dev, uint8_t **report_desc, size_t *size)
int usb_hid_parse_report (const usb_hid_report_t *report, const uint8_t *data, size_t size, uint8_t *report_id)
 Parse and act upon a HID report.
int usb_hid_parse_report_descriptor (usb_hid_report_t *report, const uint8_t *data, size_t size)
 Parse HID report descriptor.
void usb_hid_print_usage_path (usb_hid_report_path_t *path)
int usb_hid_process_report_descriptor (usb_device_t *dev, usb_hid_report_t *report, uint8_t **report_desc, size_t *report_size)
 Retrieves the Report descriptor from the USB device and initializes the report parser.
int usb_hid_report_append_fields (usb_hid_report_t *report, usb_hid_report_item_t *report_item)
size_t usb_hid_report_byte_size (usb_hid_report_t *report, uint8_t report_id, usb_hid_report_type_t type)
 Returns size of report of specified report id and type in bytes.
int usb_hid_report_compare_usage_path (usb_hid_report_path_t *report_path, usb_hid_report_path_t *path, int flags)
 Compares two usage paths structures.
usb_hid_report_description_tusb_hid_report_find_description (const usb_hid_report_t *report, uint8_t report_id, usb_hid_report_type_t type)
 Finds description of report with given report_id and of given type in opaque report structure.
usb_hid_report_field_tusb_hid_report_get_sibling (usb_hid_report_t *report, usb_hid_report_field_t *field, usb_hid_report_path_t *path, int flags, usb_hid_report_type_t type)
 Function for sequence walking through the report.
int usb_hid_report_init (usb_hid_report_t *report)
 Initialize the report descriptor parser structure.
usb_hid_report_item_tusb_hid_report_item_clone (const usb_hid_report_item_t *item)
 Clones given state table.
void usb_hid_report_null_last_item (usb_hid_report_path_t *usage_path)
 Nulls last item of the usage path structure.
uint8_t * usb_hid_report_output (usb_hid_report_t *report, size_t *size, uint8_t report_id)
 Allocates output report buffer for output report.
void usb_hid_report_output_free (uint8_t *output)
 Frees output report buffer.
int usb_hid_report_output_translate (usb_hid_report_t *report, uint8_t report_id, uint8_t *buffer, size_t size)
 Makes the output report buffer for data given in the report structure.
int usb_hid_report_parse_global_tag (uint8_t tag, const uint8_t *data, size_t item_size, usb_hid_report_item_t *report_item, usb_hid_report_path_t *usage_path)
 Parse global tags of report descriptor.
int usb_hid_report_parse_local_tag (uint8_t tag, const uint8_t *data, size_t item_size, usb_hid_report_item_t *report_item, usb_hid_report_path_t *usage_path)
 Parse local tags of report descriptor.
int usb_hid_report_parse_main_tag (uint8_t tag, const uint8_t *data, size_t item_size, usb_hid_report_item_t *report_item, usb_hid_report_path_t *usage_path)
 Parse main tags of report descriptor.
int usb_hid_report_parse_tag (uint8_t tag, uint8_t class, const uint8_t *data, size_t item_size, usb_hid_report_item_t *report_item, usb_hid_report_path_t *usage_path)
 Parse one tag of the report descriptor.
usb_hid_report_path_tusb_hid_report_path (void)
 Allocates and initializes new usage path structure.
int usb_hid_report_path_append_item (usb_hid_report_path_t *usage_path, int32_t usage_page, int32_t usage)
 Appends one item (couple of usage_path and usage) into the usage path structure.
usb_hid_report_path_tusb_hid_report_path_clone (usb_hid_report_path_t *usage_path)
 Clone content of given usage path to the new one.
void usb_hid_report_path_free (usb_hid_report_path_t *path)
 Releases given usage path structure.
int usb_hid_report_path_set_report_id (usb_hid_report_path_t *path, uint8_t report_id)
 Sets report id in usage path structure.
usb_hid_report_path_tusb_hid_report_path_try_insert (usb_hid_report_t *report, usb_hid_report_path_t *cmp_path)
 Checks if given collection path is already present in report structure and inserts it if not.
void usb_hid_report_remove_last_item (usb_hid_report_path_t *usage_path)
 Removes last item from the usage path structure.
void usb_hid_report_reset_local_items (usb_hid_report_item_t *report_item)
 Reset all local items in given state table.
void usb_hid_report_set_last_item (usb_hid_report_path_t *usage_path, int32_t tag, int32_t data)
 Modifies last item of usage path structure by given usage page or usage.
size_t usb_hid_report_size (usb_hid_report_t *report, uint8_t report_id, usb_hid_report_type_t type)
 Returns size of report of specified report id and type in items.
uint32_t usb_hid_report_tag_data_uint32 (const uint8_t *data, size_t size)
 Converts raw data to uint32 (thats the maximum length of short item data).
int usb_hid_translate_data (usb_hid_report_field_t *item, const uint8_t *data)
 Translate data from the report as specified in report descriptor item.
uint32_t usb_hid_translate_data_reverse (usb_hid_report_field_t *item, int value)
 Translate given data for putting them into the outoput report.
int usb_pow (int a, int b)
int usbhid_dev_get_event (int dev_phone, uint8_t *buf, size_t size, size_t *actual_size, int *event_nr, unsigned int flags)
 Request for next event from HID device.
int usbhid_dev_get_event_length (int dev_phone, size_t *size)
 Ask for event array length.
int usbhid_dev_get_report_descriptor (int, uint8_t *, size_t, size_t *)
int usbhid_dev_get_report_descriptor_length (int, size_t *)
const char * usbhid_multimedia_usage_to_str (int usage)
 Translates USB HID Usages from the Consumer Page into their string representation.
int usbhid_req_get_idle (usb_pipe_t *ctrl_pipe, int iface_no, uint8_t *duration)
 Send Get Idle request to the HID device.
int usbhid_req_get_protocol (usb_pipe_t *ctrl_pipe, int iface_no, usb_hid_protocol_t *protocol)
 Send Get Protocol request to the HID device.
int usbhid_req_get_report (usb_pipe_t *ctrl_pipe, int iface_no, usb_hid_report_type_t type, uint8_t *buffer, size_t buf_size, size_t *actual_size)
 Send Get Report request to the HID device.
int usbhid_req_set_idle (usb_pipe_t *ctrl_pipe, int iface_no, uint8_t duration)
 Send Set Idle request to the HID device.
int usbhid_req_set_protocol (usb_pipe_t *ctrl_pipe, int iface_no, usb_hid_protocol_t protocol)
 Send Set Protocol request to the HID device.
int usbhid_req_set_report (usb_pipe_t *ctrl_pipe, int iface_no, usb_hid_report_type_t type, uint8_t *buffer, size_t buf_size)
 Send Set Report request to the HID device.

Variables

 _
 B
 b
 D
 d
 F
 f
 H
 h
 J
 j
 L
 l
 N
 n
 P
 p
 R
 r
 t
 T
 t
static const char * usbhid_consumer_usage_str [0x29d]
 V
 v
 X
 x
 x05
 x07
 x09
 x0B
 x0D
 x0F
 x11
 x13
 x15
 x17
 x19
 x1B
 x1D
 x1F
 x21
 x23
 x25
 x27
 x29
 x2B
 x2D
 x2F
 x32
 x34
 x36
<', 0, 0) USB_HIDUT_KBD_KEY(PERIOD, 0x37,'.','> x39
 Z
 z

Detailed Description

Library for writing USB HID drivers.


Define Documentation

#define OUTSIDE_DELIMITER_SET   0

Second delimiter tag was read.

The set of local items (usage) ended.

Definition at line 51 of file hiddescriptor.c.

#define START_DELIMITER_SET   1

First delimiter tag was read.

The set of local items (usage) started.

Definition at line 56 of file hiddescriptor.c.

#define USB_HID_NEW_REPORT_ITEM   1

The new report item flag.

Used to determine when the item is completly configured and should be added to the report structure

Definition at line 68 of file hiddescriptor.c.

#define USB_HID_SAME_USAGE ( usage1,
usage2   )     ((usage1 == usage2) || (usage1 == 0) || (usage2 == 0))

Compares two usages if they are same or not or one of the usages is not set.

Parameters:
usage1 
usage2 
Returns:
boolean

Definition at line 52 of file hidpath.c.

#define USB_HID_SAME_USAGE_PAGE ( page1,
page2   )     ((page1 == page2) || (page1 == 0) || (page2 == 0))

Compares two usage pages if they are same or not or one of them is not set.

Parameters:
page1 
page2 
Returns:
boolean

Definition at line 62 of file hidpath.c.

#define USB_HIDUT_KBD_KEY ( name,
usage_id,
letter,
letter_caps,
letter_mod1,
letter_mod2   ) 

Declare keyboard key.

Parameters:
name Key name (identifier).
usage_id Key code (see Keyboard/Keypad Page (0x07) in HUT1.12.
letter Corresponding character (0 if not applicable).
letter_caps Corresponding character with Caps on.
letter_mod1 Corresponding character with modifier #1 on.
letter_mod2 Corresponding character with modifier #2 on.

Definition at line 66 of file kbdgen.h.


Function Documentation

void usb_hid_descriptor_print ( usb_hid_report_t report  ) 

Prints content of given report descriptor in human readable format.

Parameters:
parser Parsed descriptor to print
Returns:
void

Definition at line 955 of file hiddescriptor.c.

void usb_hid_descriptor_print_list ( link_t head  ) 

Prints content of given list of report items.

Parameters:
List of report items (usb_hid_report_item_t)
Returns:
void

Definition at line 903 of file hiddescriptor.c.

void usb_hid_free_report ( usb_hid_report_t report  ) 

Frees the HID report descriptor parser structure.

Parameters:
parser Opaque HID report parser structure
Returns:
void

Definition at line 1025 of file hiddescriptor.c.

void usb_hid_free_report_list ( link_t head  ) 

Releases whole linked list of report items.

Parameters:
head Head of list of report descriptor items (usb_hid_report_item_t)
Returns:
void

Definition at line 989 of file hiddescriptor.c.

uint8_t usb_hid_get_next_report_id ( usb_hid_report_t report,
uint8_t  report_id,
usb_hid_report_type_t  type 
)

Returns next report_id of report of specified type.

If zero is given than first report_id of specified type is returned (0 is not legal value for repotr_id)

Parameters:
report_id Current report_id, 0 if there is no current report_id
type Type of searched report
report Report structure inwhich we search
Return values:
0 if report structure is null or there is no specified report
report_id otherwise

Definition at line 596 of file hidparser.c.

int usb_hid_parse_report ( const usb_hid_report_t report,
const uint8_t *  data,
size_t  size,
uint8_t *  report_id 
)

Parse and act upon a HID report.

See also:
usb_hid_parse_report_descriptor
Parameters:
parser Opaque HID report parser structure.
data Data for the report.
Returns:
Error code.

Definition at line 134 of file hidparser.c.

int usb_hid_parse_report_descriptor ( usb_hid_report_t report,
const uint8_t *  data,
size_t  size 
)

Parse HID report descriptor.

Parameters:
parser Opaque HID report parser structure.
data Data describing the report.
Returns:
Error code.
Return values:
ENOMEM If no more memmory is available
EINVAL If invalid data are founded
EOK If report descriptor is successfully parsed

Definition at line 364 of file hiddescriptor.c.

int usb_hid_process_report_descriptor ( usb_device_t dev,
usb_hid_report_t report,
uint8_t **  report_desc,
size_t report_size 
)

Retrieves the Report descriptor from the USB device and initializes the report parser.

Parameters:
[in] dev USB device representing a HID device.
in/out] parser HID Report parser.
[out] report_desc Place to save report descriptor into.
[out] report_size 
Return values:
EOK if successful.
EINVAL if one of the parameters is not given (is NULL).
ENOENT if there are some descriptors missing.
ENOMEM if an error with allocation occured.
EINVAL if the Report descriptor's size does not match the size from the interface descriptor.
Returns:
Other value inherited from function usb_pipe_start_session(), usb_pipe_end_session() or usb_request_get_descriptor().

Definition at line 165 of file hidreport.c.

int usb_hid_report_append_fields ( usb_hid_report_t report,
usb_hid_report_item_t report_item 
)

Parameters:
report Report structure in which the new report items should be stored
report_item Current report descriptor's parsing state table
Returns:
Error code
Return values:
EOK If all fields were successfully append to report
EINVAL If invalid parameters (NULL) was given
ENOMEM If there is no memmory to store new report description

Definition at line 163 of file hiddescriptor.c.

size_t usb_hid_report_byte_size ( usb_hid_report_t report,
uint8_t  report_id,
usb_hid_report_type_t  type 
)

Returns size of report of specified report id and type in bytes.

Parameters:
parser Opaque report parser structure
report_id 
type 
Returns:
Number of items in specified report

Definition at line 107 of file hidparser.c.

int usb_hid_report_compare_usage_path ( usb_hid_report_path_t report_path,
usb_hid_report_path_t path,
int  flags 
)

Compares two usage paths structures.

Parameters:
report_path usage path structure to compare with
path usage patrh structure to compare
flags Flags determining the mode of comparison
Returns:
EOK if both paths are identical, non zero number otherwise

Definition at line 200 of file hidpath.c.

usb_hid_report_description_t* usb_hid_report_find_description ( const usb_hid_report_t report,
uint8_t  report_id,
usb_hid_report_type_t  type 
)

Finds description of report with given report_id and of given type in opaque report structure.

Parameters:
report Opaque structure containing the parsed report descriptor
report_id ReportId of report we are searching
type Type of report we are searching
Returns:
Pointer to the particular report description
Return values:
NULL If no description is founded

Definition at line 327 of file hiddescriptor.c.

usb_hid_report_field_t * usb_hid_report_get_sibling ( usb_hid_report_t report,
usb_hid_report_field_t field,
usb_hid_report_path_t path,
int  flags,
usb_hid_report_type_t  type 
)

Function for sequence walking through the report.

Returns next field in the report or the first one when no field is given.

Parameters:
report Searched report structure
field Current field. If NULL is given, the first one in the report is returned. Otherwise the next one i nthe list is returned.
path Usage path specifying which fields wa are interested in.
flags Flags defining mode of usage paths comparison
type Type of report we search.
Return values:
NULL if no field is founded
Pointer to the founded report structure when founded

Definition at line 538 of file hidparser.c.

int usb_hid_report_init ( usb_hid_report_t report  ) 

Initialize the report descriptor parser structure.

Parameters:
parser Report descriptor parser structure
Returns:
Error code
Return values:
EINVAL If no report structure was given
EOK If report structure was successfully initialized

Definition at line 135 of file hiddescriptor.c.

usb_hid_report_item_t* usb_hid_report_item_clone ( const usb_hid_report_item_t item  ) 

Clones given state table.

Parameters:
item State table to clone
Returns:
Pointer to the cloned item

Definition at line 510 of file hidparser.c.

void usb_hid_report_null_last_item ( usb_hid_report_path_t usage_path  ) 

Nulls last item of the usage path structure.

Parameters:
usage_path 
Returns:
void

Definition at line 120 of file hidpath.c.

uint8_t * usb_hid_report_output ( usb_hid_report_t report,
size_t size,
uint8_t  report_id 
)

Allocates output report buffer for output report.

Parameters:
parser Report parsed structure
size Size of returned buffer
report_id Report id of created output report
Returns:
Returns allocated output buffer for specified output

Definition at line 304 of file hidparser.c.

void usb_hid_report_output_free ( uint8_t *  output  ) 

Frees output report buffer.

Parameters:
output Output report buffer
Returns:
void

Definition at line 344 of file hidparser.c.

int usb_hid_report_output_translate ( usb_hid_report_t report,
uint8_t  report_id,
uint8_t *  buffer,
size_t  size 
)

Makes the output report buffer for data given in the report structure.

Parameters:
parser Opaque report parser structure
path Usage path specifing which parts of output will be set
flags Usage path structure comparison flags
buffer Output buffer
size Size of output buffer
Returns:
Error code

Definition at line 361 of file hidparser.c.

int usb_hid_report_parse_global_tag ( uint8_t  tag,
const uint8_t *  data,
size_t  item_size,
usb_hid_report_item_t report_item,
usb_hid_report_path_t usage_path 
)

Parse global tags of report descriptor.

Parameters:
Tag identifier
Data buffer
Length of data buffer
Current state table
Returns:
Error code

Definition at line 658 of file hiddescriptor.c.

int usb_hid_report_parse_local_tag ( uint8_t  tag,
const uint8_t *  data,
size_t  item_size,
usb_hid_report_item_t report_item,
usb_hid_report_path_t usage_path 
)

Parse local tags of report descriptor.

Parameters:
Tag identifier
Data buffer
Length of data buffer
Current state table
Returns:
Error code

Definition at line 744 of file hiddescriptor.c.

int usb_hid_report_parse_main_tag ( uint8_t  tag,
const uint8_t *  data,
size_t  item_size,
usb_hid_report_item_t report_item,
usb_hid_report_path_t usage_path 
)

Parse main tags of report descriptor.

Parameters:
Tag identifier
Data buffer
Length of data buffer
Current state table
Returns:
Error code

Definition at line 594 of file hiddescriptor.c.

int usb_hid_report_parse_tag ( uint8_t  tag,
uint8_t  class,
const uint8_t *  data,
size_t  item_size,
usb_hid_report_item_t report_item,
usb_hid_report_path_t usage_path 
)

Parse one tag of the report descriptor.

Parameters:
Tag to parse
Report descriptor buffer
Size of data belongs to this tag
Current report item structe
Returns:
Code of action to be done next

Definition at line 550 of file hiddescriptor.c.

usb_hid_report_path_t* usb_hid_report_path ( void   ) 

Allocates and initializes new usage path structure.

Returns:
Initialized usage path structure

Definition at line 365 of file hidpath.c.

int usb_hid_report_path_append_item ( usb_hid_report_path_t usage_path,
int32_t  usage_page,
int32_t  usage 
)

Appends one item (couple of usage_path and usage) into the usage path structure.

Parameters:
usage_path Usage path structure
usage_page Usage page constant
usage Usage constant
Returns:
Error code

Definition at line 75 of file hidpath.c.

usb_hid_report_path_t* usb_hid_report_path_clone ( usb_hid_report_path_t usage_path  ) 

Clone content of given usage path to the new one.

Parameters:
usage_path Usage path structure to clone
Returns:
New copy of given usage path structure

Definition at line 405 of file hidpath.c.

void usb_hid_report_path_free ( usb_hid_report_path_t path  ) 

Releases given usage path structure.

Parameters:
path usage path structure to release
Returns:
void

Definition at line 388 of file hidpath.c.

int usb_hid_report_path_set_report_id ( usb_hid_report_path_t path,
uint8_t  report_id 
)

Sets report id in usage path structure.

Parameters:
path Usage path structure
report_id Report id to set
Returns:
Error code

Definition at line 455 of file hidpath.c.

usb_hid_report_path_t* usb_hid_report_path_try_insert ( usb_hid_report_t report,
usb_hid_report_path_t cmp_path 
)

Checks if given collection path is already present in report structure and inserts it if not.

Parameters:
report Report structure
cmp_path The collection path
Returns:
Pointer to the result collection path in report structure.
Return values:
NULL If some error occurs

Definition at line 90 of file hiddescriptor.c.

void usb_hid_report_remove_last_item ( usb_hid_report_path_t usage_path  ) 

Removes last item from the usage path structure.

Parameters:
usage_path 
Returns:
void

Definition at line 100 of file hidpath.c.

void usb_hid_report_reset_local_items ( usb_hid_report_item_t report_item  ) 

Reset all local items in given state table.

Parameters:
report_item State table containing current state of report descriptor parsing
Returns:
void

Definition at line 643 of file hidparser.c.

void usb_hid_report_set_last_item ( usb_hid_report_path_t usage_path,
int32_t  tag,
int32_t  data 
)

Modifies last item of usage path structure by given usage page or usage.

Parameters:
usage_path Opaque usage path structure
tag Class of currently processed tag (Usage page tag falls into Global class but Usage tag into the Local)
data Value of the processed tag
Returns:
void

Definition at line 142 of file hidpath.c.

size_t usb_hid_report_size ( usb_hid_report_t report,
uint8_t  report_id,
usb_hid_report_type_t  type 
)

Returns size of report of specified report id and type in items.

Parameters:
parser Opaque report parser structure
report_id 
type 
Returns:
Number of items in specified report

Definition at line 82 of file hidparser.c.

uint32_t usb_hid_report_tag_data_uint32 ( const uint8_t *  data,
size_t  size 
)

Converts raw data to uint32 (thats the maximum length of short item data).

Parameters:
Data buffer
Size of buffer
Returns:
Converted int32 number

Definition at line 883 of file hiddescriptor.c.

int usb_hid_translate_data ( usb_hid_report_field_t item,
const uint8_t *  data 
)

Translate data from the report as specified in report descriptor item.

Parameters:
item Report descriptor item with definition of translation
data Data to translate
Returns:
Translated data

Definition at line 217 of file hidparser.c.

uint32_t usb_hid_translate_data_reverse ( usb_hid_report_field_t item,
int  value 
)

Translate given data for putting them into the outoput report.

Parameters:
item Report item structure
value Value to translate
Returns:
ranslated value

Definition at line 465 of file hidparser.c.

int usbhid_dev_get_event ( int  dev_phone,
uint8_t *  buf,
size_t  size,
size_t actual_size,
int *  event_nr,
unsigned int  flags 
)

Request for next event from HID device.

Parameters:
[in] dev_phone Opened phone to DDF device providing USB HID interface.
[out] usage_pages Where to store usage pages.
[out] usages Where to store usages (actual data).
[in] usage_count Length of usage_pages and usages buffer (in items, not bytes).
[out] actual_usage_count Number of usages actually returned by the device driver.
[in] flags Flags (see USBHID_IFACE_FLAG_*).
Returns:
Error code.

Definition at line 78 of file hidiface.c.

int usbhid_dev_get_event_length ( int  dev_phone,
size_t size 
)

Ask for event array length.

Parameters:
dev_phone Opened phone to DDF device providing USB HID interface.
Returns:
Number of usages returned or negative error code.

Definition at line 48 of file hidiface.c.

const char * usbhid_multimedia_usage_to_str ( int  usage  ) 

Translates USB HID Usages from the Consumer Page into their string representation.

Parameters:
usage USB HID Consumer Page Usage number.
Return values:
HelenOS key code corresponding to the given USB Consumer Page Usage.

Definition at line 719 of file consumer.c.

int usbhid_req_get_idle ( usb_pipe_t ctrl_pipe,
int  iface_no,
uint8_t *  duration 
)

Send Get Idle request to the HID device.

Parameters:
[in] hid_dev HID device to send the request to.
[out] duration Duration value (multiplicate by 4 to get real duration in miliseconds).
Return values:
EOK if successful.
EINVAL if no HID device is given.
Returns:
Other value inherited from one of functions usb_pipe_start_session(), usb_pipe_end_session(), usb_control_request_set().

Definition at line 326 of file hidreq.c.

int usbhid_req_get_protocol ( usb_pipe_t ctrl_pipe,
int  iface_no,
usb_hid_protocol_t protocol 
)

Send Get Protocol request to the HID device.

Parameters:
[in] hid_dev HID device to send the request to.
[out] protocol Current protocol of the device.
Return values:
EOK if successful.
EINVAL if no HID device is given.
Returns:
Other value inherited from function usb_control_request_set().

Definition at line 264 of file hidreq.c.

int usbhid_req_get_report ( usb_pipe_t ctrl_pipe,
int  iface_no,
usb_hid_report_type_t  type,
uint8_t *  buffer,
size_t  buf_size,
size_t actual_size 
)

Send Get Report request to the HID device.

Parameters:
[in] hid_dev HID device to send the request to.
[in] type Type of the report.
[in] out] buffer Buffer for the report data.
[in] buf_size Size of the buffer (in bytes).
[out] actual_size Actual size of report received from the device (in bytes).
Return values:
EOK if successful.
EINVAL if no HID device is given.
Returns:
Other value inherited from function usb_control_request_set().

Definition at line 212 of file hidreq.c.

int usbhid_req_set_idle ( usb_pipe_t ctrl_pipe,
int  iface_no,
uint8_t  duration 
)

Send Set Idle request to the HID device.

Parameters:
hid_dev HID device to send the request to.
duration Duration value (is multiplicated by 4 by the device to get real duration in miliseconds).
Return values:
EOK if successful.
EINVAL if no HID device is given.
Returns:
Other value inherited from function usb_control_request_set().

Definition at line 159 of file hidreq.c.

int usbhid_req_set_protocol ( usb_pipe_t ctrl_pipe,
int  iface_no,
usb_hid_protocol_t  protocol 
)

Send Set Protocol request to the HID device.

Parameters:
hid_dev HID device to send the request to.
protocol Protocol to set.
Return values:
EOK if successful.
EINVAL if no HID device is given.
Returns:
Other value inherited from function usb_control_request_set().

Definition at line 110 of file hidreq.c.

int usbhid_req_set_report ( usb_pipe_t ctrl_pipe,
int  iface_no,
usb_hid_report_type_t  type,
uint8_t *  buffer,
size_t  buf_size 
)

Send Set Report request to the HID device.

Parameters:
hid_dev HID device to send the request to.
type Type of the report.
buffer Report data.
buf_size Report data size (in bytes).
Return values:
EOK if successful.
EINVAL if no HID device is given.
Returns:
Other value inherited from function usb_control_request_set().

Definition at line 60 of file hidreq.c.


Generated on Thu Jun 2 07:45:56 2011 for HelenOS/USB by  doxygen 1.4.7