linux/drivers/hid/hid-quirks.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 *  HID quirks support for Linux
 *
 *  Copyright (c) 1999 Andreas Gal
 *  Copyright (c) 2000-2005 Vojtech Pavlik <[email protected]>
 *  Copyright (c) 2005 Michael Haboustak <[email protected]> for Concept2, Inc
 *  Copyright (c) 2006-2007 Jiri Kosina
 *  Copyright (c) 2007 Paul Walmsley
 */

/*
 */

#include <linux/hid.h>
#include <linux/export.h>
#include <linux/slab.h>
#include <linux/mutex.h>
#include <linux/input/elan-i2c-ids.h>

#include "hid-ids.h"

/*
 * Alphabetically sorted by vendor then product.
 */

static const struct hid_device_id hid_quirks[] =;

/*
 * A list of devices for which there is a specialized driver on HID bus.
 *
 * Please note that for multitouch devices (driven by hid-multitouch driver),
 * there is a proper autodetection and autoloading in place (based on presence
 * of HID_DG_CONTACTID), so those devices don't need to be added to this list,
 * as we are doing the right thing in hid_scan_usage().
 *
 * Autodetection for (USB) HID sensor hubs exists too. If a collection of type
 * physical is found inside a usage page of type sensor, hid-sensor-hub will be
 * used as a driver. See hid_scan_report().
 */
static const struct hid_device_id hid_have_special_driver[] =;

/* a list of devices that shouldn't be handled by HID core at all */
static const struct hid_device_id hid_ignore_list[] =;

/*
 * hid_mouse_ignore_list - mouse devices which should not be handled by the hid layer
 *
 * There are composite devices for which we want to ignore only a certain
 * interface. This is a list of devices for which only the mouse interface will
 * be ignored. This allows a dedicated driver to take care of the interface.
 */
static const struct hid_device_id hid_mouse_ignore_list[] =;

bool hid_ignore(struct hid_device *hdev)
{}
EXPORT_SYMBOL_GPL();

/* Dynamic HID quirks list - specified at runtime */
struct quirks_list_struct {};

static LIST_HEAD(dquirks_list);
static DEFINE_MUTEX(dquirks_lock);

/* Runtime ("dynamic") quirks manipulation functions */

/**
 * hid_exists_dquirk - find any dynamic quirks for a HID device
 * @hdev: the HID device to match
 *
 * Description:
 *         Scans dquirks_list for a matching dynamic quirk and returns
 *         the pointer to the relevant struct hid_device_id if found.
 *         Must be called with a read lock held on dquirks_lock.
 *
 * Return: NULL if no quirk found, struct hid_device_id * if found.
 */
static struct hid_device_id *hid_exists_dquirk(const struct hid_device *hdev)
{}


/**
 * hid_modify_dquirk - add/replace a HID quirk
 * @id: the HID device to match
 * @quirks: the unsigned long quirks value to add/replace
 *
 * Description:
 *         If an dynamic quirk exists in memory for this device, replace its
 *         quirks value with what was provided.  Otherwise, add the quirk
 *         to the dynamic quirks list.
 *
 * Return: 0 OK, -error on failure.
 */
static int hid_modify_dquirk(const struct hid_device_id *id,
			     const unsigned long quirks)
{}

/**
 * hid_remove_all_dquirks - remove all runtime HID quirks from memory
 * @bus: bus to match against. Use HID_BUS_ANY if all need to be removed.
 *
 * Description:
 *         Free all memory associated with dynamic quirks - called before
 *         module unload.
 *
 */
static void hid_remove_all_dquirks(__u16 bus)
{}

/**
 * hid_quirks_init - apply HID quirks specified at module load time
 * @quirks_param: array of quirks strings (vendor:product:quirks)
 * @bus: bus type
 * @count: number of quirks to check
 */
int hid_quirks_init(char **quirks_param, __u16 bus, int count)
{}
EXPORT_SYMBOL_GPL();

/**
 * hid_quirks_exit - release memory associated with dynamic_quirks
 * @bus: a bus to match against
 *
 * Description:
 *     Release all memory associated with dynamic quirks for a given bus.
 *     Called upon module unload.
 *     Use HID_BUS_ANY to remove all dynamic quirks.
 *
 * Returns: nothing
 */
void hid_quirks_exit(__u16 bus)
{}
EXPORT_SYMBOL_GPL();

/**
 * hid_gets_squirk - return any static quirks for a HID device
 * @hdev: the HID device to match
 *
 * Description:
 *     Given a HID device, return a pointer to the quirked hid_device_id entry
 *     associated with that device.
 *
 * Return: the quirks.
 */
static unsigned long hid_gets_squirk(const struct hid_device *hdev)
{}

/**
 * hid_lookup_quirk - return any quirks associated with a HID device
 * @hdev: the HID device to look for
 *
 * Description:
 *     Given a HID device, return any quirks associated with that device.
 *
 * Return: an unsigned long quirks value.
 */
unsigned long hid_lookup_quirk(const struct hid_device *hdev)
{}
EXPORT_SYMBOL_GPL();