linux/drivers/hid/hid-cougar.c

// SPDX-License-Identifier: GPL-2.0+
/*
 *  HID driver for Cougar 500k Gaming Keyboard
 *
 *  Copyright (c) 2018 Daniel M. Lambea <[email protected]>
 */

#include <linux/hid.h>
#include <linux/module.h>
#include <linux/printk.h>

#include "hid-ids.h"

MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_LICENSE();
MODULE_INFO();

static bool g6_is_space =;
MODULE_PARM_DESC();

#define COUGAR_VENDOR_USAGE

#define COUGAR_FIELD_CODE
#define COUGAR_FIELD_ACTION

#define COUGAR_KEY_G1
#define COUGAR_KEY_G2
#define COUGAR_KEY_G3
#define COUGAR_KEY_G4
#define COUGAR_KEY_G5
#define COUGAR_KEY_G6
#define COUGAR_KEY_FN
#define COUGAR_KEY_MR
#define COUGAR_KEY_M1
#define COUGAR_KEY_M2
#define COUGAR_KEY_M3
#define COUGAR_KEY_LEDS
#define COUGAR_KEY_LOCK


/* Default key mappings. The special key COUGAR_KEY_G6 is defined first
 * because it is more frequent to use the spacebar rather than any other
 * special keys. Depending on the value of the parameter 'g6_is_space',
 * the mapping will be updated in the probe function.
 */
static unsigned char cougar_mapping[][2] =;

struct cougar_shared {};

struct cougar {};

static LIST_HEAD(cougar_udev_list);
static DEFINE_MUTEX(cougar_udev_list_lock);

/**
 * cougar_fix_g6_mapping - configure the mapping for key G6/Spacebar
 */
static void cougar_fix_g6_mapping(void)
{}

/*
 * Constant-friendly rdesc fixup for mouse interface
 */
static __u8 *cougar_report_fixup(struct hid_device *hdev, __u8 *rdesc,
				 unsigned int *rsize)
{}

static struct cougar_shared *cougar_get_shared_data(struct hid_device *hdev)
{}

static void cougar_release_shared_data(struct kref *kref)
{}

static void cougar_remove_shared_data(void *resource)
{}

/*
 * Bind the device group's shared data to this cougar struct.
 * If no shared data exists for this group, create and initialize it.
 */
static int cougar_bind_shared_data(struct hid_device *hdev,
				   struct cougar *cougar)
{}

static int cougar_probe(struct hid_device *hdev,
			const struct hid_device_id *id)
{}

/*
 * Convert events from vendor intf to input key events
 */
static int cougar_raw_event(struct hid_device *hdev, struct hid_report *report,
			    u8 *data, int size)
{}

static void cougar_remove(struct hid_device *hdev)
{}

static int cougar_param_set_g6_is_space(const char *val,
					const struct kernel_param *kp)
{}

static const struct kernel_param_ops cougar_g6_is_space_ops =;
module_param_cb();

static const struct hid_device_id cougar_id_table[] =;
MODULE_DEVICE_TABLE(hid, cougar_id_table);

static struct hid_driver cougar_driver =;

module_hid_driver();