HID: wacom: move all quirks to wacom_setup_device_quirks
authorPing Cheng <pinglinux@gmail.com>
Wed, 15 Apr 2015 23:53:54 +0000 (16:53 -0700)
committerJiri Kosina <jkosina@suse.cz>
Thu, 23 Apr 2015 08:00:51 +0000 (10:00 +0200)
It makes probe routine easy to follow.

Signed-off-by: Ping Cheng <pingc@wacom.com>
Reviewed-by: Jason Gerecke <jason.gerecke@wacom.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
drivers/hid/wacom.h
drivers/hid/wacom_sys.c
drivers/hid/wacom_wac.c

index 024f4d89d5792ae9a04739b5b895647177e6ecd4..c76e21f486d83b51d6bf6c308d4de55404a58681 100644 (file)
@@ -134,7 +134,7 @@ static inline void wacom_schedule_work(struct wacom_wac *wacom_wac)
 extern const struct hid_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_device_quirks(struct wacom *wacom);
 int wacom_setup_pentouch_input_capabilities(struct input_dev *input_dev,
                                   struct wacom_wac *wacom_wac);
 int wacom_setup_pad_input_capabilities(struct input_dev *input_dev,
index e8607d0961384684ad94d94f2f4777adfdfbf42f..13d8c8fa8ed42c7b612face59969137379c9d656 100644 (file)
@@ -1475,44 +1475,7 @@ static int wacom_probe(struct hid_device *hdev,
        /* Retrieve the physical and logical size for touch devices */
        wacom_retrieve_hid_descriptor(hdev, features);
 
-       /*
-        * Intuos5 has no useful data about its touch interface in its
-        * HID descriptor. If this is the touch interface (PacketSize
-        * of WACOM_PKGLEN_BBTOUCH3), override the table values.
-        */
-       if (features->type >= INTUOS5S && features->type <= INTUOSHT) {
-               if (features->pktlen == WACOM_PKGLEN_BBTOUCH3) {
-                       features->device_type = BTN_TOOL_FINGER;
-
-                       features->x_max = 4096;
-                       features->y_max = 4096;
-               } else {
-                       features->device_type = BTN_TOOL_PEN;
-               }
-       }
-
-       /*
-        * Same thing for Bamboo 3rd gen.
-        */
-       if ((features->type == BAMBOO_PT) &&
-           (features->pktlen == WACOM_PKGLEN_BBTOUCH3) &&
-           (features->device_type == BTN_TOOL_PEN)) {
-               features->device_type = BTN_TOOL_FINGER;
-
-               features->x_max = 4096;
-               features->y_max = 4096;
-       }
-
-       /*
-        * Same thing for Bamboo PAD
-        */
-       if (features->type == BAMBOO_PAD)
-               features->device_type = BTN_TOOL_FINGER;
-
-       if (hdev->bus == BUS_BLUETOOTH)
-               features->quirks |= WACOM_QUIRK_BATTERY;
-
-       wacom_setup_device_quirks(features);
+       wacom_setup_device_quirks(wacom);
 
        /* set unit to "100th of a mm" for devices not reported by HID */
        if (!features->unit) {
index fa54d329065945bade5b9048df9cb5a98c0bf7f2..3609cbe9877b6a6365f0d372724346022dacaaa8 100644 (file)
@@ -2164,8 +2164,9 @@ 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)
+void wacom_setup_device_quirks(struct wacom *wacom)
 {
+       struct wacom_features *features = &wacom->wacom_wac.features;
 
        /* touch device found but size is not defined. use default */
        if (features->device_type == BTN_TOOL_FINGER && !features->x_max) {
@@ -2173,6 +2174,33 @@ void wacom_setup_device_quirks(struct wacom_features *features)
                features->y_max = 1023;
        }
 
+       /*
+        * Intuos5/Pro and Bamboo 3rd gen have no useful data about its
+        * touch interface in its HID descriptor. If this is the touch
+        * interface (PacketSize of WACOM_PKGLEN_BBTOUCH3), override the
+        * tablet values.
+        */
+       if ((features->type >= INTUOS5S && features->type <= INTUOSHT) ||
+               (features->type == BAMBOO_PT)) {
+               if (features->pktlen == WACOM_PKGLEN_BBTOUCH3) {
+                       features->device_type = BTN_TOOL_FINGER;
+
+                       features->x_max = 4096;
+                       features->y_max = 4096;
+               } else {
+                       features->device_type = BTN_TOOL_PEN;
+               }
+       }
+
+       /*
+        * Same thing for Bamboo PAD
+        */
+       if (features->type == BAMBOO_PAD)
+               features->device_type = BTN_TOOL_FINGER;
+
+       if (wacom->hdev->bus == BUS_BLUETOOTH)
+               features->quirks |= WACOM_QUIRK_BATTERY;
+
        /* quirk for bamboo touch with 2 low res touches */
        if (features->type == BAMBOO_PT &&
            features->pktlen == WACOM_PKGLEN_BBTOUCH) {
This page took 0.028956 seconds and 5 git commands to generate.