|
FreeBSD kernel usb device Code
|
#include <sys/stdint.h>#include <sys/stddef.h>#include <sys/param.h>#include <sys/queue.h>#include <sys/types.h>#include <sys/systm.h>#include <sys/kernel.h>#include <sys/bus.h>#include <sys/module.h>#include <sys/lock.h>#include <sys/mutex.h>#include <sys/condvar.h>#include <sys/sysctl.h>#include <sys/sx.h>#include <sys/unistd.h>#include <sys/callout.h>#include <sys/malloc.h>#include <sys/priv.h>#include <dev/usb/usb.h>#include <dev/usb/usbdi.h>#include <dev/usb/usbdi_util.h>#include <dev/usb/usbhid.h>#include <dev/usb/usb_core.h>#include <dev/usb/usb_debug.h>#include <dev/usb/usb_process.h>#include <dev/usb/usb_device.h>#include <dev/usb/usb_request.h>
Go to the source code of this file.
Data Structures | |
| struct | hid_pos_data |
| struct | hid_data |
Macros | |
| #define | USB_DEBUG_VAR usb_debug |
| #define | MAXUSAGE 64 |
| #define | MAXPUSH 4 |
| #define | MAXID 16 |
Functions | |
| static void | hid_clear_local (struct hid_item *) |
| static uint8_t | hid_get_byte (struct hid_data *s, const uint16_t wSize) |
| static void | hid_switch_rid (struct hid_data *s, struct hid_item *c, int32_t next_rID) |
| struct hid_data * | hid_start_parse (const void *d, usb_size_t len, int kindset) |
| void | hid_end_parse (struct hid_data *s) |
| int | hid_get_item (struct hid_data *s, struct hid_item *h) |
| int | hid_report_size (const void *buf, usb_size_t len, enum hid_kind k, uint8_t *id) |
| int | hid_locate (const void *desc, usb_size_t size, int32_t u, enum hid_kind k, uint8_t index, struct hid_location *loc, uint32_t *flags, uint8_t *id) |
| static uint32_t | hid_get_data_sub (const uint8_t *buf, usb_size_t len, struct hid_location *loc, int is_signed) |
| int32_t | hid_get_data (const uint8_t *buf, usb_size_t len, struct hid_location *loc) |
| uint32_t | hid_get_data_unsigned (const uint8_t *buf, usb_size_t len, struct hid_location *loc) |
| void | hid_put_data_unsigned (uint8_t *buf, usb_size_t len, struct hid_location *loc, unsigned int value) |
| int | hid_is_collection (const void *desc, usb_size_t size, int32_t usage) |
| struct usb_hid_descriptor * | hid_get_descriptor_from_usb (struct usb_config_descriptor *cd, struct usb_interface_descriptor *id) |
| usb_error_t | usbd_req_get_hid_desc (struct usb_device *udev, struct mtx *mtx, void **descp, uint16_t *sizep, struct malloc_type *mem, uint8_t iface_index) |
| int | hid_is_mouse (const void *d_ptr, uint16_t d_len) |
| int | hid_is_keyboard (const void *d_ptr, uint16_t d_len) |
| #define MAXID 16 |
Definition at line 74 of file usb_hid.c.
Referenced by hid_switch_rid().
| #define MAXPUSH 4 |
Definition at line 73 of file usb_hid.c.
Referenced by hid_get_item().
| #define MAXUSAGE 64 |
Definition at line 72 of file usb_hid.c.
Referenced by hid_get_item().
|
static |
Definition at line 106 of file usb_hid.c.
References hid_location::count, hid_item::designator_index, hid_item::designator_maximum, hid_item::designator_minimum, hid_item::loc, hid_item::set_delimiter, hid_location::size, hid_item::string_index, hid_item::string_maximum, hid_item::string_minimum, hid_item::usage, hid_item::usage_maximum, and hid_item::usage_minimum.
Referenced by hid_get_item().

| void hid_end_parse | ( | struct hid_data * | s | ) |
Definition at line 200 of file usb_hid.c.
Referenced by hid_is_collection(), hid_is_mouse(), hid_locate(), and hid_report_size().

|
static |
Definition at line 212 of file usb_hid.c.
References hid_data::end, and hid_data::p.
Referenced by hid_get_item().

| int32_t hid_get_data | ( | const uint8_t * | buf, |
| usb_size_t | len, | ||
| struct hid_location * | loc | ||
| ) |
Definition at line 694 of file usb_hid.c.
References hid_get_data_sub().
Referenced by ukbd_intr_callback(), and ums_intr_callback().


|
static |
Definition at line 650 of file usb_hid.c.
References data, n, hid_location::pos, and hid_location::size.
Referenced by hid_get_data(), and hid_get_data_unsigned().

| uint32_t hid_get_data_unsigned | ( | const uint8_t * | buf, |
| usb_size_t | len, | ||
| struct hid_location * | loc | ||
| ) |
Definition at line 700 of file usb_hid.c.
References hid_get_data_sub().

|
read |
Definition at line 776 of file usb_hid.c.
References usb_descriptor::bDescriptorType, usb_descriptor::bLength, desc, UDESC_HID, UDESC_INTERFACE, usb_desc_foreach(), and USB_HID_DESCRIPTOR_SIZE.
Referenced by usbd_req_get_hid_desc().


