[PATCH] Correctly identify touchpads (Was Re: inputattach, upstream and lshal ?)

View: New views
2 Messages — Rating Filter:   Alert me  

Parent Message unknown [PATCH] Correctly identify touchpads (Was Re: inputattach, upstream and lshal ?)

by Dmitry Torokhov-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Tias,

On Sun, Oct 25, 2009 at 10:56:56PM +0100, Tias wrote:

> Dmitry Torokhov wrote:
>> On Sun, Oct 25, 2009 at 05:20:31PM +0100, Tias wrote:
>>>
>>>
>>> So my questions is: is it possible for inputattach in case of a  
>>> touchscreen to set:
>>>   info.capabilities = {'input', 'button', 'input.touchscreen'}
>>> (string  list)
>>>
>>> This way the evdev driver would automatically correctly be loaded for
>>>  all touchscreens.
>>
>> This is not the task of inputattach but rather HAL misidentifying the
>> device:
>>
>> if (test_bit (BTN_TOUCH, bitmask_key)) {
>> hal_device_add_capability (d, "input.touchpad");
>> goto out;
>> }
>>
>> but it should be doing the test for BTN_TOOL_FINGER instead.
>
> Ah, OK.
> I'm not sure where you found that code.

It is at:

        git://www.freedesktop.org/hal

but I am not sure if they are taking any patches since they are trying
to deprecate HAL in favor of DeviceKit and other...

> Do you have an idea for a patch  
> or should we send a bugreport somewhere ?
>

Something like below should work, I think.

--
Dmitry


From: Dmitry Torokhov <dmitry.torokhov@...>
Subject: [PATCH] Correctly identify touchpads

BTN_TOUCH (as well as ABS_PRESSURE) is used not only by touchpads but
by touchscreens as well. The proper ceck for a touchpad is presence
of BTN_TOOL_FINGER and absence of BTN_TOOL_PEN (the latter to filter
out some tablets that use BTN_TOOL_FINGER).

Tablet matching should be on either BTN_TOOL_PEN or BTN_STULYS.

Signed-off-by: Dmitry Torokhov <dtor@...>
---
 hald/linux/device.c |    9 ++-------
 1 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/hald/linux/device.c b/hald/linux/device.c
index 2eca1ef..e7c9d4f 100644
--- a/hald/linux/device.c
+++ b/hald/linux/device.c
@@ -1157,12 +1157,12 @@ input_test_abs (HalDevice *d, const char *sysfs_path)
  {
  num_bits_key = input_str_to_bitmask (s, bitmask_key, sizeof (bitmask_key));
 
- if (test_bit (BTN_STYLUS, bitmask_key)) {
+ if (test_bit (BTN_STYLUS, bitmask_key) || test_bit (BTN_TOOL_PEN, bitmask_key)) {
  hal_device_add_capability (d, "input.tablet");
  goto out;
  }
 
- if (test_bit (BTN_TOUCH, bitmask_key)) {
+ if (test_bit (BTN_TOOL_FINGER, bitmask_key) && !test_bit (BTN_TOOL_PEN, bitmask_key)) {
  hal_device_add_capability (d, "input.touchpad");
  goto out;
  }
@@ -1181,11 +1181,6 @@ input_test_abs (HalDevice *d, const char *sysfs_path)
  goto out;
  }
  }
-
- if (test_bit (ABS_PRESSURE, bitmask_abs)) {
- hal_device_add_capability (d, "input.touchpad");
- goto out;
- }
  }
 out:
  ;

_______________________________________________
hal mailing list
hal@...
http://lists.freedesktop.org/mailman/listinfo/hal

Parent Message unknown Re: [PATCH] Correctly identify touchpads (Was Re: inputattach, upstream and lshal ?)

by Dmitry Torokhov-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Tue, Nov 03, 2009 at 12:11:57PM +0100, Tias wrote:

> On Mon, Nov 02, 2009 at 08:31:39PM -0800, Dmitry Torokhov wrote:
> > Hi Tias,
> >
> > On Sun, Oct 25, 2009 at 10:56:56PM +0100, Tias wrote:
> > > Dmitry Torokhov wrote:
> > >> On Sun, Oct 25, 2009 at 05:20:31PM +0100, Tias wrote:
> > >>>
> > >>>
> > >>> So my questions is: is it possible for inputattach in case of a  
> > >>> touchscreen to set:
> > >>>   info.capabilities = {'input', 'button', 'input.touchscreen'}
> > >>> (string  list)
> > >>>
> > >>> This way the evdev driver would automatically correctly be loaded for
> > >>>  all touchscreens.
> > >>
> > >> This is not the task of inputattach but rather HAL misidentifying the
> > >> device:
> > >>
> > >> if (test_bit (BTN_TOUCH, bitmask_key)) {
> > >> hal_device_add_capability (d, "input.touchpad");
> > >> goto out;
> > >> }
> > >>
> > >> but it should be doing the test for BTN_TOOL_FINGER instead.
> > >
> > > Ah, OK.
> > > I'm not sure where you found that code.
> >
> > It is at:
> >
> > git://www.freedesktop.org/hal
> >
> > but I am not sure if they are taking any patches since they are trying
> > to deprecate HAL in favor of DeviceKit and other...
> >
> > > Do you have an idea for a patch  
> > > or should we send a bugreport somewhere ?
> > >
> >
> > Something like below should work, I think.
> >
> > --
> > Dmitry
> >
> >
> > From: Dmitry Torokhov <dmitry.torokhov@...>
> > Subject: [PATCH] Correctly identify touchpads
> >
> > BTN_TOUCH (as well as ABS_PRESSURE) is used not only by touchpads but
> > by touchscreens as well. The proper ceck for a touchpad is presence
> > of BTN_TOOL_FINGER and absence of BTN_TOOL_PEN (the latter to filter
> > out some tablets that use BTN_TOOL_FINGER).
> >
> > Tablet matching should be on either BTN_TOOL_PEN or BTN_STULYS.
>
> Aha, this is a nice explanation of how capability detection for
> touchpads and tablets should be done. Judging from the code in git
> though, there is no capability detection for "input.touchscreen" yet.
> Should this be something like BTN_TOUCH && !BTN_TOOL_FINGER ?
>

Given how the code is organized I think just testing for BTN_TOUCH will
leave us with touchscreens. But in general you are correct,
BTN_TOUCH && !BTN_TOOL_FINGER should give you touchscreens.

--
Dmitry
_______________________________________________
hal mailing list
hal@...
http://lists.freedesktop.org/mailman/listinfo/hal