#include <linux/ctype.h>
#include <linux/dmi.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/miscdevice.h>
#include <linux/kfifo.h>
#include <linux/sched.h>
#include <linux/wait.h>
#include <linux/poll.h>
#include <linux/bsearch.h>
#include <linux/platform_device.h>
#include <linux/hid-sensor-hub.h>
#define HID_CUSTOM_NAME_LENGTH …
#define HID_CUSTOM_MAX_CORE_ATTRS …
#define HID_CUSTOM_TOTAL_ATTRS …
#define HID_CUSTOM_FIFO_SIZE …
#define HID_CUSTOM_MAX_FEATURE_BYTES …
#define HID_SENSOR_USAGE_LENGTH …
struct hid_sensor_custom_field { … };
struct hid_sensor_custom { … };
struct hid_sensor_sample { … } __packed;
static struct attribute hid_custom_attrs[HID_CUSTOM_TOTAL_ATTRS] = …;
static const struct hid_custom_usage_desc { … } hid_custom_usage_desc_table[] = …;
static int usage_id_cmp(const void *p1, const void *p2)
{ … }
static ssize_t enable_sensor_show(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static int set_power_report_state(struct hid_sensor_custom *sensor_inst,
bool state)
{ … }
static ssize_t enable_sensor_store(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{ … }
static DEVICE_ATTR_RW(enable_sensor);
static struct attribute *enable_sensor_attrs[] = …;
static const struct attribute_group enable_sensor_attr_group = …;
static ssize_t show_value(struct device *dev, struct device_attribute *attr,
char *buf)
{ … }
static ssize_t store_value(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{ … }
static int hid_sensor_capture_sample(struct hid_sensor_hub_device *hsdev,
unsigned usage_id, size_t raw_len,
char *raw_data, void *priv)
{ … }
static int hid_sensor_send_event(struct hid_sensor_hub_device *hsdev,
unsigned usage_id, void *priv)
{ … }
static int hid_sensor_custom_add_field(struct hid_sensor_custom *sensor_inst,
int index, int report_type,
struct hid_report *report,
struct hid_field *field)
{ … }
static int hid_sensor_custom_add_fields(struct hid_sensor_custom *sensor_inst,
struct hid_report_enum *report_enum,
int report_type)
{ … }
static int hid_sensor_custom_add_attributes(struct hid_sensor_custom
*sensor_inst)
{ … }
static void hid_sensor_custom_remove_attributes(struct hid_sensor_custom *
sensor_inst)
{ … }
static ssize_t hid_sensor_custom_read(struct file *file, char __user *buf,
size_t count, loff_t *f_ps)
{ … }
static int hid_sensor_custom_release(struct inode *inode, struct file *file)
{ … }
static int hid_sensor_custom_open(struct inode *inode, struct file *file)
{ … }
static __poll_t hid_sensor_custom_poll(struct file *file,
struct poll_table_struct *wait)
{ … }
static const struct file_operations hid_sensor_custom_fops = …;
static int hid_sensor_custom_dev_if_add(struct hid_sensor_custom *sensor_inst)
{ … }
static void hid_sensor_custom_dev_if_remove(struct hid_sensor_custom
*sensor_inst)
{ … }
struct hid_sensor_custom_match { … };
struct hid_sensor_custom_properties { … };
static const struct hid_sensor_custom_match hid_sensor_custom_known_table[] = …;
static bool hid_sensor_custom_prop_match_str(const u16 *prop, const char *match,
size_t count)
{ … }
static int hid_sensor_custom_get_prop(struct hid_sensor_hub_device *hsdev,
u32 prop_usage_id, size_t prop_size,
u16 *prop)
{ … }
static bool
hid_sensor_custom_do_match(struct hid_sensor_hub_device *hsdev,
const struct hid_sensor_custom_match *match,
const struct hid_sensor_custom_properties *prop)
{ … }
static int
hid_sensor_custom_properties_get(struct hid_sensor_hub_device *hsdev,
struct hid_sensor_custom_properties *prop)
{ … }
static int
hid_sensor_custom_get_known(struct hid_sensor_hub_device *hsdev,
const struct hid_sensor_custom_match **known)
{ … }
static struct platform_device *
hid_sensor_register_platform_device(struct platform_device *pdev,
struct hid_sensor_hub_device *hsdev,
const struct hid_sensor_custom_match *match)
{ … }
static int hid_sensor_custom_probe(struct platform_device *pdev)
{ … }
static void hid_sensor_custom_remove(struct platform_device *pdev)
{ … }
static const struct platform_device_id hid_sensor_custom_ids[] = …;
MODULE_DEVICE_TABLE(platform, hid_sensor_custom_ids);
static struct platform_driver hid_sensor_custom_platform_driver = …;
module_platform_driver(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_AUTHOR(…) …;
MODULE_LICENSE(…) …;