Input: wacom - collect device quirks into single function
authorHenrik Rydberg <rydberg@euromail.se>
Sun, 5 Sep 2010 19:26:16 +0000 (12:26 -0700)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Sun, 5 Sep 2010 19:58:12 +0000 (12:58 -0700)
Collect device-specific code into a single function, and use quirks to
flag specific behavior instead.

Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Acked-by: Ping Cheng <pingc@wacom.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
drivers/input/tablet/wacom.h
drivers/input/tablet/wacom_sys.c
drivers/input/tablet/wacom_wac.c
drivers/input/tablet/wacom_wac.h

index 284dfaab6b8cc67d375ca2c1de8aa639bbc6aaae..de5adb109030640d4ccde73787582ccef97d323a 100644 (file)
@@ -118,6 +118,7 @@ struct wacom {
 extern const struct usb_device_id wacom_ids[];
 
 void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len);
+void wacom_setup_device_quirks(struct wacom_features *features);
 void wacom_setup_input_capabilities(struct input_dev *input_dev,
                                    struct wacom_wac *wacom_wac);
 #endif
index 98cba08bb96e3c5a8f445f1f875c4727ba7d01f3..fc6fd53c1af19c0b74e0d830a54cea6fa23995f3 100644 (file)
@@ -381,12 +381,6 @@ static int wacom_retrieve_hid_descriptor(struct usb_interface *intf,
        if (error)
                goto out;
 
-       /* touch device found but size is not defined. use default */
-       if (features->device_type == BTN_TOOL_DOUBLETAP && !features->x_max) {
-               features->x_max = 1023;
-               features->y_max = 1023;
-       }
-
  out:
        return error;
 }
@@ -522,10 +516,11 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i
        if (error)
                goto fail2;
 
+       wacom_setup_device_quirks(features);
+
        strlcpy(wacom_wac->name, features->name, sizeof(wacom_wac->name));
 
-       if (features->type == TABLETPC || features->type == TABLETPC2FG ||
-           features->type == BAMBOO_PT) {
+       if (features->quirks & WACOM_QUIRK_MULTI_INPUT) {
                /* Append the device type to the name */
                strlcat(wacom_wac->name,
                        features->device_type == BTN_TOOL_PEN ?
index 6d7e1647715f0bd8f8580d66429e7948f3b1e021..44b4a59750d84a1373bd1fba2df2739b1320fa4e 100644 (file)
@@ -941,6 +941,22 @@ static void wacom_setup_intuos(struct wacom_wac *wacom_wac)
        input_set_abs_params(input_dev, ABS_THROTTLE, -1023, 1023, 0, 0);
 }
 
+
+void wacom_setup_device_quirks(struct wacom_features *features)
+{
+
+       /* touch device found but size is not defined. use default */
+       if (features->device_type == BTN_TOOL_DOUBLETAP && !features->x_max) {
+               features->x_max = 1023;
+               features->y_max = 1023;
+       }
+
+       /* these device have multiple inputs */
+       if (features->type == TABLETPC || features->type == TABLETPC2FG ||
+           features->type == BAMBOO_PT)
+               features->quirks |= WACOM_QUIRK_MULTI_INPUT;
+}
+
 void wacom_setup_input_capabilities(struct input_dev *input_dev,
                                    struct wacom_wac *wacom_wac)
 {
index fb30895d63e3f3fcb94ddfd8917b56eb5b8c1f69..6a1ff10b095a5494ec02a76b812c513816de2cb9 100644 (file)
@@ -38,6 +38,9 @@
 #define WACOM_REPORT_TPC1FG            6
 #define WACOM_REPORT_TPC2FG            13
 
+/* device quirks */
+#define WACOM_QUIRK_MULTI_INPUT                0x0001
+
 enum {
        PENPARTNER = 0,
        GRAPHIRE,
@@ -79,6 +82,7 @@ struct wacom_features {
        int y_fuzz;
        int pressure_fuzz;
        int distance_fuzz;
+       unsigned quirks;
 };
 
 struct wacom_shared {