linux/drivers/hid/hid-input.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 *  Copyright (c) 2000-2001 Vojtech Pavlik
 *  Copyright (c) 2006-2010 Jiri Kosina
 *
 *  HID to Linux Input mapping
 */

/*
 *
 * Should you need to contact me, the author, you can do so either by
 * e-mail - mail your message to <[email protected]>, or by paper mail:
 * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
 */

#include <linux/module.h>
#include <linux/slab.h>
#include <linux/kernel.h>

#include <linux/hid.h>
#include <linux/hid-debug.h>

#include "hid-ids.h"

#define unk

static const unsigned char hid_keyboard[256] =;

static const struct {}  hid_hat_to_axis[] =;

struct usage_priority {};

/*
 * hid-input will convert this list into priorities:
 * the first element will have the highest priority
 * (the length of the following array) and the last
 * element the lowest (1).
 *
 * hid-input will then shift the priority by 8 bits to leave some space
 * in case drivers want to interleave other fields.
 *
 * To accommodate slotted devices, the slot priority is
 * defined in the next 8 bits (defined by 0xff - slot).
 *
 * If drivers want to add fields before those, hid-input will
 * leave out the first 8 bits of the priority value.
 *
 * This still leaves us 65535 individual priority values.
 */
static const struct usage_priority hidinput_usages_priorities[] =;

#define map_abs(c)
#define map_rel(c)
#define map_key(c)
#define map_led(c)
#define map_msc(c)

#define map_abs_clear(c)
#define map_key_clear(c)

static bool match_scancode(struct hid_usage *usage,
			   unsigned int cur_idx, unsigned int scancode)
{}

static bool match_keycode(struct hid_usage *usage,
			  unsigned int cur_idx, unsigned int keycode)
{}

static bool match_index(struct hid_usage *usage,
			unsigned int cur_idx, unsigned int idx)
{}

hid_usage_cmp_t;

static struct hid_usage *hidinput_find_key(struct hid_device *hid,
					   hid_usage_cmp_t match,
					   unsigned int value,
					   unsigned int *usage_idx)
{}

static struct hid_usage *hidinput_locate_usage(struct hid_device *hid,
					const struct input_keymap_entry *ke,
					unsigned int *index)
{}

static int hidinput_getkeycode(struct input_dev *dev,
			       struct input_keymap_entry *ke)
{}

static int hidinput_setkeycode(struct input_dev *dev,
			       const struct input_keymap_entry *ke,
			       unsigned int *old_keycode)
{}


/**
 * hidinput_calc_abs_res - calculate an absolute axis resolution
 * @field: the HID report field to calculate resolution for
 * @code: axis code
 *
 * The formula is:
 *                         (logical_maximum - logical_minimum)
 * resolution = ----------------------------------------------------------
 *              (physical_maximum - physical_minimum) * 10 ^ unit_exponent
 *
 * as seen in the HID specification v1.11 6.2.2.7 Global Items.
 *
 * Only exponent 1 length units are processed. Centimeters and inches are
 * converted to millimeters. Degrees are converted to radians.
 */
__s32 hidinput_calc_abs_res(const struct hid_field *field, __u16 code)
{}
EXPORT_SYMBOL_GPL();

#ifdef CONFIG_HID_BATTERY_STRENGTH
static enum power_supply_property hidinput_battery_props[] =;

#define HID_BATTERY_QUIRK_PERCENT
#define HID_BATTERY_QUIRK_FEATURE
#define HID_BATTERY_QUIRK_IGNORE
#define HID_BATTERY_QUIRK_AVOID_QUERY

static const struct hid_device_id hid_battery_quirks[] =;

static unsigned find_battery_quirk(struct hid_device *hdev)
{}

static int hidinput_scale_battery_capacity(struct hid_device *dev,
					   int value)
{}

static int hidinput_query_battery_capacity(struct hid_device *dev)
{}

