![]() |
|
|||
0001 /* SPDX-License-Identifier: GPL-2.0-only */ 0002 #ifndef _SPARSE_KEYMAP_H 0003 #define _SPARSE_KEYMAP_H 0004 0005 /* 0006 * Copyright (c) 2009 Dmitry Torokhov 0007 */ 0008 0009 #define KE_END 0 /* Indicates end of keymap */ 0010 #define KE_KEY 1 /* Ordinary key/button */ 0011 #define KE_SW 2 /* Switch (predetermined value) */ 0012 #define KE_VSW 3 /* Switch (value supplied at runtime) */ 0013 #define KE_IGNORE 4 /* Known entry that should be ignored */ 0014 #define KE_LAST KE_IGNORE 0015 0016 /** 0017 * struct key_entry - keymap entry for use in sparse keymap 0018 * @type: Type of the key entry (KE_KEY, KE_SW, KE_VSW, KE_END); 0019 * drivers are allowed to extend the list with their own 0020 * private definitions. 0021 * @code: Device-specific data identifying the button/switch 0022 * @keycode: KEY_* code assigned to a key/button 0023 * @sw: struct with code/value used by KE_SW and KE_VSW 0024 * @sw.code: SW_* code assigned to a switch 0025 * @sw.value: Value that should be sent in an input even when KE_SW 0026 * switch is toggled. KE_VSW switches ignore this field and 0027 * expect driver to supply value for the event. 0028 * 0029 * This structure defines an entry in a sparse keymap used by some 0030 * input devices for which traditional table-based approach is not 0031 * suitable. 0032 */ 0033 struct key_entry { 0034 int type; /* See KE_* above */ 0035 u32 code; 0036 union { 0037 u16 keycode; /* For KE_KEY */ 0038 struct { /* For KE_SW, KE_VSW */ 0039 u8 code; 0040 u8 value; /* For KE_SW, ignored by KE_VSW */ 0041 } sw; 0042 }; 0043 }; 0044 0045 struct key_entry *sparse_keymap_entry_from_scancode(struct input_dev *dev, 0046 unsigned int code); 0047 struct key_entry *sparse_keymap_entry_from_keycode(struct input_dev *dev, 0048 unsigned int code); 0049 int sparse_keymap_setup(struct input_dev *dev, 0050 const struct key_entry *keymap, 0051 int (*setup)(struct input_dev *, struct key_entry *)); 0052 0053 void sparse_keymap_report_entry(struct input_dev *dev, const struct key_entry *ke, 0054 unsigned int value, bool autorelease); 0055 0056 bool sparse_keymap_report_event(struct input_dev *dev, unsigned int code, 0057 unsigned int value, bool autorelease); 0058 0059 #endif /* _SPARSE_KEYMAP_H */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.1.0 LXR engine. The LXR team |
![]() ![]() |