1STRUCT INPUT_HANDLER(9) Input Subsystem STRUCT INPUT_HANDLER(9)
2
3
4
6 struct_input_handler - implements one of interfaces for input devices
7
9 struct input_handler {
10 void * private;
11 void (* event) (struct input_handle *handle, unsigned int type, unsigned int code, int value);
12 void (* events) (struct input_handle *handle,const struct input_value *vals, unsigned int count);
13 bool (* filter) (struct input_handle *handle, unsigned int type, unsigned int code, int value);
14 bool (* match) (struct input_handler *handler, struct input_dev *dev);
15 int (* connect) (struct input_handler *handler, struct input_dev *dev, const struct input_device_id *id);
16 void (* disconnect) (struct input_handle *handle);
17 void (* start) (struct input_handle *handle);
18 bool legacy_minors;
19 int minor;
20 const char * name;
21 const struct input_device_id * id_table;
22 struct list_head h_list;
23 struct list_head node;
24 };
25
27 private
28 driver-specific data
29
30 event
31 event handler. This method is being called by input core with
32 interrupts disabled and dev->event_lock spinlock held and so it may
33 not sleep
34
35 events
36 event sequence handler. This method is being called by input core
37 with interrupts disabled and dev->event_lock spinlock held and so
38 it may not sleep
39
40 filter
41 similar to event; separates normal event handlers from “filters”.
42
43 match
44 called after comparing device's id with handler's id_table to
45 perform fine-grained matching between device and handler
46
47 connect
48 called when attaching a handler to an input device
49
50 disconnect
51 disconnects a handler from input device
52
53 start
54 starts handler for given handle. This function is called by input
55 core right after connect method and also when a process that
56 “grabbed” a device releases it
57
58 legacy_minors
59 set to true by drivers using legacy minor ranges
60
61 minor
62 beginning of range of 32 legacy minors for devices this driver can
63 provide
64
65 name
66 name of the handler, to be shown in /proc/bus/input/handlers
67
68 id_table
69 pointer to a table of input_device_ids this driver can handle
70
71 h_list
72 list of input handles associated with the handler
73
74 node
75 for placing the driver onto input_handler_list
76
78 Input handlers attach to input devices and create input handles. There
79 are likely several handlers attached to any given input device at the
80 same time. All of them will get their copy of input event generated by
81 the device.
82
83 The very same structure is used to implement input filters. Input core
84 allows filters to run first and will not pass event to regular handlers
85 if any of the filters indicate that the event should be filtered (by
86 returning true from their filter method).
87
88 Note that input core serializes calls to connect and disconnect
89 methods.
90
92Kernel Hackers Manual 3.10 June 2019 STRUCT INPUT_HANDLER(9)