// SPDX-License-Identifier: GPL-2.0-only /* * HID driver for the apple ir device * * Original driver written by James McKenzie * Ported to recent 2.6 kernel versions by Greg Kroah-Hartman <[email protected]> * Updated to support newer remotes by Bastien Nocera <[email protected]> * Ported to HID subsystem by Benjamin Tissoires <[email protected]> * * Copyright (C) 2006 James McKenzie * Copyright (C) 2008 Greg Kroah-Hartman <[email protected]> * Copyright (C) 2008 Novell Inc. * Copyright (C) 2010, 2012 Bastien Nocera <[email protected]> * Copyright (C) 2013 Benjamin Tissoires <[email protected]> * Copyright (C) 2013 Red Hat Inc. All Rights Reserved */ #include <linux/device.h> #include <linux/hid.h> #include <linux/module.h> #include "hid-ids.h" MODULE_AUTHOR(…) …; MODULE_AUTHOR(…) …; MODULE_DESCRIPTION(…) …; MODULE_LICENSE(…) …; #define KEY_MASK … #define TWO_PACKETS_MASK … /* * James McKenzie has two devices both of which report the following * 25 87 ee 83 0a + * 25 87 ee 83 0c - * 25 87 ee 83 09 << * 25 87 ee 83 06 >> * 25 87 ee 83 05 >" * 25 87 ee 83 03 menu * 26 00 00 00 00 for key repeat */ /* * Thomas Glanzmann reports the following responses * 25 87 ee ca 0b + * 25 87 ee ca 0d - * 25 87 ee ca 08 << * 25 87 ee ca 07 >> * 25 87 ee ca 04 >" * 25 87 ee ca 02 menu * 26 00 00 00 00 for key repeat * * He also observes the following event sometimes * sent after a key is release, which I interpret * as a flat battery message * 25 87 e0 ca 06 flat battery */ /* * Alexandre Karpenko reports the following responses for Device ID 0x8242 * 25 87 ee 47 0b + * 25 87 ee 47 0d - * 25 87 ee 47 08 << * 25 87 ee 47 07 >> * 25 87 ee 47 04 >" * 25 87 ee 47 02 menu * 26 87 ee 47 ** for key repeat (** is the code of the key being held) */ /* * Bastien Nocera's remote * 25 87 ee 91 5f followed by * 25 87 ee 91 05 gives you >" * * 25 87 ee 91 5c followed by * 25 87 ee 91 05 gives you the middle button */ /* * Fabien Andre's remote * 25 87 ee a3 5e followed by * 25 87 ee a3 04 gives you >" * * 25 87 ee a3 5d followed by * 25 87 ee a3 04 gives you the middle button */ static const unsigned short appleir_key_table[] = …; struct appleir { … }; static int get_key(int data) { … } static void key_up(struct hid_device *hid, struct appleir *appleir, int key) { … } static void key_down(struct hid_device *hid, struct appleir *appleir, int key) { … } static void battery_flat(struct appleir *appleir) { … } static void key_up_tick(struct timer_list *t) { … } static int appleir_raw_event(struct hid_device *hid, struct hid_report *report, u8 *data, int len) { … } static int appleir_input_configured(struct hid_device *hid, struct hid_input *hidinput) { … } static int appleir_input_mapping(struct hid_device *hid, struct hid_input *hi, struct hid_field *field, struct hid_usage *usage, unsigned long **bit, int *max) { … } static int appleir_probe(struct hid_device *hid, const struct hid_device_id *id) { … } static void appleir_remove(struct hid_device *hid) { … } static const struct hid_device_id appleir_devices[] = …; MODULE_DEVICE_TABLE(hid, appleir_devices); static struct hid_driver appleir_driver = …; module_hid_driver(…) …;