linux/drivers/hid/hid-apple.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 *  USB 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) 2008 Jiri Slaby <[email protected]>
 *  Copyright (c) 2019 Paul Pawlowski <[email protected]>
 *  Copyright (c) 2023 Orlando Chamberlain <[email protected]>
 *  Copyright (c) 2024 Aditya Garg <[email protected]>
 */

/*
 */

#define pr_fmt(fmt)

#include <linux/device.h>
#include <linux/hid.h>
#include <linux/jiffies.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/timer.h>
#include <linux/string.h>
#include <linux/leds.h>
#include <dt-bindings/leds/common.h>

#include "hid-ids.h"

#define APPLE_RDESC_JIS
#define APPLE_IGNORE_MOUSE
#define APPLE_HAS_FN
/* BIT(3) reserved, was: APPLE_HIDDEV */
#define APPLE_ISO_TILDE_QUIRK
#define APPLE_MIGHTYMOUSE
#define APPLE_INVERT_HWHEEL
/* BIT(7) reserved, was: APPLE_IGNORE_HIDINPUT */
#define APPLE_NUMLOCK_EMULATION
#define APPLE_RDESC_BATTERY
#define APPLE_BACKLIGHT_CTL
#define APPLE_IS_NON_APPLE
#define APPLE_MAGIC_BACKLIGHT

#define APPLE_FLAG_FKEY

#define HID_COUNTRY_INTERNATIONAL_ISO
#define APPLE_BATTERY_TIMEOUT_MS

#define HID_USAGE_MAGIC_BL
#define APPLE_MAGIC_REPORT_ID_POWER
#define APPLE_MAGIC_REPORT_ID_BRIGHTNESS

static unsigned int fnmode =;
module_param(fnmode, uint, 0644);
MODULE_PARM_DESC();

static int iso_layout =;
module_param(iso_layout, int, 0644);
MODULE_PARM_DESC();

static unsigned int swap_opt_cmd;
module_param(swap_opt_cmd, uint, 0644);
MODULE_PARM_DESC();

static unsigned int swap_ctrl_cmd;
module_param(swap_ctrl_cmd, uint, 0644);
MODULE_PARM_DESC();

static unsigned int swap_fn_leftctrl;
module_param(swap_fn_leftctrl, uint, 0644);
MODULE_PARM_DESC();

struct apple_non_apple_keyboard {};

struct apple_sc_backlight {};

struct apple_magic_backlight {};

struct apple_sc {};

struct apple_key_translation {};

static const struct apple_key_translation magic_keyboard_alu_fn_keys[] =;

static const struct apple_key_translation magic_keyboard_2015_fn_keys[] =;

struct apple_backlight_config_report {};

struct apple_backlight_set_report {};


static const struct apple_key_translation apple2021_fn_keys[] =;

static const struct apple_key_translation macbookair_fn_keys[] =;

static const struct apple_key_translation macbookpro_no_esc_fn_keys[] =;

static const struct apple_key_translation macbookpro_dedicated_esc_fn_keys[] =;

static const struct apple_key_translation apple_fn_keys[] =;

static const struct apple_key_translation powerbook_fn_keys[] =;

static const struct apple_key_translation powerbook_numlock_keys[] =;

static const struct apple_key_translation apple_iso_keyboard[] =;

static const struct apple_key_translation swapped_option_cmd_keys[] =;

static const struct apple_key_translation swapped_option_cmd_left_keys[] =;

static const struct apple_key_translation swapped_ctrl_cmd_keys[] =;

static const struct apple_key_translation swapped_fn_leftctrl_keys[] =;

static const struct apple_non_apple_keyboard non_apple_keyboards[] =;

static bool apple_is_non_apple_keyboard(struct hid_device *hdev)
{}

static inline void apple_setup_key_translation(struct input_dev *input,
		const struct apple_key_translation *table)
{}

static const struct apple_key_translation *apple_find_translation(
		const struct apple_key_translation *table, u16 from)
{}

static void input_event_with_scancode(struct input_dev *input,
		__u8 type, __u16 code, unsigned int hid, __s32 value)
{}

static int hidinput_apple_event(struct hid_device *hid, struct input_dev *input,
		struct hid_usage *usage, __s32 value)
{}

static int apple_event(struct hid_device *hdev, struct hid_field *field,
		struct hid_usage *usage, __s32 value)
{}

static int apple_fetch_battery(struct hid_device *hdev)
{}

static void apple_battery_timer_tick(struct timer_list *t)
{}

/*
 * MacBook JIS keyboard has wrong logical maximum
 * Magic Keyboard JIS has wrong logical maximum
 */
static __u8 *apple_report_fixup(struct hid_device *hdev, __u8 *rdesc,
		unsigned int *rsize)
{}

static void apple_setup_input(struct input_dev *input)
{}

static int apple_input_mapping(struct hid_device *hdev, struct hid_input *hi,
		struct hid_field *field, struct hid_usage *usage,
		unsigned long **bit, int *max)
{}

static int apple_input_mapped(struct hid_device *hdev, struct hid_input *hi,
		struct hid_field *field, struct hid_usage *usage,
		unsigned long **bit, int *max)
{}

static int apple_input_configured(struct hid_device *hdev,
		struct hid_input *hidinput)
{}

static bool apple_backlight_check_support(struct hid_device *hdev)
{}

static int apple_backlight_set(struct hid_device *hdev, u16 value, u16 rate)
{}

static int apple_backlight_led_set(struct led_classdev *led_cdev,
	enum led_brightness brightness)
{}

static int apple_backlight_init(struct hid_device *hdev)
{}

static void apple_magic_backlight_report_set(struct hid_report *rep, s32 value, u8 rate)
{}

static void apple_magic_backlight_set(struct apple_magic_backlight *backlight,
				     int brightness, char rate)
{}

static int apple_magic_backlight_led_set(struct led_classdev *led_cdev,
					 enum led_brightness brightness)
{}

static int apple_magic_backlight_init(struct hid_device *hdev)
{}

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

static void apple_remove(struct hid_device *hdev)
{}

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

static struct hid_driver apple_driver =;
module_hid_driver();

MODULE_DESCRIPTION();
MODULE_LICENSE();