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