input: keychord: Add keychord driver
This driver allows userspace to receive notification when client specified key combinations are pressed. The client opens /dev/keychord and writes a list of keychords for the driver to monitor. The client then reads or polls /dev/keychord for notifications. A client specified ID for the keychord is returned from read() when a keychord press is detected. Signed-off-by: Mike Lockwood <lockwood@android.com> keychord: fix to build without CONFIG_PREEMPT Change-Id: I911f13aeda4224b6fa57863bc7e8972fec8837fb
This commit is contained in:
committed by
Colin Cross
parent
c1678677a5
commit
16e1bce6e2
52
include/linux/keychord.h
Normal file
52
include/linux/keychord.h
Normal file
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Key chord input driver
|
||||
*
|
||||
* Copyright (C) 2008 Google, Inc.
|
||||
* Author: Mike Lockwood <lockwood@android.com>
|
||||
*
|
||||
* This software is licensed under the terms of the GNU General Public
|
||||
* License version 2, as published by the Free Software Foundation, and
|
||||
* may be copied, distributed, and modified under those terms.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __LINUX_KEYCHORD_H_
|
||||
#define __LINUX_KEYCHORD_H_
|
||||
|
||||
#include <linux/input.h>
|
||||
|
||||
#define KEYCHORD_VERSION 1
|
||||
|
||||
/*
|
||||
* One or more input_keychord structs are written to /dev/keychord
|
||||
* at once to specify the list of keychords to monitor.
|
||||
* Reading /dev/keychord returns the id of a keychord when the
|
||||
* keychord combination is pressed. A keychord is signalled when
|
||||
* all of the keys in the keycode list are in the pressed state.
|
||||
* The order in which the keys are pressed does not matter.
|
||||
* The keychord will not be signalled if keys not in the keycode
|
||||
* list are pressed.
|
||||
* Keychords will not be signalled on key release events.
|
||||
*/
|
||||
struct input_keychord {
|
||||
/* should be KEYCHORD_VERSION */
|
||||
__u16 version;
|
||||
/*
|
||||
* client specified ID, returned from read()
|
||||
* when this keychord is pressed.
|
||||
*/
|
||||
__u16 id;
|
||||
|
||||
/* number of keycodes in this keychord */
|
||||
__u16 count;
|
||||
|
||||
/* variable length array of keycodes */
|
||||
__u16 keycodes[];
|
||||
};
|
||||
|
||||
#endif /* __LINUX_KEYCHORD_H_ */
|
||||
Reference in New Issue
Block a user