diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-15 16:41:39 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-15 16:41:39 -0400 |
commit | f2e1d89f9b349b3cd914b7c6ec6368632f4ad048 (patch) | |
tree | 5b0042924a9f9c8b3309c0be880f51795916fc28 /include/linux/input.h | |
parent | 85ffdd28be04c324349dfc7c9de3d4342c885c3f (diff) | |
parent | 82ba56c273911f7eda79849cfa0fc2d2e5a3b75b (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: (40 commits)
Input: use full RCU API
Input: remove tsdev interface
Input: add support for Blackfin BF54x Keypad controller
Input: appletouch - another fix for idle reset logic
HWMON: hdaps - switch to using input-polldev
Input: add support for SEGA Dreamcast keyboard
Input: omap-keyboard - don't pretend we support changing keymap
Input: lifebook - fix X and Y axis range
Input: usbtouchscreen - add support for GeneralTouch devices
Input: fix open count handling in input interfaces
Input: keyboard - add CapsShift lock
Input: adbhid - produce all CapsLock key events
Input: ALPS - add signature for ThinkPad R61
Input: jornada720_kbd - send MSC_SCAN events
Input: add support for the HP Jornada 7xx (710/720/728) touchscreen
Input: add support for HP Jornada 7xx onboard keyboard
Input: add support for HP Jornada onboard keyboard (HP6XX)
Input: ucb1400_ts - use schedule_timeout_uninterruptible
Input: xpad - fix dependancy on LEDS class
Input: auto-select INPUT for MAC_EMUMOUSEBTN option
...
Resolved conflicts manually in drivers/hwmon/applesmc.c: converting from
a class device to a device and converting to use input-polldev created a
few apparently trivial clashes..
Diffstat (limited to 'include/linux/input.h')
-rw-r--r-- | include/linux/input.h | 116 |
1 files changed, 106 insertions, 10 deletions
diff --git a/include/linux/input.h b/include/linux/input.h index 52d1bd434a50..f30da6fc08e3 100644 --- a/include/linux/input.h +++ b/include/linux/input.h | |||
@@ -856,7 +856,7 @@ struct ff_rumble_effect { | |||
856 | * defining effect parameters | 856 | * defining effect parameters |
857 | * | 857 | * |
858 | * This structure is sent through ioctl from the application to the driver. | 858 | * This structure is sent through ioctl from the application to the driver. |
859 | * To create a new effect aplication should set its @id to -1; the kernel | 859 | * To create a new effect application should set its @id to -1; the kernel |
860 | * will return assigned @id which can later be used to update or delete | 860 | * will return assigned @id which can later be used to update or delete |
861 | * this effect. | 861 | * this effect. |
862 | * | 862 | * |
@@ -936,9 +936,82 @@ struct ff_effect { | |||
936 | #define BIT(x) (1UL<<((x)%BITS_PER_LONG)) | 936 | #define BIT(x) (1UL<<((x)%BITS_PER_LONG)) |
937 | #define LONG(x) ((x)/BITS_PER_LONG) | 937 | #define LONG(x) ((x)/BITS_PER_LONG) |
938 | 938 | ||
939 | /** | ||
940 | * struct input_dev - represents an input device | ||
941 | * @name: name of the device | ||
942 | * @phys: physical path to the device in the system hierarchy | ||
943 | * @uniq: unique identification code for the device (if device has it) | ||
944 | * @id: id of the device (struct input_id) | ||
945 | * @evbit: bitmap of types of events supported by the device (EV_KEY, | ||
946 | * EV_REL, etc.) | ||
947 | * @keybit: bitmap of keys/buttons this device has | ||
948 | * @relbit: bitmap of relative axes for the device | ||
949 | * @absbit: bitmap of absolute axes for the device | ||
950 | * @mscbit: bitmap of miscellaneous events supported by the device | ||
951 | * @ledbit: bitmap of leds present on the device | ||
952 | * @sndbit: bitmap of sound effects supported by the device | ||
953 | * @ffbit: bitmap of force feedback effects supported by the device | ||
954 | * @swbit: bitmap of switches present on the device | ||
955 | * @keycodemax: size of keycode table | ||
956 | * @keycodesize: size of elements in keycode table | ||
957 | * @keycode: map of scancodes to keycodes for this device | ||
958 | * @setkeycode: optional method to alter current keymap, used to implement | ||
959 | * sparse keymaps. If not supplied default mechanism will be used | ||
960 | * @getkeycode: optional method to retrieve current keymap. If not supplied | ||
961 | * default mechanism will be used | ||
962 | * @ff: force feedback structure associated with the device if device | ||
963 | * supports force feedback effects | ||
964 | * @repeat_key: stores key code of the last key pressed; used to implement | ||
965 | * software autorepeat | ||
966 | * @timer: timer for software autorepeat | ||
967 | * @sync: set to 1 when there were no new events since last EV_SYNC | ||
968 | * @abs: current values for reports from absolute axes | ||
969 | * @rep: current values for autorepeat parameters (delay, rate) | ||
970 | * @key: reflects current state of device's keys/buttons | ||
971 | * @led: reflects current state of device's LEDs | ||
972 | * @snd: reflects current state of sound effects | ||
973 | * @sw: reflects current state of device's switches | ||
974 | * @absmax: maximum values for events coming from absolute axes | ||
975 | * @absmin: minimum values for events coming from absolute axes | ||
976 | * @absfuzz: describes noisiness for axes | ||
977 | * @absflat: size of the center flat position (used by joydev) | ||
978 | * @open: this method is called when the very first user calls | ||
979 | * input_open_device(). The driver must prepare the device | ||
980 | * to start generating events (start polling thread, | ||
981 | * request an IRQ, submit URB, etc.) | ||
982 | * @close: this method is called when the very last user calls | ||
983 | * input_close_device(). | ||
984 | * @flush: purges the device. Most commonly used to get rid of force | ||
985 | * feedback effects loaded into the device when disconnecting | ||
986 | * from it | ||
987 | * @event: event handler for events sent _to_ the device, like EV_LED | ||
988 | * or EV_SND. The device is expected to carry out the requested | ||
989 | * action (turn on a LED, play sound, etc.) The call is protected | ||
990 | * by @event_lock and must not sleep | ||
991 | * @grab: input handle that currently has the device grabbed (via | ||
992 | * EVIOCGRAB ioctl). When a handle grabs a device it becomes sole | ||
993 | * recipient for all input events coming from the device | ||
994 | * @event_lock: this spinlock is is taken when input core receives | ||
995 | * and processes a new event for the device (in input_event()). | ||
996 | * Code that accesses and/or modifies parameters of a device | ||
997 | * (such as keymap or absmin, absmax, absfuzz, etc.) after device | ||
998 | * has been registered with input core must take this lock. | ||
999 | * @mutex: serializes calls to open(), close() and flush() methods | ||
1000 | * @users: stores number of users (input handlers) that opened this | ||
1001 | * device. It is used by input_open_device() and input_close_device() | ||
1002 | * to make sure that dev->open() is only called when the first | ||
1003 | * user opens device and dev->close() is called when the very | ||
1004 | * last user closes the device | ||
1005 | * @going_away: marks devices that are in a middle of unregistering and | ||
1006 | * causes input_open_device*() fail with -ENODEV. | ||
1007 | * @dev: driver model's view of this device | ||
1008 | * @h_list: list of input handles associated with the device. When | ||
1009 | * accessing the list dev->mutex must be held | ||
1010 | * @node: used to place the device onto input_dev_list | ||
1011 | */ | ||
939 | struct input_dev { | 1012 | struct input_dev { |
940 | 1013 | ||
941 | void *private; | 1014 | void *private; /* do not use */ |
942 | 1015 | ||
943 | const char *name; | 1016 | const char *name; |
944 | const char *phys; | 1017 | const char *phys; |
@@ -966,8 +1039,6 @@ struct input_dev { | |||
966 | unsigned int repeat_key; | 1039 | unsigned int repeat_key; |
967 | struct timer_list timer; | 1040 | struct timer_list timer; |
968 | 1041 | ||
969 | int state; | ||
970 | |||
971 | int sync; | 1042 | int sync; |
972 | 1043 | ||
973 | int abs[ABS_MAX + 1]; | 1044 | int abs[ABS_MAX + 1]; |
@@ -990,8 +1061,11 @@ struct input_dev { | |||
990 | 1061 | ||
991 | struct input_handle *grab; | 1062 | struct input_handle *grab; |
992 | 1063 | ||
993 | struct mutex mutex; /* serializes open and close operations */ | 1064 | spinlock_t event_lock; |
1065 | struct mutex mutex; | ||
1066 | |||
994 | unsigned int users; | 1067 | unsigned int users; |
1068 | int going_away; | ||
995 | 1069 | ||
996 | struct device dev; | 1070 | struct device dev; |
997 | union { /* temporarily so while we switching to struct device */ | 1071 | union { /* temporarily so while we switching to struct device */ |
@@ -1057,7 +1131,9 @@ struct input_handle; | |||
1057 | /** | 1131 | /** |
1058 | * struct input_handler - implements one of interfaces for input devices | 1132 | * struct input_handler - implements one of interfaces for input devices |
1059 | * @private: driver-specific data | 1133 | * @private: driver-specific data |
1060 | * @event: event handler | 1134 | * @event: event handler. This method is being called by input core with |
1135 | * interrupts disabled and dev->event_lock spinlock held and so | ||
1136 | * it may not sleep | ||
1061 | * @connect: called when attaching a handler to an input device | 1137 | * @connect: called when attaching a handler to an input device |
1062 | * @disconnect: disconnects a handler from input device | 1138 | * @disconnect: disconnects a handler from input device |
1063 | * @start: starts handler for given handle. This function is called by | 1139 | * @start: starts handler for given handle. This function is called by |
@@ -1069,10 +1145,18 @@ struct input_handle; | |||
1069 | * @name: name of the handler, to be shown in /proc/bus/input/handlers | 1145 | * @name: name of the handler, to be shown in /proc/bus/input/handlers |
1070 | * @id_table: pointer to a table of input_device_ids this driver can | 1146 | * @id_table: pointer to a table of input_device_ids this driver can |
1071 | * handle | 1147 | * handle |
1072 | * @blacklist: prointer to a table of input_device_ids this driver should | 1148 | * @blacklist: pointer to a table of input_device_ids this driver should |
1073 | * ignore even if they match @id_table | 1149 | * ignore even if they match @id_table |
1074 | * @h_list: list of input handles associated with the handler | 1150 | * @h_list: list of input handles associated with the handler |
1075 | * @node: for placing the driver onto input_handler_list | 1151 | * @node: for placing the driver onto input_handler_list |
1152 | * | ||
1153 | * Input handlers attach to input devices and create input handles. There | ||
1154 | * are likely several handlers attached to any given input device at the | ||
1155 | * same time. All of them will get their copy of input event generated by | ||
1156 | * the device. | ||
1157 | * | ||
1158 | * Note that input core serializes calls to connect() and disconnect() | ||
1159 | * methods. | ||
1076 | */ | 1160 | */ |
1077 | struct input_handler { | 1161 | struct input_handler { |
1078 | 1162 | ||
@@ -1094,6 +1178,18 @@ struct input_handler { | |||
1094 | struct list_head node; | 1178 | struct list_head node; |
1095 | }; | 1179 | }; |
1096 | 1180 | ||
1181 | /** | ||
1182 | * struct input_handle - links input device with an input handler | ||
1183 | * @private: handler-specific data | ||
1184 | * @open: counter showing whether the handle is 'open', i.e. should deliver | ||
1185 | * events from its device | ||
1186 | * @name: name given to the handle by handler that created it | ||
1187 | * @dev: input device the handle is attached to | ||
1188 | * @handler: handler that works with the device through this handle | ||
1189 | * @d_node: used to put the handle on device's list of attached handles | ||
1190 | * @h_node: used to put the handle on handler's list of handles from which | ||
1191 | * it gets events | ||
1192 | */ | ||
1097 | struct input_handle { | 1193 | struct input_handle { |
1098 | 1194 | ||
1099 | void *private; | 1195 | void *private; |
@@ -1136,10 +1232,10 @@ static inline void input_set_drvdata(struct input_dev *dev, void *data) | |||
1136 | dev->private = data; | 1232 | dev->private = data; |
1137 | } | 1233 | } |
1138 | 1234 | ||
1139 | int input_register_device(struct input_dev *); | 1235 | int __must_check input_register_device(struct input_dev *); |
1140 | void input_unregister_device(struct input_dev *); | 1236 | void input_unregister_device(struct input_dev *); |
1141 | 1237 | ||
1142 | int input_register_handler(struct input_handler *); | 1238 | int __must_check input_register_handler(struct input_handler *); |
1143 | void input_unregister_handler(struct input_handler *); | 1239 | void input_unregister_handler(struct input_handler *); |
1144 | 1240 | ||
1145 | int input_register_handle(struct input_handle *); | 1241 | int input_register_handle(struct input_handle *); |
@@ -1216,7 +1312,7 @@ extern struct class input_class; | |||
1216 | * @max_effects: maximum number of effects supported by device | 1312 | * @max_effects: maximum number of effects supported by device |
1217 | * @effects: pointer to an array of effects currently loaded into device | 1313 | * @effects: pointer to an array of effects currently loaded into device |
1218 | * @effect_owners: array of effect owners; when file handle owning | 1314 | * @effect_owners: array of effect owners; when file handle owning |
1219 | * an effect gets closed the effcet is automatically erased | 1315 | * an effect gets closed the effect is automatically erased |
1220 | * | 1316 | * |
1221 | * Every force-feedback device must implement upload() and playback() | 1317 | * Every force-feedback device must implement upload() and playback() |
1222 | * methods; erase() is optional. set_gain() and set_autocenter() need | 1318 | * methods; erase() is optional. set_gain() and set_autocenter() need |