Definition at line 242 of file usb_hid.c.
References hid_item::_usage_page, hid_item::collection, hid_item::collevel, hid_location::count, hid_data::cur, hid_item::designator_index, hid_item::designator_maximum, hid_item::designator_minimum, hid_data::end, hid_item::flags, hid_clear_local(), hid_collection, hid_endcollection, hid_feature, hid_get_byte(), hid_input, hid_output, hid_switch_rid(), HIO_VARIABLE, hid_data::icount, hid_data::iusage, hid_item::kind, hid_data::kindset, hid_item::loc, hid_data::loc_count, hid_data::loc_size, hid_item::logical_maximum, hid_item::logical_minimum, MAXPUSH, MAXUSAGE, hid_data::ncount, hid_data::nusage, hid_data::ousage, hid_data::p, hid_item::physical_maximum, hid_item::physical_minimum, hid_location::pos, hid_data::pushlevel, hid_item::set_delimiter, hid_location::size, hid_item::string_index, hid_item::string_maximum, hid_item::string_minimum, hid_data::susage, hid_item::unit, hid_item::unit_exponent, hid_item::usage, hid_data::usage_last, hid_item::usage_maximum, hid_item::usage_minimum, hid_data::usages_max, and hid_data::usages_min.
Referenced by hid_is_collection(), hid_is_mouse(), hid_locate(), and hid_report_size().


| int hid_is_collection | ( | const void * | desc, |
| usb_size_t | size, | ||
| int32_t | usage | ||
| ) |
Definition at line 746 of file usb_hid.c.
References hid_collection, hid_end_parse(), hid_get_item(), hid_input, hid_start_parse(), hid_item::kind, and hid_item::usage.
Referenced by hid_is_keyboard().


| int hid_is_keyboard | ( | const void * | d_ptr, |
| uint16_t | d_len | ||
| ) |
Definition at line 918 of file usb_hid.c.
References hid_is_collection(), HID_USAGE2, HUG_KEYBOARD, and HUP_GENERIC_DESKTOP.
Referenced by ukbd_probe().


| int hid_is_mouse | ( | const void * | d_ptr, |
| uint16_t | d_len | ||
| ) |
Definition at line 860 of file usb_hid.c.
References hid_item::collection, hid_item::flags, hid_collection, hid_end_parse(), hid_endcollection, hid_get_item(), hid_input, hid_start_parse(), HID_USAGE2, HIO_CONST, HIO_RELATIVE, HUG_MOUSE, HUG_X, HUG_Y, HUP_GENERIC_DESKTOP, hid_item::kind, and hid_item::usage.
Referenced by ukbd_probe(), and ums_probe().


| int hid_locate | ( | const void * | desc, |
| usb_size_t | size, | ||
| int32_t | u, | ||
| enum hid_kind | k, | ||
| uint8_t | index, | ||
| struct hid_location * | loc, | ||
| uint32_t * | flags, | ||
| uint8_t * | id | ||
| ) |
Definition at line 616 of file usb_hid.c.
References hid_item::flags, hid_end_parse(), hid_get_item(), hid_start_parse(), HIO_CONST, hid_item::kind, hid_item::loc, hid_item::report_ID, hid_location::size, and hid_item::usage.
Referenced by ukbd_parse_hid(), and ums_hid_parse().


| void hid_put_data_unsigned | ( | uint8_t * | buf, |
| usb_size_t | len, | ||
| struct hid_location * | loc, | ||
| unsigned int | value | ||
| ) |
Definition at line 709 of file usb_hid.c.
References data, n, hid_location::pos, and hid_location::size.
Referenced by ukbd_set_leds_callback().

| int hid_report_size | ( | const void * | buf, |
| usb_size_t | len, | ||
| enum hid_kind | k, | ||
| uint8_t * | id | ||
| ) |
Definition at line 563 of file usb_hid.c.
References hid_location::count, hid_end_parse(), hid_get_item(), hid_start_parse(), hid_item::kind, hid_item::loc, hid_location::pos, hid_item::report_ID, and hid_location::size.
Referenced by ucycom_attach(), uhid_attach(), ukbd_parse_hid(), and ums_attach().


|
read |
Definition at line 179 of file usb_hid.c.
References hid_data::end, hid_data::kindset, len, hid_data::p, and hid_data::start.
Referenced by hid_is_collection(), hid_is_mouse(), hid_locate(), and hid_report_size().

Definition at line 124 of file usb_hid.c.
References DPRINTF, hid_data::last_pos, hid_item::loc, MAXID, hid_pos_data::pos, hid_location::pos, hid_item::report_ID, and hid_pos_data::rid.
Referenced by hid_get_item().

| usb_error_t usbd_req_get_hid_desc | ( | struct usb_device * | udev, |
| struct mtx * | mtx, | ||
| void ** | descp, | ||
| uint16_t * | sizep, | ||
| struct malloc_type * | mem, | ||
| uint8_t | iface_index | ||
| ) |
Definition at line 807 of file usb_hid.c.
References usb_hid_descriptor::descrs, hid_get_descriptor_from_usb(), usb_interface::idesc, UGETW, USB_ERR_INVAL, USB_ERR_IOERROR, USB_ERR_NOMEM, USB_ERR_NORMAL_COMPLETION, usbd_get_config_descriptor(), usbd_get_iface(), usbd_req_get_report_descriptor(), and usb_hid_descriptor::wDescriptorLength.
Referenced by ucycom_attach(), uhid_attach(), ukbd_attach(), ukbd_probe(), ums_attach(), and ums_probe().

