[PATCH] Correctly identify touchpads (Was Re: inputattach, upstream and lshal ?)
Dmitry Torokhov
dmitry.torokhov at gmail.com
Mon Nov 2 20:31:39 PST 2009
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 at gmail.com>
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 at mail.ru>
---
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:
;
More information about the hal
mailing list