string: factorize skip_spaces and export it to be generally available
[safe/jmp/linux-2.6] / include / linux / input.h
index 48937ff..7be8a65 100644 (file)
@@ -16,7 +16,7 @@
 #include <sys/time.h>
 #include <sys/ioctl.h>
 #include <sys/types.h>
-#include <asm/types.h>
+#include <linux/types.h>
 #endif
 
 /*
@@ -53,6 +53,7 @@ struct input_absinfo {
        __s32 maximum;
        __s32 fuzz;
        __s32 flat;
+       __s32 resolution;
 };
 
 #define EVIOCGVERSION          _IOR('E', 0x01, int)                    /* get driver version */
@@ -106,6 +107,7 @@ struct input_absinfo {
 
 #define SYN_REPORT             0
 #define SYN_CONFIG             1
+#define SYN_MT_REPORT          2
 
 /*
  * Keys and buttons
@@ -238,6 +240,7 @@ struct input_absinfo {
 #define KEY_KPEQUAL            117
 #define KEY_KPPLUSMINUS                118
 #define KEY_PAUSE              119
+#define KEY_SCALE              120     /* AL Compiz Scale (Expose) */
 
 #define KEY_KPCOMMA            121
 #define KEY_HANGEUL            122
@@ -322,6 +325,7 @@ struct input_absinfo {
 #define KEY_PAUSECD            201
 #define KEY_PROG3              202
 #define KEY_PROG4              203
+#define KEY_DASHBOARD          204     /* AL Dashboard */
 #define KEY_SUSPEND            205
 #define KEY_CLOSE              206     /* AC Close */
 #define KEY_PLAY               207
@@ -371,6 +375,10 @@ struct input_absinfo {
 #define KEY_BRIGHTNESS_ZERO    244     /* brightness off, use ambient */
 #define KEY_DISPLAY_OFF                245     /* display device to off state */
 
+#define KEY_WIMAX              246
+
+/* Range 248 - 255 is reserved for special needs of AT keyboard driver */
+
 #define BTN_MISC               0x100
 #define BTN_0                  0x100
 #define BTN_1                  0x101
@@ -439,6 +447,7 @@ struct input_absinfo {
 #define BTN_STYLUS2            0x14c
 #define BTN_TOOL_DOUBLETAP     0x14d
 #define BTN_TOOL_TRIPLETAP     0x14e
+#define BTN_TOOL_QUADTAP       0x14f   /* Four fingers on trackpad */
 
 #define BTN_WHEEL              0x150
 #define BTN_GEAR_DOWN          0x150
@@ -532,8 +541,8 @@ struct input_absinfo {
 
 #define KEY_FRAMEBACK          0x1b4   /* Consumer - transport controls */
 #define KEY_FRAMEFORWARD       0x1b5
-
 #define KEY_CONTEXT_MENU       0x1b6   /* GenDesc - system context menu */
+#define KEY_MEDIA_REPEAT       0x1b7   /* Consumer - transport control */
 
 #define KEY_DEL_EOL            0x1c0
 #define KEY_DEL_EOS            0x1c1
@@ -573,9 +582,24 @@ struct input_absinfo {
 #define KEY_BRL_DOT9           0x1f9
 #define KEY_BRL_DOT10          0x1fa
 
+#define KEY_NUMERIC_0          0x200   /* used by phones, remote controls, */
+#define KEY_NUMERIC_1          0x201   /* and other keypads */
+#define KEY_NUMERIC_2          0x202
+#define KEY_NUMERIC_3          0x203
+#define KEY_NUMERIC_4          0x204
+#define KEY_NUMERIC_5          0x205
+#define KEY_NUMERIC_6          0x206
+#define KEY_NUMERIC_7          0x207
+#define KEY_NUMERIC_8          0x208
+#define KEY_NUMERIC_9          0x209
+#define KEY_NUMERIC_STAR       0x20a
+#define KEY_NUMERIC_POUND      0x20b
+
+#define KEY_CAMERA_FOCUS       0x210
+
 /* We avoid low common keys in module aliases so they don't get huge. */
 #define KEY_MIN_INTERESTING    KEY_MUTE
-#define KEY_MAX                        0x1ff
+#define KEY_MAX                        0x2ff
 #define KEY_CNT                        (KEY_MAX+1)
 
 /*
@@ -625,6 +649,18 @@ struct input_absinfo {
 #define ABS_TOOL_WIDTH         0x1c
 #define ABS_VOLUME             0x20
 #define ABS_MISC               0x28
+
+#define ABS_MT_TOUCH_MAJOR     0x30    /* Major axis of touching ellipse */
+#define ABS_MT_TOUCH_MINOR     0x31    /* Minor axis (omit if circular) */
+#define ABS_MT_WIDTH_MAJOR     0x32    /* Major axis of approaching ellipse */
+#define ABS_MT_WIDTH_MINOR     0x33    /* Minor axis (omit if circular) */
+#define ABS_MT_ORIENTATION     0x34    /* Ellipse orientation */
+#define ABS_MT_POSITION_X      0x35    /* Center X ellipse position */
+#define ABS_MT_POSITION_Y      0x36    /* Center Y ellipse position */
+#define ABS_MT_TOOL_TYPE       0x37    /* Type of touching device */
+#define ABS_MT_BLOB_ID         0x38    /* Group a set of packets as a blob */
+#define ABS_MT_TRACKING_ID     0x39    /* Unique ID of initiated contact */
+
 #define ABS_MAX                        0x3f
 #define ABS_CNT                        (ABS_MAX+1)
 
@@ -635,7 +671,17 @@ struct input_absinfo {
 #define SW_LID                 0x00  /* set = lid shut */
 #define SW_TABLET_MODE         0x01  /* set = tablet mode */
 #define SW_HEADPHONE_INSERT    0x02  /* set = inserted */
-#define SW_RADIO               0x03  /* set = radio enabled */
+#define SW_RFKILL_ALL          0x03  /* rfkill master switch, type "any"
+                                        set = radio enabled */
+#define SW_RADIO               SW_RFKILL_ALL   /* deprecated */
+#define SW_MICROPHONE_INSERT   0x04  /* set = inserted */
+#define SW_DOCK                        0x05  /* set = plugged into dock */
+#define SW_LINEOUT_INSERT      0x06  /* set = inserted */
+#define SW_JACK_PHYSICAL_INSERT 0x07  /* set = mechanical switch set */
+#define SW_VIDEOOUT_INSERT     0x08  /* set = inserted */
+#define SW_CAMERA_LENS_COVER   0x09  /* set = lens covered */
+#define SW_KEYPAD_SLIDE                0x0a  /* set = keypad slide out */
+#define SW_FRONT_PROXIMITY     0x0b  /* set = front proximity sensor active */
 #define SW_MAX                 0x0f
 #define SW_CNT                 (SW_MAX+1)
 
@@ -717,6 +763,12 @@ struct input_absinfo {
 #define BUS_ATARI              0x1B
 
 /*
+ * MT_TOOL types
+ */
+#define MT_TOOL_FINGER         0
+#define MT_TOOL_PEN            1
+
+/*
  * Values describing the status of a force-feedback effect
  */
 #define FF_STATUS_STOPPED      0x00
@@ -843,7 +895,7 @@ struct ff_periodic_effect {
        struct ff_envelope envelope;
 
        __u32 custom_len;
-       __s16 *custom_data;
+       __s16 __user *custom_data;
 };
 
 /**
@@ -969,9 +1021,12 @@ struct ff_effect {
  * @keycodesize: size of elements in keycode table
  * @keycode: map of scancodes to keycodes for this device
  * @setkeycode: optional method to alter current keymap, used to implement
- *     sparse keymaps. If not supplied default mechanism will be used
+ *     sparse keymaps. If not supplied default mechanism will be used.
+ *     The method is being called while holding event_lock and thus must
+ *     not sleep
  * @getkeycode: optional method to retrieve current keymap. If not supplied
- *     default mechanism will be used
+ *     default mechanism will be used. The method is being called while
+ *     holding event_lock and thus must not sleep
  * @ff: force feedback structure associated with the device if device
  *     supports force feedback effects
  * @repeat_key: stores key code of the last key pressed; used to implement
@@ -988,6 +1043,7 @@ struct ff_effect {
  * @absmin: minimum values for events coming from absolute axes
  * @absfuzz: describes noisiness for axes
  * @absflat: size of the center flat position (used by joydev)
+ * @absres: resolution used for events coming form absolute axes
  * @open: this method is called when the very first user calls
  *     input_open_device(). The driver must prepare the device
  *     to start generating events (start polling thread,
@@ -1023,10 +1079,6 @@ struct ff_effect {
  * @node: used to place the device onto input_dev_list
  */
 struct input_dev {
-       /* private: */
-       void *private;  /* do not use */
-       /* public: */
-
        const char *name;
        const char *phys;
        const char *uniq;
@@ -1067,6 +1119,7 @@ struct input_dev {
        int absmin[ABS_MAX + 1];
        int absfuzz[ABS_MAX + 1];
        int absflat[ABS_MAX + 1];
+       int absres[ABS_MAX + 1];
 
        int (*open)(struct input_dev *dev);
        void (*close)(struct input_dev *dev);
@@ -1079,7 +1132,7 @@ struct input_dev {
        struct mutex mutex;
 
        unsigned int users;
-       int going_away;
+       bool going_away;
 
        struct device dev;
 
@@ -1215,32 +1268,28 @@ struct input_handle {
        struct list_head        h_node;
 };
 
-#define to_dev(n) container_of(n, struct input_dev, node)
-#define to_handler(n) container_of(n, struct input_handler, node)
-#define to_handle(n) container_of(n, struct input_handle, d_node)
-#define to_handle_h(n) container_of(n, struct input_handle, h_node)
-
 struct input_dev *input_allocate_device(void);
 void input_free_device(struct input_dev *dev);
 
 static inline struct input_dev *input_get_device(struct input_dev *dev)
 {
-       return to_input_dev(get_device(&dev->dev));
+       return dev ? to_input_dev(get_device(&dev->dev)) : NULL;
 }
 
 static inline void input_put_device(struct input_dev *dev)
 {
-       put_device(&dev->dev);
+       if (dev)
+               put_device(&dev->dev);
 }
 
 static inline void *input_get_drvdata(struct input_dev *dev)
 {
-       return dev->private;
+       return dev_get_drvdata(&dev->dev);
 }
 
 static inline void input_set_drvdata(struct input_dev *dev, void *data)
 {
-       dev->private = data;
+       dev_set_drvdata(&dev->dev, data);
 }
 
 int __must_check input_register_device(struct input_dev *);
@@ -1249,6 +1298,9 @@ void input_unregister_device(struct input_dev *);
 int __must_check input_register_handler(struct input_handler *);
 void input_unregister_handler(struct input_handler *);
 
+int input_handler_for_each_handle(struct input_handler *, void *data,
+                                 int (*fn)(struct input_handle *, void *));
+
 int input_register_handle(struct input_handle *);
 void input_unregister_handle(struct input_handle *);
 
@@ -1293,6 +1345,11 @@ static inline void input_sync(struct input_dev *dev)
        input_event(dev, EV_SYN, SYN_REPORT, 0);
 }
 
+static inline void input_mt_sync(struct input_dev *dev)
+{
+       input_event(dev, EV_SYN, SYN_MT_REPORT, 0);
+}
+
 void input_set_capability(struct input_dev *dev, unsigned int type, unsigned int code);
 
 static inline void input_set_abs_params(struct input_dev *dev, int axis, int min, int max, int fuzz, int flat)
@@ -1332,6 +1389,10 @@ extern struct class input_class;
  * methods; erase() is optional. set_gain() and set_autocenter() need
  * only be implemented if driver sets up FF_GAIN and FF_AUTOCENTER
  * bits.
+ *
+ * Note that playback(), set_gain() and set_autocenter() are called with
+ * dev->event_lock spinlock held and interrupts off and thus may not
+ * sleep.
  */
 struct ff_device {
        int (*upload)(struct input_dev *dev, struct ff_effect *effect,