/* * 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 #include #include #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);