HID: wacom: PAD is independent with pen/touch
authorPing Cheng <pinglinux@gmail.com>
Fri, 21 Nov 2014 00:31:12 +0000 (16:31 -0800)
committerJiri Kosina <jkosina@suse.cz>
Wed, 26 Nov 2014 09:41:44 +0000 (10:41 +0100)
PAD can be on pen interface (Intuos Pro and Cintiq series) or touch
interface (Bamboo PT and Intuos PT series) or its own interface
(Bamboo pen-only and Intuos Pen M/S). We need to mark it independently.

Signed-off-by: Ping Cheng <pingc@wacom.com>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
drivers/hid/wacom_sys.c
drivers/hid/wacom_wac.h

index 68b6cd66f9c34274401fbe5802a2565b66433bab..eb5531657e4111cd4946e4a1d6705e0c9ca55eca 100644 (file)
@@ -1135,7 +1135,7 @@ static void wacom_clean_inputs(struct wacom *wacom)
                        input_free_device(wacom->wacom_wac.input);
        }
        if (wacom->wacom_wac.pad_input) {
-               if (wacom->wacom_wac.input_registered)
+               if (wacom->wacom_wac.pad_registered)
                        input_unregister_device(wacom->wacom_wac.pad_input);
                else
                        input_free_device(wacom->wacom_wac.pad_input);
@@ -1162,6 +1162,7 @@ static int wacom_register_inputs(struct wacom *wacom)
                error = input_register_device(input_dev);
                if (error)
                        return error;
+               wacom_wac->input_registered = true;
        }
 
        error = wacom_setup_pad_input_capabilities(pad_input_dev, wacom_wac);
@@ -1174,22 +1175,23 @@ static int wacom_register_inputs(struct wacom *wacom)
                error = input_register_device(pad_input_dev);
                if (error)
                        goto fail_register_pad_input;
+               wacom_wac->pad_registered = true;
 
                error = wacom_initialize_leds(wacom);
                if (error)
                        goto fail_leds;
        }
 
-       wacom_wac->input_registered = true;
-
        return 0;
 
 fail_leds:
        input_unregister_device(pad_input_dev);
        pad_input_dev = NULL;
+       wacom_wac->pad_registered = false;
 fail_register_pad_input:
        input_unregister_device(input_dev);
        wacom_wac->input = NULL;
+       wacom_wac->input_registered = false;
        return error;
 }
 
index 0f0b85ec13223a4495bbbf64713b3a4281133ee1..128cbb337ff6fd21db537fa50b7040cc89aed307 100644 (file)
@@ -183,6 +183,7 @@ struct wacom_wac {
        struct input_dev *input;
        struct input_dev *pad_input;
        bool input_registered;
+       bool pad_registered;
        int pid;
        int battery_capacity;
        int num_contacts_left;