public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrey Panin <pazke@donpac.ru>
To: Gabriele Turchi <gabriele.turchi@l39a.com>
Cc: linux-kernel@vger.kernel.org, linux-input@vger.kernel.org
Subject: Re: Asus eee-top touch screen
Date: Mon, 25 May 2009 12:26:18 +0400	[thread overview]
Message-ID: <20090525082618.GA5983@ports.donpac.ru> (raw)
In-Reply-To: <4A18F807.3080406@l39a.com>


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);




      reply	other threads:[~2009-05-25  8:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-24  7:32 Asus eee-top touch screen Gabriele Turchi
2009-05-25  8:26 ` Andrey Panin [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090525082618.GA5983@ports.donpac.ru \
    --to=pazke@donpac.ru \
    --cc=gabriele.turchi@l39a.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox