#define pr_fmt(fmt) …
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/list.h>
#include <linux/mm.h>
#include <linux/spinlock.h>
#include <asm/unaligned.h>
#include <asm/byteorder.h>
#include <linux/input.h>
#include <linux/wait.h>
#include <linux/vmalloc.h>
#include <linux/sched.h>
#include <linux/semaphore.h>
#include <linux/hid.h>
#include <linux/hiddev.h>
#include <linux/hid-debug.h>
#include <linux/hidraw.h>
#include "hid-ids.h"
#define DRIVER_DESC …
static int hid_ignore_special_drivers = …;
module_param_named(ignore_special_drivers, hid_ignore_special_drivers, int, 0600);
MODULE_PARM_DESC(…) …;
struct hid_report *hid_register_report(struct hid_device *device,
enum hid_report_type type, unsigned int id,
unsigned int application)
{ … }
EXPORT_SYMBOL_GPL(…);
static struct hid_field *hid_register_field(struct hid_report *report, unsigned usages)
{ … }
static int open_collection(struct hid_parser *parser, unsigned type)
{ … }
static int close_collection(struct hid_parser *parser)
{ … }
static unsigned hid_lookup_collection(struct hid_parser *parser, unsigned type)
{ … }
static void complete_usage(struct hid_parser *parser, unsigned int index)
{ … }
static int hid_add_usage(struct hid_parser *parser, unsigned usage, u8 size)
{ … }
static int hid_add_field(struct hid_parser *parser, unsigned report_type, unsigned flags)
{ … }
static u32 item_udata(struct hid_item *item)
{ … }
static s32 item_sdata(struct hid_item *item)
{ … }
static int hid_parser_global(struct hid_parser *parser, struct hid_item *item)
{ … }
static int hid_parser_local(struct hid_parser *parser, struct hid_item *item)
{ … }
static void hid_concatenate_last_usage_page(struct hid_parser *parser)
{ … }
static int hid_parser_main(struct hid_parser *parser, struct hid_item *item)
{ … }
static int hid_parser_reserved(struct hid_parser *parser, struct hid_item *item)
{ … }
static void hid_free_report(struct hid_report *report)
{ … }
static void hid_close_report(struct hid_device *device)
{ … }
void hiddev_free(struct kref *ref)
{ … }
static void hid_device_release(struct device *dev)
{ … }
static u8 *fetch_item(__u8 *start, __u8 *end, struct hid_item *item)
{ … }
static void hid_scan_input_usage(struct hid_parser *parser, u32 usage)
{ … }
static void hid_scan_feature_usage(struct hid_parser *parser, u32 usage)
{ … }
static void hid_scan_collection(struct hid_parser *parser, unsigned type)
{ … }
static int hid_scan_main(struct hid_parser *parser, struct hid_item *item)
{ … }
static int hid_scan_report(struct hid_device *hid)
{ … }
int hid_parse_report(struct hid_device *hid, __u8 *start, unsigned size)
{ … }
EXPORT_SYMBOL_GPL(…);
static const char * const hid_report_names[] = …;
struct hid_report *hid_validate_values(struct hid_device *hid,
enum hid_report_type type, unsigned int id,
unsigned int field_index,
unsigned int report_counts)
{ … }
EXPORT_SYMBOL_GPL(…);
static int hid_calculate_multiplier(struct hid_device *hid,
struct hid_field *multiplier)
{ … }
static void hid_apply_multiplier_to_field(struct hid_device *hid,
struct hid_field *field,
struct hid_collection *multiplier_collection,
int effective_multiplier)
{ … }
static void hid_apply_multiplier(struct hid_device *hid,
struct hid_field *multiplier)
{ … }
void hid_setup_resolution_multiplier(struct hid_device *hid)
{ … }
EXPORT_SYMBOL_GPL(…);
int hid_open_report(struct hid_device *device)
{ … }
EXPORT_SYMBOL_GPL(…);
static s32 snto32(__u32 value, unsigned n)
{ … }
s32 hid_snto32(__u32 value, unsigned n)
{ … }
EXPORT_SYMBOL_GPL(…);
static u32 s32ton(__s32 value, unsigned n)
{ … }
static u32 __extract(u8 *report, unsigned offset, int n)
{ … }
u32 hid_field_extract(const struct hid_device *hid, u8 *report,
unsigned offset, unsigned n)
{ … }
EXPORT_SYMBOL_GPL(…);
static void __implement(u8 *report, unsigned offset, int n, u32 value)
{ … }
static void implement(const struct hid_device *hid, u8 *report,
unsigned offset, unsigned n, u32 value)
{ … }
static int search(__s32 *array, __s32 value, unsigned n)
{ … }
static int hid_match_report(struct hid_device *hid, struct hid_report *report)
{ … }
static int hid_match_usage(struct hid_device *hid, struct hid_usage *usage)
{ … }
static void hid_process_event(struct hid_device *hid, struct hid_field *field,
struct hid_usage *usage, __s32 value, int interrupt)
{ … }
static inline int hid_array_value_is_valid(struct hid_field *field,
__s32 value)
{ … }
static void hid_input_fetch_field(struct hid_device *hid,
struct hid_field *field,
__u8 *data)
{ … }
static void hid_input_var_field(struct hid_device *hid,
struct hid_field *field,
int interrupt)
{ … }
static void hid_input_array_field(struct hid_device *hid,
struct hid_field *field,
int interrupt)
{ … }
static void hid_process_report(struct hid_device *hid,
struct hid_report *report,
__u8 *data,
int interrupt)
{ … }
static void __hid_insert_field_entry(struct hid_device *hid,
struct hid_report *report,
struct hid_field_entry *entry,
struct hid_field *field,
unsigned int usage_index)
{ … }
static void hid_report_process_ordering(struct hid_device *hid,
struct hid_report *report)
{ … }
static void hid_process_ordering(struct hid_device *hid)
{ … }
static void hid_output_field(const struct hid_device *hid,
struct hid_field *field, __u8 *data)
{ … }
static size_t hid_compute_report_size(struct hid_report *report)
{ … }
void hid_output_report(struct hid_report *report, __u8 *data)
{ … }
EXPORT_SYMBOL_GPL(…);
u8 *hid_alloc_report_buf(struct hid_report *report, gfp_t flags)
{ … }
EXPORT_SYMBOL_GPL(…);
int hid_set_field(struct hid_field *field, unsigned offset, __s32 value)
{ … }
EXPORT_SYMBOL_GPL(…);
static struct hid_report *hid_get_report(struct hid_report_enum *report_enum,
const u8 *data)
{ … }
int __hid_request(struct hid_device *hid, struct hid_report *report,
enum hid_class_request reqtype)
{ … }
EXPORT_SYMBOL_GPL(…);
int hid_report_raw_event(struct hid_device *hid, enum hid_report_type type, u8 *data, u32 size,
int interrupt)
{ … }
EXPORT_SYMBOL_GPL(…);
static int __hid_input_report(struct hid_device *hid, enum hid_report_type type,
u8 *data, u32 size, int interrupt, u64 source, bool from_bpf,
bool lock_already_taken)
{ … }
int hid_input_report(struct hid_device *hid, enum hid_report_type type, u8 *data, u32 size,
int interrupt)
{ … }
EXPORT_SYMBOL_GPL(…);
bool hid_match_one_id(const struct hid_device *hdev,
const struct hid_device_id *id)
{ … }
const struct hid_device_id *hid_match_id(const struct hid_device *hdev,
const struct hid_device_id *id)
{ … }
EXPORT_SYMBOL_GPL(…);
static const struct hid_device_id hid_hiddev_list[] = …;
static bool hid_hiddev(struct hid_device *hdev)
{ … }
static ssize_t
read_report_descriptor(struct file *filp, struct kobject *kobj,
struct bin_attribute *attr,
char *buf, loff_t off, size_t count)
{ … }
static ssize_t
show_country(struct device *dev, struct device_attribute *attr,
char *buf)
{ … }
static struct bin_attribute dev_bin_attr_report_desc = …;
static const struct device_attribute dev_attr_country = …;
int hid_connect(struct hid_device *hdev, unsigned int connect_mask)
{ … }
EXPORT_SYMBOL_GPL(…);
void hid_disconnect(struct hid_device *hdev)
{ … }
EXPORT_SYMBOL_GPL(…);
int hid_hw_start(struct hid_device *hdev, unsigned int connect_mask)
{ … }
EXPORT_SYMBOL_GPL(…);
void hid_hw_stop(struct hid_device *hdev)
{ … }
EXPORT_SYMBOL_GPL(…);
int hid_hw_open(struct hid_device *hdev)
{ … }
EXPORT_SYMBOL_GPL(…);
void hid_hw_close(struct hid_device *hdev)
{ … }
EXPORT_SYMBOL_GPL(…);
void hid_hw_request(struct hid_device *hdev,
struct hid_report *report, enum hid_class_request reqtype)
{ … }
EXPORT_SYMBOL_GPL(…);
int __hid_hw_raw_request(struct hid_device *hdev,
unsigned char reportnum, __u8 *buf,
size_t len, enum hid_report_type rtype,
enum hid_class_request reqtype,
u64 source, bool from_bpf)
{ … }
int hid_hw_raw_request(struct hid_device *hdev,
unsigned char reportnum, __u8 *buf,
size_t len, enum hid_report_type rtype, enum hid_class_request reqtype)
{ … }
EXPORT_SYMBOL_GPL(…);
int __hid_hw_output_report(struct hid_device *hdev, __u8 *buf, size_t len, u64 source,
bool from_bpf)
{ … }
int hid_hw_output_report(struct hid_device *hdev, __u8 *buf, size_t len)
{ … }
EXPORT_SYMBOL_GPL(…);
#ifdef CONFIG_PM
int hid_driver_suspend(struct hid_device *hdev, pm_message_t state)
{ … }
EXPORT_SYMBOL_GPL(…);
int hid_driver_reset_resume(struct hid_device *hdev)
{ … }
EXPORT_SYMBOL_GPL(…);
int hid_driver_resume(struct hid_device *hdev)
{ … }
EXPORT_SYMBOL_GPL(…);
#endif
struct hid_dynid { … };
static ssize_t new_id_store(struct device_driver *drv, const char *buf,
size_t count)
{ … }
static DRIVER_ATTR_WO(new_id);
static struct attribute *hid_drv_attrs[] = …;
ATTRIBUTE_GROUPS(…);
static void hid_free_dynids(struct hid_driver *hdrv)
{ … }
const struct hid_device_id *hid_match_device(struct hid_device *hdev,
struct hid_driver *hdrv)
{ … }
EXPORT_SYMBOL_GPL(…);
static int hid_bus_match(struct device *dev, const struct device_driver *drv)
{ … }
bool hid_compare_device_paths(struct hid_device *hdev_a,
struct hid_device *hdev_b, char separator)
{ … }
EXPORT_SYMBOL_GPL(…);
static bool hid_check_device_match(struct hid_device *hdev,
struct hid_driver *hdrv,
const struct hid_device_id **id)
{ … }
static int __hid_device_probe(struct hid_device *hdev, struct hid_driver *hdrv)
{ … }
static int hid_device_probe(struct device *dev)
{ … }
static void hid_device_remove(struct device *dev)
{ … }
static ssize_t modalias_show(struct device *dev, struct device_attribute *a,
char *buf)
{ … }
static DEVICE_ATTR_RO(modalias);
static struct attribute *hid_dev_attrs[] = …;
static struct bin_attribute *hid_dev_bin_attrs[] = …;
static const struct attribute_group hid_dev_group = …;
__ATTRIBUTE_GROUPS(…);
static int hid_uevent(const struct device *dev, struct kobj_uevent_env *env)
{ … }
const struct bus_type hid_bus_type = …;
EXPORT_SYMBOL(…);
int hid_add_device(struct hid_device *hdev)
{ … }
EXPORT_SYMBOL_GPL(…);
struct hid_device *hid_allocate_device(void)
{ … }
EXPORT_SYMBOL_GPL(…);
static void hid_remove_device(struct hid_device *hdev)
{ … }
void hid_destroy_device(struct hid_device *hdev)
{ … }
EXPORT_SYMBOL_GPL(…);
static int __hid_bus_reprobe_drivers(struct device *dev, void *data)
{ … }
static int __hid_bus_driver_added(struct device_driver *drv, void *data)
{ … }
static int __bus_removed_driver(struct device_driver *drv, void *data)
{ … }
int __hid_register_driver(struct hid_driver *hdrv, struct module *owner,
const char *mod_name)
{ … }
EXPORT_SYMBOL_GPL(…);
void hid_unregister_driver(struct hid_driver *hdrv)
{ … }
EXPORT_SYMBOL_GPL(…);
int hid_check_keys_pressed(struct hid_device *hid)
{ … }
EXPORT_SYMBOL_GPL(…);
#ifdef CONFIG_HID_BPF
static struct hid_ops __hid_ops = …;
#endif
static int __init hid_init(void)
{ … }
static void __exit hid_exit(void)
{ … }
module_init(…) …;
module_exit(hid_exit);
MODULE_AUTHOR(…) …;
MODULE_AUTHOR(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;