~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/linux/input/sparse-keymap.h

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0-only */
  2 #ifndef _SPARSE_KEYMAP_H
  3 #define _SPARSE_KEYMAP_H
  4 
  5 /*
  6  * Copyright (c) 2009 Dmitry Torokhov
  7  */
  8 
  9 #define KE_END          0       /* Indicates end of keymap */
 10 #define KE_KEY          1       /* Ordinary key/button */
 11 #define KE_SW           2       /* Switch (predetermined value) */
 12 #define KE_VSW          3       /* Switch (value supplied at runtime) */
 13 #define KE_IGNORE       4       /* Known entry that should be ignored */
 14 #define KE_LAST         KE_IGNORE
 15 
 16 /**
 17  * struct key_entry - keymap entry for use in sparse keymap
 18  * @type: Type of the key entry (KE_KEY, KE_SW, KE_VSW, KE_END);
 19  *      drivers are allowed to extend the list with their own
 20  *      private definitions.
 21  * @code: Device-specific data identifying the button/switch
 22  * @keycode: KEY_* code assigned to a key/button
 23  * @sw: struct with code/value used by KE_SW and KE_VSW
 24  * @sw.code: SW_* code assigned to a switch
 25  * @sw.value: Value that should be sent in an input even when KE_SW
 26  *      switch is toggled. KE_VSW switches ignore this field and
 27  *      expect driver to supply value for the event.
 28  *
 29  * This structure defines an entry in a sparse keymap used by some
 30  * input devices for which traditional table-based approach is not
 31  * suitable.
 32  */
 33 struct key_entry {
 34         int type;               /* See KE_* above */
 35         u32 code;
 36         union {
 37                 u16 keycode;            /* For KE_KEY */
 38                 struct {                /* For KE_SW, KE_VSW */
 39                         u8 code;
 40                         u8 value;       /* For KE_SW, ignored by KE_VSW */
 41                 } sw;
 42         };
 43 };
 44 
 45 struct key_entry *sparse_keymap_entry_from_scancode(struct input_dev *dev,
 46                                                     unsigned int code);
 47 struct key_entry *sparse_keymap_entry_from_keycode(struct input_dev *dev,
 48                                                    unsigned int code);
 49 int sparse_keymap_setup(struct input_dev *dev,
 50                         const struct key_entry *keymap,
 51                         int (*setup)(struct input_dev *, struct key_entry *));
 52 
 53 void sparse_keymap_report_entry(struct input_dev *dev, const struct key_entry *ke,
 54                                 unsigned int value, bool autorelease);
 55 
 56 bool sparse_keymap_report_event(struct input_dev *dev, unsigned int code,
 57                                 unsigned int value, bool autorelease);
 58 
 59 #endif /* _SPARSE_KEYMAP_H */
 60 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php