static int hidinput_get_battery_property(struct power_supply *psy,
					 enum power_supply_property prop,
					 union power_supply_propval *val)
{}

static int hidinput_setup_battery(struct hid_device *dev, unsigned report_type,
				  struct hid_field *field, bool is_percentage)
{}

static void hidinput_cleanup_battery(struct hid_device *dev)
{}

static void hidinput_update_battery(struct hid_device *dev, int value)
{}

static bool hidinput_set_battery_charge_status(struct hid_device *dev,
					       unsigned int usage, int value)
{}
#else  /* !CONFIG_HID_BATTERY_STRENGTH */
static int hidinput_setup_battery(struct hid_device *dev, unsigned report_type,
				  struct hid_field *field, bool is_percentage)
{
	return 0;
}

static void hidinput_cleanup_battery(struct hid_device *dev)
{
}

static void hidinput_update_battery(struct hid_device *dev, int value)
{
}

static bool hidinput_set_battery_charge_status(struct hid_device *dev,
					       unsigned int usage, int value)
{
	return false;
}
#endif	/* CONFIG_HID_BATTERY_STRENGTH */

static bool hidinput_field_in_collection(struct hid_device *device, struct hid_field *field,
					 unsigned int type, unsigned int usage)
{}

static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_field *field,
				     struct hid_usage *usage, unsigned int usage_index)
{}

static void hidinput_handle_scroll(struct hid_usage *usage,
				   struct input_dev *input,
				   __s32 value)
{}

static void hid_report_release_tool(struct hid_report *report, struct input_dev *input,
				    unsigned int tool)
{}

static void hid_report_set_tool(struct hid_report *report, struct input_dev *input,
				unsigned int new_tool)
{}

void hidinput_hid_event(struct hid_device *hid, struct hid_field *field, struct hid_usage *usage, __s32 value)
{}

void hidinput_report_event(struct hid_device *hid, struct hid_report *report)
{}
EXPORT_SYMBOL_GPL();

static int hidinput_find_field(struct hid_device *hid, unsigned int type,
			       unsigned int code, struct hid_field **field)
{}

struct hid_field *hidinput_get_led_field(struct hid_device *hid)
{}
EXPORT_SYMBOL_GPL();

unsigned int hidinput_count_leds(struct hid_device *hid)
{}
EXPORT_SYMBOL_GPL();

static void hidinput_led_worker(struct work_struct *work)
{}

static int hidinput_input_event(struct input_dev *dev, unsigned int type,
				unsigned int code, int value)
{}

static int hidinput_open(struct input_dev *dev)
{}

static void hidinput_close(struct input_dev *dev)
{}

static bool __hidinput_change_resolution_multipliers(struct hid_device *hid,
		struct hid_report *report, bool use_logical_max)
{}

static void hidinput_change_resolution_multipliers(struct hid_device *hid)
{}

static void report_features(struct hid_device *hid)
{}

static struct hid_input *hidinput_allocate(struct hid_device *hid,
					   unsigned int application)
{}

static bool hidinput_has_been_populated(struct hid_input *hidinput)
{}

static void hidinput_cleanup_hidinput(struct hid_device *hid,
		struct hid_input *hidinput)
{}

static struct hid_input *hidinput_match(struct hid_report *report)
{}

static struct hid_input *hidinput_match_application(struct hid_report *report)
{}

static inline void hidinput_configure_usages(struct hid_input *hidinput,
					     struct hid_report *report)
{}

/*
 * Register the input device; print a message.
 * Configure the input layer interface
 * Read all reports and initialize the absolute field values.
 */

int hidinput_connect(struct hid_device *hid, unsigned int force)
{}
EXPORT_SYMBOL_GPL();

void hidinput_disconnect(struct hid_device *hid)
{}
EXPORT_SYMBOL_GPL();

#ifdef CONFIG_HID_KUNIT_TEST
#include "hid-input-test.c"
#endif