Re: [PATCH] input: add EETI eGalax I2C capacitive multi touch driver.

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

 



Hi Gao,

2011/7/26 Wanlong Gao <gaowanlong@xxxxxxxxxxxxxx>
>
> On 07/26/2011 05:25 PM, Zhang Jiejing wrote:
>>
>> this patch adds EETI eGalax serial multi touch controller driver.
>>
>> EETI eGalax serial touch screen controller is a I2C based multiple
>> capacitive touch screen controller, it can supports 5 touch events maximum.
>>
>> Signed-off-by: Zhang Jiejing<jiejing.zhang@xxxxxxxxxxxxx>
>> ---
>>  drivers/input/touchscreen/Kconfig     |   10 +
>>  drivers/input/touchscreen/Makefile    |    1 +
>>  drivers/input/touchscreen/egalax_ts.c |  314 +++++++++++++++++++++++++++++++++
>>  3 files changed, 325 insertions(+), 0 deletions(-)
>>  create mode 100644 drivers/input/touchscreen/egalax_ts.c
>>
>
>> +
>> +       if (down) {
>> +               /* since egalax only report one of multi touch event,
>> +                * so we need record pervious event with different id
>> +                * and report them.*/
>> +               events[id].valid = valid;
>> +               events[id].status = down;
>> +               events[id].x = x;
>> +               events[id].y = y;
>> +
>> +               for (i = 0; i<  MAX_SUPPORT_POINTS; i++) {
>> +                       if (!events[i].valid)
>> +                               continue;
>> +                       dev_dbg(&client->dev, "report id:%d valid:%d x:%d y:%d",
>> +                               i, valid, x, y);
>> +
>> +                       input_report_abs(input_dev,
>> +                                        ABS_MT_TRACKING_ID, i);
>> +                       input_report_abs(input_dev,
>> +                                        ABS_MT_TOUCH_MAJOR, 1);
>> +                       input_report_abs(input_dev,
>> +                                        ABS_MT_POSITION_X, events[i].x);
>> +                       input_report_abs(input_dev,
>> +                                        ABS_MT_POSITION_Y, events[i].y);
>> +                       input_mt_sync(input_dev);
>> +               }
>> +       } else {
>> +               dev_dbg(&client->dev, "release id:%d\n", id);
>> +               events[id].valid = 0;
>> +               events[id].status = 0;
>> +               input_report_abs(input_dev, ABS_MT_TRACKING_ID, id);
>> +               input_event(input_dev, EV_ABS, ABS_MT_TOUCH_MAJOR, 0);
>> +               input_mt_sync(input_dev);
>> +       }
>> +
>> +       input_sync(input_dev);
>
> need re-sync here ?

it's not re-sync, input_mt_sync() is different from input_sync(), the
mt_sync is used to notify a multi touch event is finish. but a
input_sync() means a input event is finished.
eg,
one input event may have many multi touch event.
[MT 1,  x, y]
[mt sync]
[MT 2, x, y]
[mt sync]
[input sync]
[MT 1,  x, y]
[mt sync]
[MT 2, x, y]
[mt sync]
[input sync]
...

>
>> +       data->client = client;
>> +       data->input_dev = input_dev;
>> +       /* controller may be in sleep, wake it up. */
>> +       egalax_wake_up_device(client);
>> +       ret = egalax_firmware_version(client);
>> +       if (ret<  0) {
>> +               dev_err(&client->dev,
>> +                       "egalax_ts: failed to read firmware version\n");
>> +               ret = -EIO;
>> +               goto err_free_dev;
>> +       }
>> +
>> +       input_dev->name = "EETI eGalax Touch Screen";
>> +       input_dev->phys = "I2C",
>> +       input_dev->id.bustype = BUS_I2C;
>> +       input_dev->dev.parent =&client->dev;
>> +
>> +       __set_bit(EV_ABS, input_dev->evbit);
>> +       __set_bit(EV_KEY, input_dev->evbit);
>> +       __set_bit(BTN_TOUCH, input_dev->keybit);
>> +       __set_bit(ABS_X, input_dev->absbit);
>> +       __set_bit(ABS_Y, input_dev->absbit);
>> +       input_set_abs_params(input_dev, ABS_X, 0, 32767, 0, 0);
>> +       input_set_abs_params(input_dev, ABS_Y, 0, 32767, 0, 0);
>
> make 32767 to macro here ?

This is a constant to the controller, resolution of x, and y.
maybe you want this become a macro, but it's just style things.

you can find lots of example by grep" input_set_abs_params" under
driver/input/touchscreen.

>
> --
> Thanks
> Best Regards
> Wanlong Gao

Thanks.

BR,
Jiejing
--
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