* Asus eee-top touch screen
@ 2009-05-24 7:32 Gabriele Turchi
2009-05-25 8:26 ` Andrey Panin
0 siblings, 1 reply; 2+ messages in thread
From: Gabriele Turchi @ 2009-05-24 7:32 UTC (permalink / raw)
To: linux-kernel
[-- Attachment #1.1: Type: text/plain, Size: 1012 bytes --]
Hi all.
I've done some tests to use the touch screen included in the Asus
eee-top PC under Fedora 10/11. From the first results, the touch screen
was detected, but only the mouse button events are generated. I've
googled around a bit to find a solution, but found nothing.
Looking into kernel and X sources, the more viable solution for me was
to write a little kernel module, to modify a bit the event's stream to
make them compatible with X needs.
My module is attached, even if I fully understand that this module could
be the worst conceived and worst written ever... :-)
To be serious: my choice was to make the less invasive solution, and
this module appear to reach the goal: my touch screen works well now.
Maybe mine was the wrong approach, but I've found so little
documentation on how to make a better one. I'll obviously accept any
useful suggestion.
I hope this could be useful.
Gabriele Turchi
P.S.: Please CC me, I'm not subscribed, and my apologies for my horrible
English.
[-- Attachment #1.2: hid-touchpack.c --]
[-- Type: text/plain, Size: 1859 bytes --]
/*
* HID driver for TouchPack touchscreen
* (ASUS eee top touch screen)
*
* Copyright (c) 2009 Gabriele Turchi - gabriele.turchi@l39a.com
*/
/*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation; either version 2 of the License, or (at your option)
* any later version.
*/
#include <linux/device.h>
#include <linux/hid.h>
#include <linux/module.h>
#include "hid-ids.h"
static int tp_input_mapping(struct hid_device *device, struct hid_input *hi,
struct hid_field *field, struct hid_usage *usage,
unsigned long **bit, int *max)
{
/* This is needed for evdev compatibility: these events are (apparently) never generated, but
* X11 evdev driver goes mad with it.
*/
if ( (usage->hid & HID_USAGE_PAGE) == HID_UP_DIGITIZER) {
printk(KERN_INFO "tp_input_mapping: discard HID_UP_DIGITIZER => 0x%04X\n", usage->hid);
return -1;
}
return 0;
}
static int tp_event(struct hid_device *device, struct hid_field *field, struct hid_usage *usage, __s32 value)
{
/* "Somewere" the right axis number is changed with the wrong one.
* Here we restore the correct values.
*/
if ( (usage->code == 0x02) || (usage->code == 0x03) )
usage->code -= 2;
return 0;
}
static const struct hid_device_id tp_devices[] = {
{ HID_USB_DEVICE( 0x1bfd, 0x1688) },
{ }
};
MODULE_DEVICE_TABLE(hid, tp_devices);
static struct hid_driver tp_driver = {
.name = "touchpack",
.id_table = tp_devices,
.input_mapping = tp_input_mapping,
.event = tp_event,
};
static int tp_init(void)
{
return hid_register_driver(&tp_driver);
}
static void tp_exit(void)
{
hid_unregister_driver(&tp_driver);
}
module_init(tp_init);
module_exit(tp_exit);
MODULE_LICENSE("GPL");
HID_COMPAT_LOAD_DRIVER(touchpack);
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/x-pkcs7-signature, Size: 6151 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: Asus eee-top touch screen
2009-05-24 7:32 Asus eee-top touch screen Gabriele Turchi
@ 2009-05-25 8:26 ` Andrey Panin
0 siblings, 0 replies; 2+ messages in thread
From: Andrey Panin @ 2009-05-25 8:26 UTC (permalink / raw)
To: Gabriele Turchi; +Cc: linux-kernel, linux-input
Added linux-input@vger.kernel.org to the CC.
On 144, 05 24, 2009 at 09:32:23AM +0200, Gabriele Turchi wrote:
> Hi all.
>
> I've done some tests to use the touch screen included in the Asus
> eee-top PC under Fedora 10/11. From the first results, the touch screen
> was detected, but only the mouse button events are generated. I've
> googled around a bit to find a solution, but found nothing.
>
> Looking into kernel and X sources, the more viable solution for me was
> to write a little kernel module, to modify a bit the event's stream to
> make them compatible with X needs.
>
> My module is attached, even if I fully understand that this module could
> be the worst conceived and worst written ever... :-)
>
> To be serious: my choice was to make the less invasive solution, and
> this module appear to reach the goal: my touch screen works well now.
> Maybe mine was the wrong approach, but I've found so little
> documentation on how to make a better one. I'll obviously accept any
> useful suggestion.
>
> I hope this could be useful.
>
> Gabriele Turchi
>
> P.S.: Please CC me, I'm not subscribed, and my apologies for my horrible
> English.
>
>
> /*
> * HID driver for TouchPack touchscreen
> * (ASUS eee top touch screen)
> *
> * Copyright (c) 2009 Gabriele Turchi - gabriele.turchi@l39a.com
> */
>
> /*
> * This program is free software; you can redistribute it and/or modify it
> * under the terms of the GNU General Public License as published by the Free
> * Software Foundation; either version 2 of the License, or (at your option)
> * any later version.
> */
>
> #include <linux/device.h>
> #include <linux/hid.h>
> #include <linux/module.h>
>
> #include "hid-ids.h"
>
> static int tp_input_mapping(struct hid_device *device, struct hid_input *hi,
> struct hid_field *field, struct hid_usage *usage,
> unsigned long **bit, int *max)
> {
> /* This is needed for evdev compatibility: these events are (apparently) never generated, but
> * X11 evdev driver goes mad with it.
> */
>
> if ( (usage->hid & HID_USAGE_PAGE) == HID_UP_DIGITIZER) {
> printk(KERN_INFO "tp_input_mapping: discard HID_UP_DIGITIZER => 0x%04X\n", usage->hid);
> return -1;
> }
>
> return 0;
> }
>
> static int tp_event(struct hid_device *device, struct hid_field *field, struct hid_usage *usage, __s32 value)
> {
> /* "Somewere" the right axis number is changed with the wrong one.
> * Here we restore the correct values.
> */
>
> if ( (usage->code == 0x02) || (usage->code == 0x03) )
> usage->code -= 2;
> return 0;
> }
>
>
> static const struct hid_device_id tp_devices[] = {
> { HID_USB_DEVICE( 0x1bfd, 0x1688) },
> { }
> };
> MODULE_DEVICE_TABLE(hid, tp_devices);
>
> static struct hid_driver tp_driver = {
> .name = "touchpack",
> .id_table = tp_devices,
> .input_mapping = tp_input_mapping,
> .event = tp_event,
> };
>
> static int tp_init(void)
> {
> return hid_register_driver(&tp_driver);
> }
>
> static void tp_exit(void)
> {
> hid_unregister_driver(&tp_driver);
> }
>
> module_init(tp_init);
> module_exit(tp_exit);
> MODULE_LICENSE("GPL");
>
> HID_COMPAT_LOAD_DRIVER(touchpack);
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-05-25 8:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-24 7:32 Asus eee-top touch screen Gabriele Turchi
2009-05-25 8:26 ` Andrey Panin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox