Re: [PATCH 1/5] input - wacom: fix retrieving touch_max bug

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Sorry for the noise. Please ignore this patch. Something is wrong with
my codebase.

Ping

On Mon, Jun 25, 2012 at 1:26 PM, Ping Cheng <pinglinux@xxxxxxxxx> wrote:
> rep_data has already been declared as a pointer.
>
> Signed-off-by: Ping Cheng <pingc@xxxxxxxxx>
> ---
>  drivers/input/tablet/wacom.h     |    2 +-
>  drivers/input/tablet/wacom_sys.c |   49 ++++++++-------------
>  drivers/input/tablet/wacom_wac.c |   90 +-------------------------------------
>  drivers/input/tablet/wacom_wac.h |    8 ---
>  4 files changed, 21 insertions(+), 128 deletions(-)
>
> diff --git a/drivers/input/tablet/wacom.h b/drivers/input/tablet/wacom.h
> index b79d451..51b7e37 100644
> --- a/drivers/input/tablet/wacom.h
> +++ b/drivers/input/tablet/wacom.h
> @@ -135,6 +135,6 @@ 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);
> -int wacom_setup_input_capabilities(struct input_dev *input_dev,
> +void wacom_setup_input_capabilities(struct input_dev *input_dev,
>                                   struct wacom_wac *wacom_wac);
>  #endif
> diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c
> index 9e8fdcf..0494cec 100644
> --- a/drivers/input/tablet/wacom_sys.c
> +++ b/drivers/input/tablet/wacom_sys.c
> @@ -213,7 +213,7 @@ static void wacom_retrieve_report_data(struct usb_interface *intf,
>
>                rep_data[0] = 12;
>                result = wacom_get_report(intf, WAC_HID_FEATURE_REPORT,
> -                                         rep_data[0], &rep_data, 2,
> +                                         rep_data[0], rep_data, 2,
>                                          WAC_MSG_RETRIES);
>
>                if (result >= 0 && rep_data[1] > 2)
> @@ -318,9 +318,6 @@ static int wacom_parse_hid(struct usb_interface *intf,
>                                                        features->pktlen = WACOM_PKGLEN_TPC2FG;
>                                                }
>
> -                                               if (features->type == MTSCREEN)
> -                                                       features->pktlen = WACOM_PKGLEN_MTOUCH;
> -
>                                                if (features->type == BAMBOO_PT) {
>                                                        /* need to reset back */
>                                                        features->pktlen = WACOM_PKGLEN_BBTOUCH;
> @@ -355,7 +352,7 @@ static int wacom_parse_hid(struct usb_interface *intf,
>                                        if (finger) {
>                                                int type = features->type;
>
> -                                               if (type == TABLETPC2FG || type == MTSCREEN) {
> +                                               if (type == TABLETPC2FG) {
>                                                        features->y_max =
>                                                                get_unaligned_le16(&report[i + 3]);
>                                                        features->y_phy =
> @@ -437,28 +434,22 @@ static int wacom_query_tablet_data(struct usb_interface *intf, struct wacom_feat
>        if (!rep_data)
>                return error;
>
> -       /* ask to report Wacom data */
> -       if (features->device_type == BTN_TOOL_FINGER) {
> -               /* if it is an MT Tablet PC touch */
> -               if (features->type > TABLETPC) {
> -                       do {
> -                               rep_data[0] = 3;
> -                               rep_data[1] = 4;
> -                               rep_data[2] = 0;
> -                               rep_data[3] = 0;
> -                               report_id = 3;
> -                               error = wacom_set_report(intf,
> -                                                        WAC_HID_FEATURE_REPORT,
> -                                                        report_id,
> -                                                        rep_data, 4, 1);
> -                               if (error >= 0)
> -                                       error = wacom_get_report(intf,
> -                                                       WAC_HID_FEATURE_REPORT,
> -                                                       report_id,
> -                                                       rep_data, 4, 1);
> -                       } while ((error < 0 || rep_data[1] != 4) &&
> -                                limit++ < WAC_MSG_RETRIES);
> -               }
> +       /* ask to report tablet data if it is MT Tablet PC or
> +        * not a Tablet PC */
> +       if (features->type == TABLETPC2FG) {
> +               do {
> +                       rep_data[0] = 3;
> +                       rep_data[1] = 4;
> +                       rep_data[2] = 0;
> +                       rep_data[3] = 0;
> +                       report_id = 3;
> +                       error = wacom_set_report(intf, WAC_HID_FEATURE_REPORT,
> +                                                report_id, rep_data, 4, 1);
> +                       if (error >= 0)
> +                               error = wacom_get_report(intf,
> +                                               WAC_HID_FEATURE_REPORT,
> +                                               report_id, rep_data, 4, 1);
> +               } while ((error < 0 || rep_data[1] != 4) && limit++ < WAC_MSG_RETRIES);
>        } else if (features->type <= BAMBOO_PT &&
>                   features->type != WIRELESS &&
>                   features->device_type == BTN_TOOL_PEN) {
> @@ -1005,9 +996,7 @@ static int wacom_register_input(struct wacom *wacom)
>        input_set_drvdata(input_dev, wacom);
>
>        wacom_wac->input = input_dev;
> -       error = wacom_setup_input_capabilities(input_dev, wacom_wac);
> -       if (error)
> -               goto fail1;
> +       wacom_setup_input_capabilities(input_dev, wacom_wac);
>
>        error = input_register_device(input_dev);
>        if (error)
> diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c
> index 4453864..1491a91 100644
> --- a/drivers/input/tablet/wacom_wac.c
> +++ b/drivers/input/tablet/wacom_wac.c
> @@ -776,72 +776,6 @@ static int wacom_intuos_irq(struct wacom_wac *wacom)
>        return 1;
>  }
>
> -static int find_slot_from_contactid(struct wacom_wac *wacom, int contactid)
> -{
> -       int touch_max = wacom->features.touch_max;
> -       int i;
> -
> -       if (!wacom->slots)
> -               return -1;
> -
> -       for (i = 0; i < touch_max; ++i) {
> -               if (wacom->slots[i] == contactid)
> -                       return i;
> -       }
> -       for (i = 0; i < touch_max; ++i) {
> -               if (wacom->slots[i] == -1)
> -                       return i;
> -       }
> -       return -1;
> -}
> -
> -static int wacom_mt_touch(struct wacom_wac *wacom)
> -{
> -       struct input_dev *input = wacom->input;
> -       char *data = wacom->data;
> -       int i;
> -       int current_num_contacts = data[2];
> -       int contacts_to_send = 0;
> -
> -       /*
> -        * First packet resets the counter since only the first
> -        * packet in series will have non-zero current_num_contacts.
> -        */
> -       if (current_num_contacts)
> -               wacom->num_contacts_left = current_num_contacts;
> -
> -       /* There are at most 5 contacts per packet */
> -       contacts_to_send = min(5, wacom->num_contacts_left);
> -
> -       for (i = 0; i < contacts_to_send; i++) {
> -               int offset = (WACOM_BYTES_PER_MT_PACKET * i) + 3;
> -               bool touch = data[offset] & 0x1;
> -               int id = le16_to_cpup((__le16 *)&data[offset + 1]);
> -               int slot = find_slot_from_contactid(wacom, id);
> -
> -               if (slot < 0)
> -                       continue;
> -
> -               input_mt_slot(input, slot);
> -               input_mt_report_slot_state(input, MT_TOOL_FINGER, touch);
> -               if (touch) {
> -                       int x = le16_to_cpup((__le16 *)&data[offset + 7]);
> -                       int y = le16_to_cpup((__le16 *)&data[offset + 9]);
> -                       input_report_abs(input, ABS_MT_POSITION_X, x);
> -                       input_report_abs(input, ABS_MT_POSITION_Y, y);
> -               }
> -               wacom->slots[slot] = touch ? id : -1;
> -       }
> -
> -       input_mt_report_pointer_emulation(input, true);
> -
> -       wacom->num_contacts_left -= contacts_to_send;
> -       if (wacom->num_contacts_left < 0)
> -               wacom->num_contacts_left = 0;
> -
> -       return 1;
> -}
> -
>  static int wacom_tpc_mt_touch(struct wacom_wac *wacom)
>  {
>        struct input_dev *input = wacom->input;
> @@ -880,9 +814,6 @@ static int wacom_tpc_single_touch(struct wacom_wac *wacom, size_t len)
>        bool prox;
>        int x = 0, y = 0;
>
> -       if (wacom->features.touch_max > 1 || len > WACOM_PKGLEN_TPC2FG)
> -               return 0;
> -
>        if (!wacom->shared->stylus_in_proximity) {
>                if (len == WACOM_PKGLEN_TPC1FG) {
>                        prox = data[0] & 0x01;
> @@ -964,9 +895,6 @@ static int wacom_tpc_irq(struct wacom_wac *wacom, size_t len)
>                case WACOM_REPORT_TPC1FGE:
>                        return wacom_tpc_single_touch(wacom, len);
>
> -               case WACOM_REPORT_TPCMT:
> -                       return wacom_mt_touch(wacom);
> -
>                case WACOM_REPORT_PENABLED:
>                        return wacom_tpc_pen(wacom);
>                }
> @@ -1247,7 +1175,6 @@ void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len)
>        case TABLETPC:
>        case TABLETPCE:
>        case TABLETPC2FG:
> -       case MTSCREEN:
>                sync = wacom_tpc_irq(wacom_wac, len);
>                break;
>
> @@ -1351,7 +1278,7 @@ static unsigned int wacom_calculate_touch_res(unsigned int logical_max,
>        return (logical_max * 100) / physical_max;
>  }
>
> -int wacom_setup_input_capabilities(struct input_dev *input_dev,
> +void wacom_setup_input_capabilities(struct input_dev *input_dev,
>                                   struct wacom_wac *wacom_wac)
>  {
>        struct wacom_features *features = &wacom_wac->features;
> @@ -1548,18 +1475,8 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev,
>                break;
>
>        case TABLETPC2FG:
> -       case MTSCREEN:
>                if (features->device_type == BTN_TOOL_FINGER) {
>
> -                       wacom_wac->slots = kmalloc(features->touch_max *
> -                                                       sizeof(int),
> -                                                  GFP_KERNEL);
> -                       if (!wacom_wac->slots)
> -                               return -ENOMEM;
> -
> -                       for (i = 0; i < features->touch_max; i++)
> -                               wacom_wac->slots[i] = -1;
> -
>                        input_mt_init_slots(input_dev, features->touch_max);
>                        input_set_abs_params(input_dev, ABS_MT_TOOL_TYPE,
>                                        0, MT_TOOL_MAX, 0, 0);
> @@ -1646,7 +1563,6 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev,
>                }
>                break;
>        }
> -       return 0;
>  }
>
>  static const struct wacom_features wacom_features_0x00 =
> @@ -1879,9 +1795,6 @@ static const struct wacom_features wacom_features_0xE3 =
>        { "Wacom ISDv4 E3",       WACOM_PKGLEN_TPC2FG,    26202, 16325,  255,
>          0, TABLETPC2FG, WACOM_INTUOS_RES, WACOM_INTUOS_RES,
>          .touch_max = 2 };
> -static const struct wacom_features wacom_features_0xE5 =
> -       { "Wacom ISDv4 E5",       WACOM_PKGLEN_MTOUCH,    26202, 16325,  255,
> -         0, MTSCREEN, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
>  static const struct wacom_features wacom_features_0xE6 =
>        { "Wacom ISDv4 E6",       WACOM_PKGLEN_TPC2FG,    27760, 15694,  255,
>          0, TABLETPC2FG, WACOM_INTUOS_RES, WACOM_INTUOS_RES,
> @@ -2066,7 +1979,6 @@ const struct usb_device_id wacom_ids[] = {
>        { USB_DEVICE_WACOM(0x9F) },
>        { USB_DEVICE_WACOM(0xE2) },
>        { USB_DEVICE_WACOM(0xE3) },
> -       { USB_DEVICE_WACOM(0xE5) },
>        { USB_DEVICE_WACOM(0xE6) },
>        { USB_DEVICE_WACOM(0xEC) },
>        { USB_DEVICE_WACOM(0xED) },
> diff --git a/drivers/input/tablet/wacom_wac.h b/drivers/input/tablet/wacom_wac.h
> index bd5d37b..219272f 100644
> --- a/drivers/input/tablet/wacom_wac.h
> +++ b/drivers/input/tablet/wacom_wac.h
> @@ -25,10 +25,6 @@
>  #define WACOM_PKGLEN_BBTOUCH3  64
>  #define WACOM_PKGLEN_BBPEN     10
>  #define WACOM_PKGLEN_WIRELESS  32
> -#define WACOM_PKGLEN_MTOUCH    62
> -
> -/* wacom data size per MT contact */
> -#define WACOM_BYTES_PER_MT_PACKET      11
>
>  /* device IDs */
>  #define STYLUS_DEVICE_ID       0x02
> @@ -45,7 +41,6 @@
>  #define WACOM_REPORT_INTUOS5PAD                3
>  #define WACOM_REPORT_TPC1FG            6
>  #define WACOM_REPORT_TPC2FG            13
> -#define WACOM_REPORT_TPCMT             13
>  #define WACOM_REPORT_TPCHID            15
>  #define WACOM_REPORT_TPCST             16
>  #define WACOM_REPORT_TPC1FGE           18
> @@ -83,7 +78,6 @@ enum {
>        TABLETPC,   /* add new TPC below */
>        TABLETPCE,
>        TABLETPC2FG,
> -       MTSCREEN,
>        MAX_TYPE
>  };
>
> @@ -126,8 +120,6 @@ struct wacom_wac {
>        struct input_dev *input;
>        int pid;
>        int battery_capacity;
> -       int num_contacts_left;
> -       int *slots;
>  };
>
>  #endif
> --
> 1.7.7.6
>
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux