From 3aac6768f837da5df4924280ba2856106e647837 Mon Sep 17 00:00:00 2001 From: Girish Ramakrishnan Date: Wed, 30 May 2012 21:38:22 -0700 Subject: Move evdev to platformsupport Also wraps various string literals with QLatin1String. Change-Id: Ia0681bfae00006d9e9ad51f05d0e0d0f45cf2cec Reviewed-by: Laszlo Agocs Reviewed-by: Donald Carr --- .../input/evdevkeyboard/evdevkeyboard.pri | 12 + .../evdevkeyboard/qevdevkeyboard_defaultmap_p.h | 787 +++++++++++++++++++++ .../input/evdevkeyboard/qevdevkeyboardhandler.cpp | 489 +++++++++++++ .../input/evdevkeyboard/qevdevkeyboardhandler_p.h | 202 ++++++ .../input/evdevkeyboard/qevdevkeyboardmanager.cpp | 129 ++++ .../input/evdevkeyboard/qevdevkeyboardmanager_p.h | 78 ++ .../input/evdevmouse/evdevmouse.pri | 12 + .../input/evdevmouse/qevdevmousehandler.cpp | 233 ++++++ .../input/evdevmouse/qevdevmousehandler_p.h | 86 +++ .../input/evdevmouse/qevdevmousemanager.cpp | 163 +++++ .../input/evdevmouse/qevdevmousemanager_p.h | 85 +++ .../input/evdevtouch/evdevtouch.pri | 13 + .../input/evdevtouch/qevdevtouch.cpp | 517 ++++++++++++++ .../input/evdevtouch/qevdevtouch_p.h | 98 +++ src/platformsupport/input/input.pri | 6 + src/platformsupport/platformsupport.pro | 1 + .../generic/evdevkeyboard/evdevkeyboard.pro | 12 +- src/plugins/generic/evdevkeyboard/main.cpp | 2 +- .../evdevkeyboard/qevdevkeyboard_defaultmap.h | 787 --------------------- .../evdevkeyboard/qevdevkeyboardhandler.cpp | 489 ------------- .../generic/evdevkeyboard/qevdevkeyboardhandler.h | 202 ------ .../evdevkeyboard/qevdevkeyboardmanager.cpp | 129 ---- .../generic/evdevkeyboard/qevdevkeyboardmanager.h | 78 -- src/plugins/generic/evdevmouse/evdevmouse.pro | 10 +- src/plugins/generic/evdevmouse/main.cpp | 2 +- .../generic/evdevmouse/qevdevmousehandler.cpp | 233 ------ .../generic/evdevmouse/qevdevmousehandler.h | 86 --- .../generic/evdevmouse/qevdevmousemanager.cpp | 163 ----- .../generic/evdevmouse/qevdevmousemanager.h | 85 --- src/plugins/generic/evdevtouch/evdevtouch.pro | 13 +- src/plugins/generic/evdevtouch/main.cpp | 2 +- src/plugins/generic/evdevtouch/qevdevtouch.cpp | 517 -------------- src/plugins/generic/evdevtouch/qevdevtouch.h | 98 --- 33 files changed, 2917 insertions(+), 2902 deletions(-) create mode 100644 src/platformsupport/input/evdevkeyboard/evdevkeyboard.pri create mode 100644 src/platformsupport/input/evdevkeyboard/qevdevkeyboard_defaultmap_p.h create mode 100644 src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler.cpp create mode 100644 src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler_p.h create mode 100644 src/platformsupport/input/evdevkeyboard/qevdevkeyboardmanager.cpp create mode 100644 src/platformsupport/input/evdevkeyboard/qevdevkeyboardmanager_p.h create mode 100644 src/platformsupport/input/evdevmouse/evdevmouse.pri create mode 100644 src/platformsupport/input/evdevmouse/qevdevmousehandler.cpp create mode 100644 src/platformsupport/input/evdevmouse/qevdevmousehandler_p.h create mode 100644 src/platformsupport/input/evdevmouse/qevdevmousemanager.cpp create mode 100644 src/platformsupport/input/evdevmouse/qevdevmousemanager_p.h create mode 100644 src/platformsupport/input/evdevtouch/evdevtouch.pri create mode 100644 src/platformsupport/input/evdevtouch/qevdevtouch.cpp create mode 100644 src/platformsupport/input/evdevtouch/qevdevtouch_p.h create mode 100644 src/platformsupport/input/input.pri delete mode 100644 src/plugins/generic/evdevkeyboard/qevdevkeyboard_defaultmap.h delete mode 100644 src/plugins/generic/evdevkeyboard/qevdevkeyboardhandler.cpp delete mode 100644 src/plugins/generic/evdevkeyboard/qevdevkeyboardhandler.h delete mode 100644 src/plugins/generic/evdevkeyboard/qevdevkeyboardmanager.cpp delete mode 100644 src/plugins/generic/evdevkeyboard/qevdevkeyboardmanager.h delete mode 100644 src/plugins/generic/evdevmouse/qevdevmousehandler.cpp delete mode 100644 src/plugins/generic/evdevmouse/qevdevmousehandler.h delete mode 100644 src/plugins/generic/evdevmouse/qevdevmousemanager.cpp delete mode 100644 src/plugins/generic/evdevmouse/qevdevmousemanager.h delete mode 100644 src/plugins/generic/evdevtouch/qevdevtouch.cpp delete mode 100644 src/plugins/generic/evdevtouch/qevdevtouch.h diff --git a/src/platformsupport/input/evdevkeyboard/evdevkeyboard.pri b/src/platformsupport/input/evdevkeyboard/evdevkeyboard.pri new file mode 100644 index 0000000000..1797f48d04 --- /dev/null +++ b/src/platformsupport/input/evdevkeyboard/evdevkeyboard.pri @@ -0,0 +1,12 @@ +HEADERS += \ + $$PWD/qevdevkeyboard_defaultmap_p.h \ + $$PWD/qevdevkeyboardhandler_p.h \ + $$PWD/qevdevkeyboardmanager_p.h + +SOURCES += \ + $$PWD/qevdevkeyboardhandler.cpp \ + $$PWD/qevdevkeyboardmanager.cpp + +contains(QT_CONFIG, libudev) { + LIBS += $$QMAKE_LIBS_LIBUDEV +} diff --git a/src/platformsupport/input/evdevkeyboard/qevdevkeyboard_defaultmap_p.h b/src/platformsupport/input/evdevkeyboard/qevdevkeyboard_defaultmap_p.h new file mode 100644 index 0000000000..9369f1233d --- /dev/null +++ b/src/platformsupport/input/evdevkeyboard/qevdevkeyboard_defaultmap_p.h @@ -0,0 +1,787 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QEVDEVKEYBOARDHANDLER_DEFAULTMAP_P_H +#define QEVDEVKEYBOARDHANDLER_DEFAULTMAP_P_H + +// no QT_BEGIN_NAMESPACE, since we include it internally... + +const QEvdevKeyboardMap::Mapping QEvdevKeyboardHandler::s_keymap_default[] = { + { 1, 0xffff, 0x01000000, 0x00, 0x00, 0x0000 }, + { 2, 0x0031, 0x00000031, 0x00, 0x00, 0x0000 }, + { 2, 0x0021, 0x00000021, 0x01, 0x00, 0x0000 }, + { 3, 0x0032, 0x00000032, 0x00, 0x00, 0x0000 }, + { 3, 0x0040, 0x00000040, 0x01, 0x00, 0x0000 }, + { 3, 0x0040, 0x00000040, 0x02, 0x00, 0x0000 }, + { 4, 0x0033, 0x00000033, 0x00, 0x00, 0x0000 }, + { 4, 0x0023, 0x00000023, 0x01, 0x00, 0x0000 }, + { 4, 0xffff, 0x01000000, 0x04, 0x00, 0x0000 }, + { 5, 0x0034, 0x00000034, 0x00, 0x00, 0x0000 }, + { 5, 0x0024, 0x00000024, 0x01, 0x00, 0x0000 }, + { 5, 0x0024, 0x00000024, 0x02, 0x00, 0x0000 }, + { 5, 0x005c, 0x0400005c, 0x04, 0x00, 0x0000 }, + { 6, 0x0035, 0x00000035, 0x00, 0x00, 0x0000 }, + { 6, 0x0025, 0x00000025, 0x01, 0x00, 0x0000 }, + { 6, 0x005d, 0x0400005d, 0x04, 0x00, 0x0000 }, + { 7, 0x0036, 0x00000036, 0x00, 0x00, 0x0000 }, + { 7, 0x005e, 0x0000005e, 0x01, 0x00, 0x0000 }, + { 7, 0x005e, 0x01001252, 0x02, 0x01, 0x0000 }, + { 7, 0x005e, 0x0400005e, 0x04, 0x00, 0x0000 }, + { 8, 0x0037, 0x00000037, 0x00, 0x00, 0x0000 }, + { 8, 0x0026, 0x00000026, 0x01, 0x00, 0x0000 }, + { 8, 0x007b, 0x0000007b, 0x02, 0x00, 0x0000 }, + { 8, 0x005f, 0x0400005f, 0x04, 0x00, 0x0000 }, + { 9, 0x0038, 0x00000038, 0x00, 0x00, 0x0000 }, + { 9, 0x002a, 0x0000002a, 0x01, 0x00, 0x0000 }, + { 9, 0x005b, 0x0000005b, 0x02, 0x00, 0x0000 }, + { 9, 0xffff, 0x01000003, 0x04, 0x00, 0x0000 }, + { 10, 0x0039, 0x00000039, 0x00, 0x00, 0x0000 }, + { 10, 0x0028, 0x00000028, 0x01, 0x00, 0x0000 }, + { 10, 0x005d, 0x0000005d, 0x02, 0x00, 0x0000 }, + { 11, 0x0030, 0x00000030, 0x00, 0x00, 0x0000 }, + { 11, 0x0029, 0x00000029, 0x01, 0x00, 0x0000 }, + { 11, 0x007d, 0x0000007d, 0x02, 0x00, 0x0000 }, + { 12, 0x002d, 0x0000002d, 0x00, 0x00, 0x0000 }, + { 12, 0x005f, 0x0000005f, 0x01, 0x00, 0x0000 }, + { 12, 0x005c, 0x0000005c, 0x02, 0x00, 0x0000 }, + { 12, 0x005f, 0x0400005f, 0x04, 0x00, 0x0000 }, + { 12, 0x005f, 0x0400005f, 0x05, 0x00, 0x0000 }, + { 13, 0x003d, 0x0000003d, 0x00, 0x00, 0x0000 }, + { 13, 0x002b, 0x0000002b, 0x01, 0x00, 0x0000 }, + { 14, 0xffff, 0x01000003, 0x00, 0x00, 0x0000 }, + { 14, 0xffff, 0x01000000, 0x0c, 0x08, 0x0300 }, + { 15, 0xffff, 0x01000001, 0x00, 0x00, 0x0000 }, + { 16, 0x0071, 0x00000051, 0x00, 0x00, 0x0000 }, + { 16, 0x0051, 0x00000051, 0x01, 0x00, 0x0000 }, + { 16, 0x0071, 0x00000051, 0x02, 0x00, 0x0000 }, + { 16, 0x0051, 0x00000051, 0x03, 0x00, 0x0000 }, + { 16, 0x0071, 0x04000051, 0x04, 0x00, 0x0000 }, + { 16, 0x0071, 0x04000051, 0x05, 0x00, 0x0000 }, + { 16, 0x0071, 0x04000051, 0x06, 0x00, 0x0000 }, + { 16, 0x0071, 0x04000051, 0x07, 0x00, 0x0000 }, + { 16, 0x0071, 0x08000051, 0x08, 0x00, 0x0000 }, + { 16, 0x0071, 0x08000051, 0x09, 0x00, 0x0000 }, + { 16, 0x0071, 0x08000051, 0x0a, 0x00, 0x0000 }, + { 16, 0x0071, 0x08000051, 0x0b, 0x00, 0x0000 }, + { 16, 0x0071, 0x0c000051, 0x0c, 0x00, 0x0000 }, + { 16, 0x0071, 0x0c000051, 0x0d, 0x00, 0x0000 }, + { 16, 0x0071, 0x0c000051, 0x0e, 0x00, 0x0000 }, + { 16, 0x0071, 0x0c000051, 0x0f, 0x00, 0x0000 }, + { 17, 0x0077, 0x00000057, 0x00, 0x00, 0x0000 }, + { 17, 0x0057, 0x00000057, 0x01, 0x00, 0x0000 }, + { 17, 0x0077, 0x00000057, 0x02, 0x00, 0x0000 }, + { 17, 0x0057, 0x00000057, 0x03, 0x00, 0x0000 }, + { 17, 0x0077, 0x04000057, 0x04, 0x00, 0x0000 }, + { 17, 0x0077, 0x04000057, 0x05, 0x00, 0x0000 }, + { 17, 0x0077, 0x04000057, 0x06, 0x00, 0x0000 }, + { 17, 0x0077, 0x04000057, 0x07, 0x00, 0x0000 }, + { 17, 0x0077, 0x08000057, 0x08, 0x00, 0x0000 }, + { 17, 0x0077, 0x08000057, 0x09, 0x00, 0x0000 }, + { 17, 0x0077, 0x08000057, 0x0a, 0x00, 0x0000 }, + { 17, 0x0077, 0x08000057, 0x0b, 0x00, 0x0000 }, + { 17, 0x0077, 0x0c000057, 0x0c, 0x00, 0x0000 }, + { 17, 0x0077, 0x0c000057, 0x0d, 0x00, 0x0000 }, + { 17, 0x0077, 0x0c000057, 0x0e, 0x00, 0x0000 }, + { 17, 0x0077, 0x0c000057, 0x0f, 0x00, 0x0000 }, + { 18, 0x0065, 0x00000045, 0x00, 0x00, 0x0000 }, + { 18, 0x0045, 0x00000045, 0x01, 0x00, 0x0000 }, + { 18, 0x0065, 0x00000045, 0x02, 0x00, 0x0000 }, + { 18, 0x0045, 0x00000045, 0x03, 0x00, 0x0000 }, + { 18, 0x0065, 0x04000045, 0x04, 0x00, 0x0000 }, + { 18, 0x0065, 0x04000045, 0x05, 0x00, 0x0000 }, + { 18, 0x0065, 0x04000045, 0x06, 0x00, 0x0000 }, + { 18, 0x0065, 0x04000045, 0x07, 0x00, 0x0000 }, + { 18, 0x0065, 0x08000045, 0x08, 0x00, 0x0000 }, + { 18, 0x0065, 0x08000045, 0x09, 0x00, 0x0000 }, + { 18, 0x0065, 0x08000045, 0x0a, 0x00, 0x0000 }, + { 18, 0x0065, 0x08000045, 0x0b, 0x00, 0x0000 }, + { 18, 0x0065, 0x0c000045, 0x0c, 0x00, 0x0000 }, + { 18, 0x0065, 0x0c000045, 0x0d, 0x00, 0x0000 }, + { 18, 0x0065, 0x0c000045, 0x0e, 0x00, 0x0000 }, + { 18, 0x0065, 0x0c000045, 0x0f, 0x00, 0x0000 }, + { 19, 0x0072, 0x00000052, 0x00, 0x00, 0x0000 }, + { 19, 0x0052, 0x00000052, 0x01, 0x00, 0x0000 }, + { 19, 0x0072, 0x00000052, 0x02, 0x00, 0x0000 }, + { 19, 0x0052, 0x00000052, 0x03, 0x00, 0x0000 }, + { 19, 0x0072, 0x04000052, 0x04, 0x00, 0x0000 }, + { 19, 0x0072, 0x04000052, 0x05, 0x00, 0x0000 }, + { 19, 0x0072, 0x04000052, 0x06, 0x00, 0x0000 }, + { 19, 0x0072, 0x04000052, 0x07, 0x00, 0x0000 }, + { 19, 0x0072, 0x08000052, 0x08, 0x00, 0x0000 }, + { 19, 0x0072, 0x08000052, 0x09, 0x00, 0x0000 }, + { 19, 0x0072, 0x08000052, 0x0a, 0x00, 0x0000 }, + { 19, 0x0072, 0x08000052, 0x0b, 0x00, 0x0000 }, + { 19, 0x0072, 0x0c000052, 0x0c, 0x00, 0x0000 }, + { 19, 0x0072, 0x0c000052, 0x0d, 0x00, 0x0000 }, + { 19, 0x0072, 0x0c000052, 0x0e, 0x00, 0x0000 }, + { 19, 0x0072, 0x0c000052, 0x0f, 0x00, 0x0000 }, + { 20, 0x0074, 0x00000054, 0x00, 0x00, 0x0000 }, + { 20, 0x0054, 0x00000054, 0x01, 0x00, 0x0000 }, + { 20, 0x0074, 0x00000054, 0x02, 0x00, 0x0000 }, + { 20, 0x0054, 0x00000054, 0x03, 0x00, 0x0000 }, + { 20, 0x0074, 0x04000054, 0x04, 0x00, 0x0000 }, + { 20, 0x0074, 0x04000054, 0x05, 0x00, 0x0000 }, + { 20, 0x0074, 0x04000054, 0x06, 0x00, 0x0000 }, + { 20, 0x0074, 0x04000054, 0x07, 0x00, 0x0000 }, + { 20, 0x0074, 0x08000054, 0x08, 0x00, 0x0000 }, + { 20, 0x0074, 0x08000054, 0x09, 0x00, 0x0000 }, + { 20, 0x0074, 0x08000054, 0x0a, 0x00, 0x0000 }, + { 20, 0x0074, 0x08000054, 0x0b, 0x00, 0x0000 }, + { 20, 0x0074, 0x0c000054, 0x0c, 0x00, 0x0000 }, + { 20, 0x0074, 0x0c000054, 0x0d, 0x00, 0x0000 }, + { 20, 0x0074, 0x0c000054, 0x0e, 0x00, 0x0000 }, + { 20, 0x0074, 0x0c000054, 0x0f, 0x00, 0x0000 }, + { 21, 0x0079, 0x00000059, 0x00, 0x00, 0x0000 }, + { 21, 0x0059, 0x00000059, 0x01, 0x00, 0x0000 }, + { 21, 0x0079, 0x00000059, 0x02, 0x00, 0x0000 }, + { 21, 0x0059, 0x00000059, 0x03, 0x00, 0x0000 }, + { 21, 0x0079, 0x04000059, 0x04, 0x00, 0x0000 }, + { 21, 0x0079, 0x04000059, 0x05, 0x00, 0x0000 }, + { 21, 0x0079, 0x04000059, 0x06, 0x00, 0x0000 }, + { 21, 0x0079, 0x04000059, 0x07, 0x00, 0x0000 }, + { 21, 0x0079, 0x08000059, 0x08, 0x00, 0x0000 }, + { 21, 0x0079, 0x08000059, 0x09, 0x00, 0x0000 }, + { 21, 0x0079, 0x08000059, 0x0a, 0x00, 0x0000 }, + { 21, 0x0079, 0x08000059, 0x0b, 0x00, 0x0000 }, + { 21, 0x0079, 0x0c000059, 0x0c, 0x00, 0x0000 }, + { 21, 0x0079, 0x0c000059, 0x0d, 0x00, 0x0000 }, + { 21, 0x0079, 0x0c000059, 0x0e, 0x00, 0x0000 }, + { 21, 0x0079, 0x0c000059, 0x0f, 0x00, 0x0000 }, + { 22, 0x0075, 0x00000055, 0x00, 0x00, 0x0000 }, + { 22, 0x0055, 0x00000055, 0x01, 0x00, 0x0000 }, + { 22, 0x0075, 0x00000055, 0x02, 0x00, 0x0000 }, + { 22, 0x0055, 0x00000055, 0x03, 0x00, 0x0000 }, + { 22, 0x0075, 0x04000055, 0x04, 0x00, 0x0000 }, + { 22, 0x0075, 0x04000055, 0x05, 0x00, 0x0000 }, + { 22, 0x0075, 0x04000055, 0x06, 0x00, 0x0000 }, + { 22, 0x0075, 0x04000055, 0x07, 0x00, 0x0000 }, + { 22, 0x0075, 0x08000055, 0x08, 0x00, 0x0000 }, + { 22, 0x0075, 0x08000055, 0x09, 0x00, 0x0000 }, + { 22, 0x0075, 0x08000055, 0x0a, 0x00, 0x0000 }, + { 22, 0x0075, 0x08000055, 0x0b, 0x00, 0x0000 }, + { 22, 0x0075, 0x0c000055, 0x0c, 0x00, 0x0000 }, + { 22, 0x0075, 0x0c000055, 0x0d, 0x00, 0x0000 }, + { 22, 0x0075, 0x0c000055, 0x0e, 0x00, 0x0000 }, + { 22, 0x0075, 0x0c000055, 0x0f, 0x00, 0x0000 }, + { 23, 0x0069, 0x00000049, 0x00, 0x00, 0x0000 }, + { 23, 0x0049, 0x00000049, 0x01, 0x00, 0x0000 }, + { 23, 0x0069, 0x00000049, 0x02, 0x00, 0x0000 }, + { 23, 0x0049, 0x00000049, 0x03, 0x00, 0x0000 }, + { 23, 0x0069, 0x04000049, 0x04, 0x00, 0x0000 }, + { 23, 0x0069, 0x04000049, 0x05, 0x00, 0x0000 }, + { 23, 0x0069, 0x04000049, 0x06, 0x00, 0x0000 }, + { 23, 0x0069, 0x04000049, 0x07, 0x00, 0x0000 }, + { 23, 0x0069, 0x08000049, 0x08, 0x00, 0x0000 }, + { 23, 0x0069, 0x08000049, 0x09, 0x00, 0x0000 }, + { 23, 0x0069, 0x08000049, 0x0a, 0x00, 0x0000 }, + { 23, 0x0069, 0x08000049, 0x0b, 0x00, 0x0000 }, + { 23, 0x0069, 0x0c000049, 0x0c, 0x00, 0x0000 }, + { 23, 0x0069, 0x0c000049, 0x0d, 0x00, 0x0000 }, + { 23, 0x0069, 0x0c000049, 0x0e, 0x00, 0x0000 }, + { 23, 0x0069, 0x0c000049, 0x0f, 0x00, 0x0000 }, + { 24, 0x006f, 0x0000004f, 0x00, 0x00, 0x0000 }, + { 24, 0x004f, 0x0000004f, 0x01, 0x00, 0x0000 }, + { 24, 0x006f, 0x0000004f, 0x02, 0x00, 0x0000 }, + { 24, 0x004f, 0x0000004f, 0x03, 0x00, 0x0000 }, + { 24, 0x006f, 0x0400004f, 0x04, 0x00, 0x0000 }, + { 24, 0x006f, 0x0400004f, 0x05, 0x00, 0x0000 }, + { 24, 0x006f, 0x0400004f, 0x06, 0x00, 0x0000 }, + { 24, 0x006f, 0x0400004f, 0x07, 0x00, 0x0000 }, + { 24, 0x006f, 0x0800004f, 0x08, 0x00, 0x0000 }, + { 24, 0x006f, 0x0800004f, 0x09, 0x00, 0x0000 }, + { 24, 0x006f, 0x0800004f, 0x0a, 0x00, 0x0000 }, + { 24, 0x006f, 0x0800004f, 0x0b, 0x00, 0x0000 }, + { 24, 0x006f, 0x0c00004f, 0x0c, 0x00, 0x0000 }, + { 24, 0x006f, 0x0c00004f, 0x0d, 0x00, 0x0000 }, + { 24, 0x006f, 0x0c00004f, 0x0e, 0x00, 0x0000 }, + { 24, 0x006f, 0x0c00004f, 0x0f, 0x00, 0x0000 }, + { 25, 0x0070, 0x00000050, 0x00, 0x00, 0x0000 }, + { 25, 0x0050, 0x00000050, 0x01, 0x00, 0x0000 }, + { 25, 0x0070, 0x00000050, 0x02, 0x00, 0x0000 }, + { 25, 0x0050, 0x00000050, 0x03, 0x00, 0x0000 }, + { 25, 0x0070, 0x04000050, 0x04, 0x00, 0x0000 }, + { 25, 0x0070, 0x04000050, 0x05, 0x00, 0x0000 }, + { 25, 0x0070, 0x04000050, 0x06, 0x00, 0x0000 }, + { 25, 0x0070, 0x04000050, 0x07, 0x00, 0x0000 }, + { 25, 0x0070, 0x08000050, 0x08, 0x00, 0x0000 }, + { 25, 0x0070, 0x08000050, 0x09, 0x00, 0x0000 }, + { 25, 0x0070, 0x08000050, 0x0a, 0x00, 0x0000 }, + { 25, 0x0070, 0x08000050, 0x0b, 0x00, 0x0000 }, + { 25, 0x0070, 0x0c000050, 0x0c, 0x00, 0x0000 }, + { 25, 0x0070, 0x0c000050, 0x0d, 0x00, 0x0000 }, + { 25, 0x0070, 0x0c000050, 0x0e, 0x00, 0x0000 }, + { 25, 0x0070, 0x0c000050, 0x0f, 0x00, 0x0000 }, + { 26, 0x005b, 0x0000005b, 0x00, 0x00, 0x0000 }, + { 26, 0x007b, 0x0000007b, 0x01, 0x00, 0x0000 }, + { 26, 0xffff, 0x01000000, 0x04, 0x00, 0x0000 }, + { 27, 0x005d, 0x0000005d, 0x00, 0x00, 0x0000 }, + { 27, 0x007d, 0x0000007d, 0x01, 0x00, 0x0000 }, + { 27, 0x007e, 0x0000007e, 0x02, 0x00, 0x0000 }, + { 27, 0x005d, 0x0400005d, 0x04, 0x00, 0x0000 }, + { 28, 0xffff, 0x01000004, 0x00, 0x00, 0x0000 }, + { 28, 0x006d, 0x0c00004d, 0x08, 0x00, 0x0000 }, + { 29, 0xffff, 0x01000021, 0x00, 0x04, 0x0004 }, + { 30, 0x0061, 0x00000041, 0x00, 0x00, 0x0000 }, + { 30, 0x0041, 0x00000041, 0x01, 0x00, 0x0000 }, + { 30, 0x0061, 0x00000041, 0x02, 0x00, 0x0000 }, + { 30, 0x0041, 0x00000041, 0x03, 0x00, 0x0000 }, + { 30, 0x0061, 0x04000041, 0x04, 0x00, 0x0000 }, + { 30, 0x0061, 0x04000041, 0x05, 0x00, 0x0000 }, + { 30, 0x0061, 0x04000041, 0x06, 0x00, 0x0000 }, + { 30, 0x0061, 0x04000041, 0x07, 0x00, 0x0000 }, + { 30, 0x0061, 0x08000041, 0x08, 0x00, 0x0000 }, + { 30, 0x0061, 0x08000041, 0x09, 0x00, 0x0000 }, + { 30, 0x0061, 0x08000041, 0x0a, 0x00, 0x0000 }, + { 30, 0x0061, 0x08000041, 0x0b, 0x00, 0x0000 }, + { 30, 0x0061, 0x0c000041, 0x0c, 0x00, 0x0000 }, + { 30, 0x0061, 0x0c000041, 0x0d, 0x00, 0x0000 }, + { 30, 0x0061, 0x0c000041, 0x0e, 0x00, 0x0000 }, + { 30, 0x0061, 0x0c000041, 0x0f, 0x00, 0x0000 }, + { 31, 0x0073, 0x00000053, 0x00, 0x00, 0x0000 }, + { 31, 0x0053, 0x00000053, 0x01, 0x00, 0x0000 }, + { 31, 0x0073, 0x00000053, 0x02, 0x00, 0x0000 }, + { 31, 0x0053, 0x00000053, 0x03, 0x00, 0x0000 }, + { 31, 0x0073, 0x04000053, 0x04, 0x00, 0x0000 }, + { 31, 0x0073, 0x04000053, 0x05, 0x00, 0x0000 }, + { 31, 0x0073, 0x04000053, 0x06, 0x00, 0x0000 }, + { 31, 0x0073, 0x04000053, 0x07, 0x00, 0x0000 }, + { 31, 0x0073, 0x08000053, 0x08, 0x00, 0x0000 }, + { 31, 0x0073, 0x08000053, 0x09, 0x00, 0x0000 }, + { 31, 0x0073, 0x08000053, 0x0a, 0x00, 0x0000 }, + { 31, 0x0073, 0x08000053, 0x0b, 0x00, 0x0000 }, + { 31, 0x0073, 0x0c000053, 0x0c, 0x00, 0x0000 }, + { 31, 0x0073, 0x0c000053, 0x0d, 0x00, 0x0000 }, + { 31, 0x0073, 0x0c000053, 0x0e, 0x00, 0x0000 }, + { 31, 0x0073, 0x0c000053, 0x0f, 0x00, 0x0000 }, + { 32, 0x0064, 0x00000044, 0x00, 0x00, 0x0000 }, + { 32, 0x0044, 0x00000044, 0x01, 0x00, 0x0000 }, + { 32, 0x0064, 0x00000044, 0x02, 0x00, 0x0000 }, + { 32, 0x0044, 0x00000044, 0x03, 0x00, 0x0000 }, + { 32, 0x0064, 0x04000044, 0x04, 0x00, 0x0000 }, + { 32, 0x0064, 0x04000044, 0x05, 0x00, 0x0000 }, + { 32, 0x0064, 0x04000044, 0x06, 0x00, 0x0000 }, + { 32, 0x0064, 0x04000044, 0x07, 0x00, 0x0000 }, + { 32, 0x0064, 0x08000044, 0x08, 0x00, 0x0000 }, + { 32, 0x0064, 0x08000044, 0x09, 0x00, 0x0000 }, + { 32, 0x0064, 0x08000044, 0x0a, 0x00, 0x0000 }, + { 32, 0x0064, 0x08000044, 0x0b, 0x00, 0x0000 }, + { 32, 0x0064, 0x0c000044, 0x0c, 0x00, 0x0000 }, + { 32, 0x0064, 0x0c000044, 0x0d, 0x00, 0x0000 }, + { 32, 0x0064, 0x0c000044, 0x0e, 0x00, 0x0000 }, + { 32, 0x0064, 0x0c000044, 0x0f, 0x00, 0x0000 }, + { 33, 0x0066, 0x00000046, 0x00, 0x00, 0x0000 }, + { 33, 0x0046, 0x00000046, 0x01, 0x00, 0x0000 }, + { 33, 0x0066, 0x00000046, 0x02, 0x00, 0x0000 }, + { 33, 0x0046, 0x00000046, 0x03, 0x00, 0x0000 }, + { 33, 0x0066, 0x04000046, 0x04, 0x00, 0x0000 }, + { 33, 0x0066, 0x04000046, 0x05, 0x00, 0x0000 }, + { 33, 0x0066, 0x04000046, 0x06, 0x00, 0x0000 }, + { 33, 0x0066, 0x04000046, 0x07, 0x00, 0x0000 }, + { 33, 0x0066, 0x08000046, 0x08, 0x00, 0x0000 }, + { 33, 0x0066, 0x08000046, 0x09, 0x00, 0x0000 }, + { 33, 0x0066, 0x08000046, 0x0a, 0x00, 0x0000 }, + { 33, 0x0066, 0x08000046, 0x0b, 0x00, 0x0000 }, + { 33, 0x0066, 0x0c000046, 0x0c, 0x00, 0x0000 }, + { 33, 0x0066, 0x0c000046, 0x0d, 0x00, 0x0000 }, + { 33, 0x0066, 0x0c000046, 0x0e, 0x00, 0x0000 }, + { 33, 0x0066, 0x0c000046, 0x0f, 0x00, 0x0000 }, + { 34, 0x0067, 0x00000047, 0x00, 0x00, 0x0000 }, + { 34, 0x0047, 0x00000047, 0x01, 0x00, 0x0000 }, + { 34, 0x0067, 0x00000047, 0x02, 0x00, 0x0000 }, + { 34, 0x0047, 0x00000047, 0x03, 0x00, 0x0000 }, + { 34, 0x0067, 0x04000047, 0x04, 0x00, 0x0000 }, + { 34, 0x0067, 0x04000047, 0x05, 0x00, 0x0000 }, + { 34, 0x0067, 0x04000047, 0x06, 0x00, 0x0000 }, + { 34, 0x0067, 0x04000047, 0x07, 0x00, 0x0000 }, + { 34, 0x0067, 0x08000047, 0x08, 0x00, 0x0000 }, + { 34, 0x0067, 0x08000047, 0x09, 0x00, 0x0000 }, + { 34, 0x0067, 0x08000047, 0x0a, 0x00, 0x0000 }, + { 34, 0x0067, 0x08000047, 0x0b, 0x00, 0x0000 }, + { 34, 0x0067, 0x0c000047, 0x0c, 0x00, 0x0000 }, + { 34, 0x0067, 0x0c000047, 0x0d, 0x00, 0x0000 }, + { 34, 0x0067, 0x0c000047, 0x0e, 0x00, 0x0000 }, + { 34, 0x0067, 0x0c000047, 0x0f, 0x00, 0x0000 }, + { 35, 0x0068, 0x00000048, 0x00, 0x00, 0x0000 }, + { 35, 0x0048, 0x00000048, 0x01, 0x00, 0x0000 }, + { 35, 0x0068, 0x00000048, 0x02, 0x00, 0x0000 }, + { 35, 0x0048, 0x00000048, 0x03, 0x00, 0x0000 }, + { 35, 0x0068, 0x04000048, 0x04, 0x00, 0x0000 }, + { 35, 0x0068, 0x04000048, 0x05, 0x00, 0x0000 }, + { 35, 0x0068, 0x04000048, 0x06, 0x00, 0x0000 }, + { 35, 0x0068, 0x04000048, 0x07, 0x00, 0x0000 }, + { 35, 0x0068, 0x08000048, 0x08, 0x00, 0x0000 }, + { 35, 0x0068, 0x08000048, 0x09, 0x00, 0x0000 }, + { 35, 0x0068, 0x08000048, 0x0a, 0x00, 0x0000 }, + { 35, 0x0068, 0x08000048, 0x0b, 0x00, 0x0000 }, + { 35, 0x0068, 0x0c000048, 0x0c, 0x00, 0x0000 }, + { 35, 0x0068, 0x0c000048, 0x0d, 0x00, 0x0000 }, + { 35, 0x0068, 0x0c000048, 0x0e, 0x00, 0x0000 }, + { 35, 0x0068, 0x0c000048, 0x0f, 0x00, 0x0000 }, + { 36, 0x006a, 0x0000004a, 0x00, 0x00, 0x0000 }, + { 36, 0x004a, 0x0000004a, 0x01, 0x00, 0x0000 }, + { 36, 0x006a, 0x0000004a, 0x02, 0x00, 0x0000 }, + { 36, 0x004a, 0x0000004a, 0x03, 0x00, 0x0000 }, + { 36, 0x006a, 0x0400004a, 0x04, 0x00, 0x0000 }, + { 36, 0x006a, 0x0400004a, 0x05, 0x00, 0x0000 }, + { 36, 0x006a, 0x0400004a, 0x06, 0x00, 0x0000 }, + { 36, 0x006a, 0x0400004a, 0x07, 0x00, 0x0000 }, + { 36, 0x006a, 0x0800004a, 0x08, 0x00, 0x0000 }, + { 36, 0x006a, 0x0800004a, 0x09, 0x00, 0x0000 }, + { 36, 0x006a, 0x0800004a, 0x0a, 0x00, 0x0000 }, + { 36, 0x006a, 0x0800004a, 0x0b, 0x00, 0x0000 }, + { 36, 0x006a, 0x0c00004a, 0x0c, 0x00, 0x0000 }, + { 36, 0x006a, 0x0c00004a, 0x0d, 0x00, 0x0000 }, + { 36, 0x006a, 0x0c00004a, 0x0e, 0x00, 0x0000 }, + { 36, 0x006a, 0x0c00004a, 0x0f, 0x00, 0x0000 }, + { 37, 0x006b, 0x0000004b, 0x00, 0x00, 0x0000 }, + { 37, 0x004b, 0x0000004b, 0x01, 0x00, 0x0000 }, + { 37, 0x006b, 0x0000004b, 0x02, 0x00, 0x0000 }, + { 37, 0x004b, 0x0000004b, 0x03, 0x00, 0x0000 }, + { 37, 0x006b, 0x0400004b, 0x04, 0x00, 0x0000 }, + { 37, 0x006b, 0x0400004b, 0x05, 0x00, 0x0000 }, + { 37, 0x006b, 0x0400004b, 0x06, 0x00, 0x0000 }, + { 37, 0x006b, 0x0400004b, 0x07, 0x00, 0x0000 }, + { 37, 0x006b, 0x0800004b, 0x08, 0x00, 0x0000 }, + { 37, 0x006b, 0x0800004b, 0x09, 0x00, 0x0000 }, + { 37, 0x006b, 0x0800004b, 0x0a, 0x00, 0x0000 }, + { 37, 0x006b, 0x0800004b, 0x0b, 0x00, 0x0000 }, + { 37, 0x006b, 0x0c00004b, 0x0c, 0x00, 0x0000 }, + { 37, 0x006b, 0x0c00004b, 0x0d, 0x00, 0x0000 }, + { 37, 0x006b, 0x0c00004b, 0x0e, 0x00, 0x0000 }, + { 37, 0x006b, 0x0c00004b, 0x0f, 0x00, 0x0000 }, + { 38, 0x006c, 0x0000004c, 0x00, 0x00, 0x0000 }, + { 38, 0x004c, 0x0000004c, 0x01, 0x00, 0x0000 }, + { 38, 0x006c, 0x0000004c, 0x02, 0x00, 0x0000 }, + { 38, 0x004c, 0x0000004c, 0x03, 0x00, 0x0000 }, + { 38, 0x006c, 0x0400004c, 0x04, 0x00, 0x0000 }, + { 38, 0x006c, 0x0400004c, 0x05, 0x00, 0x0000 }, + { 38, 0x006c, 0x0400004c, 0x06, 0x00, 0x0000 }, + { 38, 0x006c, 0x0400004c, 0x07, 0x00, 0x0000 }, + { 38, 0x006c, 0x0800004c, 0x08, 0x00, 0x0000 }, + { 38, 0x006c, 0x0800004c, 0x09, 0x00, 0x0000 }, + { 38, 0x006c, 0x0800004c, 0x0a, 0x00, 0x0000 }, + { 38, 0x006c, 0x0800004c, 0x0b, 0x00, 0x0000 }, + { 38, 0x006c, 0x0c00004c, 0x0c, 0x00, 0x0000 }, + { 38, 0x006c, 0x0c00004c, 0x0d, 0x00, 0x0000 }, + { 38, 0x006c, 0x0c00004c, 0x0e, 0x00, 0x0000 }, + { 38, 0x006c, 0x0c00004c, 0x0f, 0x00, 0x0000 }, + { 39, 0x003b, 0x0000003b, 0x00, 0x00, 0x0000 }, + { 39, 0x003a, 0x0000003a, 0x01, 0x00, 0x0000 }, + { 40, 0x0027, 0x00000027, 0x00, 0x00, 0x0000 }, + { 40, 0x0022, 0x00000022, 0x01, 0x00, 0x0000 }, + { 40, 0x0027, 0x01001251, 0x02, 0x01, 0x0000 }, + { 40, 0x0022, 0x01001257, 0x03, 0x01, 0x0000 }, + { 40, 0x0067, 0x04000047, 0x04, 0x00, 0x0000 }, + { 41, 0x0060, 0x00000060, 0x00, 0x00, 0x0000 }, + { 41, 0x007e, 0x0000007e, 0x01, 0x00, 0x0000 }, + { 41, 0x0060, 0x01001250, 0x02, 0x01, 0x0000 }, + { 41, 0x007e, 0x01001253, 0x03, 0x01, 0x0000 }, + { 42, 0xffff, 0x01000020, 0x00, 0x04, 0x0001 }, + { 43, 0x005c, 0x0000005c, 0x00, 0x00, 0x0000 }, + { 43, 0x007c, 0x0000007c, 0x01, 0x00, 0x0000 }, + { 43, 0x005c, 0x0400005c, 0x04, 0x00, 0x0000 }, + { 44, 0x007a, 0x0000005a, 0x00, 0x00, 0x0000 }, + { 44, 0x005a, 0x0000005a, 0x01, 0x00, 0x0000 }, + { 44, 0x007a, 0x0000005a, 0x02, 0x00, 0x0000 }, + { 44, 0x005a, 0x0000005a, 0x03, 0x00, 0x0000 }, + { 44, 0x007a, 0x0400005a, 0x04, 0x00, 0x0000 }, + { 44, 0x007a, 0x0400005a, 0x05, 0x00, 0x0000 }, + { 44, 0x007a, 0x0400005a, 0x06, 0x00, 0x0000 }, + { 44, 0x007a, 0x0400005a, 0x07, 0x00, 0x0000 }, + { 44, 0x007a, 0x0800005a, 0x08, 0x00, 0x0000 }, + { 44, 0x007a, 0x0800005a, 0x09, 0x00, 0x0000 }, + { 44, 0x007a, 0x0800005a, 0x0a, 0x00, 0x0000 }, + { 44, 0x007a, 0x0800005a, 0x0b, 0x00, 0x0000 }, + { 44, 0x007a, 0x0c00005a, 0x0c, 0x00, 0x0000 }, + { 44, 0x007a, 0x0c00005a, 0x0d, 0x00, 0x0000 }, + { 44, 0x007a, 0x0c00005a, 0x0e, 0x00, 0x0000 }, + { 44, 0x007a, 0x0c00005a, 0x0f, 0x00, 0x0000 }, + { 45, 0x0078, 0x00000058, 0x00, 0x00, 0x0000 }, + { 45, 0x0058, 0x00000058, 0x01, 0x00, 0x0000 }, + { 45, 0x0078, 0x00000058, 0x02, 0x00, 0x0000 }, + { 45, 0x0058, 0x00000058, 0x03, 0x00, 0x0000 }, + { 45, 0x0078, 0x04000058, 0x04, 0x00, 0x0000 }, + { 45, 0x0078, 0x04000058, 0x05, 0x00, 0x0000 }, + { 45, 0x0078, 0x04000058, 0x06, 0x00, 0x0000 }, + { 45, 0x0078, 0x04000058, 0x07, 0x00, 0x0000 }, + { 45, 0x0078, 0x08000058, 0x08, 0x00, 0x0000 }, + { 45, 0x0078, 0x08000058, 0x09, 0x00, 0x0000 }, + { 45, 0x0078, 0x08000058, 0x0a, 0x00, 0x0000 }, + { 45, 0x0078, 0x08000058, 0x0b, 0x00, 0x0000 }, + { 45, 0x0078, 0x0c000058, 0x0c, 0x00, 0x0000 }, + { 45, 0x0078, 0x0c000058, 0x0d, 0x00, 0x0000 }, + { 45, 0x0078, 0x0c000058, 0x0e, 0x00, 0x0000 }, + { 45, 0x0078, 0x0c000058, 0x0f, 0x00, 0x0000 }, + { 46, 0x0063, 0x00000043, 0x00, 0x00, 0x0000 }, + { 46, 0x0043, 0x00000043, 0x01, 0x00, 0x0000 }, + { 46, 0x0063, 0x00000043, 0x02, 0x00, 0x0000 }, + { 46, 0x0043, 0x00000043, 0x03, 0x00, 0x0000 }, + { 46, 0x0063, 0x04000043, 0x04, 0x00, 0x0000 }, + { 46, 0x0063, 0x04000043, 0x05, 0x00, 0x0000 }, + { 46, 0x0063, 0x04000043, 0x06, 0x00, 0x0000 }, + { 46, 0x0063, 0x04000043, 0x07, 0x00, 0x0000 }, + { 46, 0x0063, 0x08000043, 0x08, 0x00, 0x0000 }, + { 46, 0x0063, 0x08000043, 0x09, 0x00, 0x0000 }, + { 46, 0x0063, 0x08000043, 0x0a, 0x00, 0x0000 }, + { 46, 0x0063, 0x08000043, 0x0b, 0x00, 0x0000 }, + { 46, 0x0063, 0x0c000043, 0x0c, 0x00, 0x0000 }, + { 46, 0x0063, 0x0c000043, 0x0d, 0x00, 0x0000 }, + { 46, 0x0063, 0x0c000043, 0x0e, 0x00, 0x0000 }, + { 46, 0x0063, 0x0c000043, 0x0f, 0x00, 0x0000 }, + { 47, 0x0076, 0x00000056, 0x00, 0x00, 0x0000 }, + { 47, 0x0056, 0x00000056, 0x01, 0x00, 0x0000 }, + { 47, 0x0076, 0x00000056, 0x02, 0x00, 0x0000 }, + { 47, 0x0056, 0x00000056, 0x03, 0x00, 0x0000 }, + { 47, 0x0076, 0x04000056, 0x04, 0x00, 0x0000 }, + { 47, 0x0076, 0x04000056, 0x05, 0x00, 0x0000 }, + { 47, 0x0076, 0x04000056, 0x06, 0x00, 0x0000 }, + { 47, 0x0076, 0x04000056, 0x07, 0x00, 0x0000 }, + { 47, 0x0076, 0x08000056, 0x08, 0x00, 0x0000 }, + { 47, 0x0076, 0x08000056, 0x09, 0x00, 0x0000 }, + { 47, 0x0076, 0x08000056, 0x0a, 0x00, 0x0000 }, + { 47, 0x0076, 0x08000056, 0x0b, 0x00, 0x0000 }, + { 47, 0x0076, 0x0c000056, 0x0c, 0x00, 0x0000 }, + { 47, 0x0076, 0x0c000056, 0x0d, 0x00, 0x0000 }, + { 47, 0x0076, 0x0c000056, 0x0e, 0x00, 0x0000 }, + { 47, 0x0076, 0x0c000056, 0x0f, 0x00, 0x0000 }, + { 48, 0x0062, 0x00000042, 0x00, 0x00, 0x0000 }, + { 48, 0x0042, 0x00000042, 0x01, 0x00, 0x0000 }, + { 48, 0x0062, 0x00000042, 0x02, 0x00, 0x0000 }, + { 48, 0x0042, 0x00000042, 0x03, 0x00, 0x0000 }, + { 48, 0x0062, 0x04000042, 0x04, 0x00, 0x0000 }, + { 48, 0x0062, 0x04000042, 0x05, 0x00, 0x0000 }, + { 48, 0x0062, 0x04000042, 0x06, 0x00, 0x0000 }, + { 48, 0x0062, 0x04000042, 0x07, 0x00, 0x0000 }, + { 48, 0x0062, 0x08000042, 0x08, 0x00, 0x0000 }, + { 48, 0x0062, 0x08000042, 0x09, 0x00, 0x0000 }, + { 48, 0x0062, 0x08000042, 0x0a, 0x00, 0x0000 }, + { 48, 0x0062, 0x08000042, 0x0b, 0x00, 0x0000 }, + { 48, 0x0062, 0x0c000042, 0x0c, 0x00, 0x0000 }, + { 48, 0x0062, 0x0c000042, 0x0d, 0x00, 0x0000 }, + { 48, 0x0062, 0x0c000042, 0x0e, 0x00, 0x0000 }, + { 48, 0x0062, 0x0c000042, 0x0f, 0x00, 0x0000 }, + { 49, 0x006e, 0x0000004e, 0x00, 0x00, 0x0000 }, + { 49, 0x004e, 0x0000004e, 0x01, 0x00, 0x0000 }, + { 49, 0x006e, 0x0000004e, 0x02, 0x00, 0x0000 }, + { 49, 0x004e, 0x0000004e, 0x03, 0x00, 0x0000 }, + { 49, 0x006e, 0x0400004e, 0x04, 0x00, 0x0000 }, + { 49, 0x006e, 0x0400004e, 0x05, 0x00, 0x0000 }, + { 49, 0x006e, 0x0400004e, 0x06, 0x00, 0x0000 }, + { 49, 0x006e, 0x0400004e, 0x07, 0x00, 0x0000 }, + { 49, 0x006e, 0x0800004e, 0x08, 0x00, 0x0000 }, + { 49, 0x006e, 0x0800004e, 0x09, 0x00, 0x0000 }, + { 49, 0x006e, 0x0800004e, 0x0a, 0x00, 0x0000 }, + { 49, 0x006e, 0x0800004e, 0x0b, 0x00, 0x0000 }, + { 49, 0x006e, 0x0c00004e, 0x0c, 0x00, 0x0000 }, + { 49, 0x006e, 0x0c00004e, 0x0d, 0x00, 0x0000 }, + { 49, 0x006e, 0x0c00004e, 0x0e, 0x00, 0x0000 }, + { 49, 0x006e, 0x0c00004e, 0x0f, 0x00, 0x0000 }, + { 50, 0x006d, 0x0000004d, 0x00, 0x00, 0x0000 }, + { 50, 0x004d, 0x0000004d, 0x01, 0x00, 0x0000 }, + { 50, 0x006d, 0x0000004d, 0x02, 0x00, 0x0000 }, + { 50, 0x004d, 0x0000004d, 0x03, 0x00, 0x0000 }, + { 50, 0x006d, 0x0400004d, 0x04, 0x00, 0x0000 }, + { 50, 0x006d, 0x0400004d, 0x05, 0x00, 0x0000 }, + { 50, 0x006d, 0x0400004d, 0x06, 0x00, 0x0000 }, + { 50, 0x006d, 0x0400004d, 0x07, 0x00, 0x0000 }, + { 50, 0x006d, 0x0800004d, 0x08, 0x00, 0x0000 }, + { 50, 0x006d, 0x0800004d, 0x09, 0x00, 0x0000 }, + { 50, 0x006d, 0x0800004d, 0x0a, 0x00, 0x0000 }, + { 50, 0x006d, 0x0800004d, 0x0b, 0x00, 0x0000 }, + { 50, 0x006d, 0x0c00004d, 0x0c, 0x00, 0x0000 }, + { 50, 0x006d, 0x0c00004d, 0x0d, 0x00, 0x0000 }, + { 50, 0x006d, 0x0c00004d, 0x0e, 0x00, 0x0000 }, + { 50, 0x006d, 0x0c00004d, 0x0f, 0x00, 0x0000 }, + { 51, 0x002c, 0x0000002c, 0x00, 0x00, 0x0000 }, + { 51, 0x003c, 0x0000003c, 0x01, 0x00, 0x0000 }, + { 51, 0x002c, 0x0100125b, 0x02, 0x01, 0x0000 }, + { 52, 0x002e, 0x0000002e, 0x00, 0x00, 0x0000 }, + { 52, 0x003e, 0x0000003e, 0x01, 0x00, 0x0000 }, + { 52, 0xffff, 0x01001120, 0x02, 0x00, 0x0000 }, + { 53, 0x002f, 0x0000002f, 0x00, 0x00, 0x0000 }, + { 53, 0x003f, 0x0000003f, 0x01, 0x00, 0x0000 }, + { 53, 0xffff, 0x01000003, 0x04, 0x00, 0x0000 }, + { 54, 0xffff, 0x01000020, 0x00, 0x04, 0x0001 }, + { 55, 0x002a, 0x2000002a, 0x00, 0x00, 0x0000 }, + { 56, 0xffff, 0x01000023, 0x00, 0x04, 0x0008 }, + { 57, 0x0020, 0x00000020, 0x00, 0x00, 0x0000 }, + { 58, 0xffff, 0x01000024, 0x00, 0x00, 0x0000 }, + { 59, 0xffff, 0x01000030, 0x00, 0x00, 0x0000 }, + { 59, 0xffff, 0x0100003c, 0x01, 0x00, 0x0000 }, + { 59, 0xffff, 0x01000048, 0x04, 0x00, 0x0000 }, + { 59, 0xffff, 0x01000000, 0x0c, 0x08, 0x0100 }, + { 60, 0xffff, 0x01000031, 0x00, 0x00, 0x0000 }, + { 60, 0xffff, 0x0100003d, 0x01, 0x00, 0x0000 }, + { 60, 0xffff, 0x01000049, 0x04, 0x00, 0x0000 }, + { 60, 0xffff, 0x01000000, 0x0c, 0x08, 0x0101 }, + { 61, 0xffff, 0x01000032, 0x00, 0x00, 0x0000 }, + { 61, 0xffff, 0x0100003e, 0x01, 0x00, 0x0000 }, + { 61, 0xffff, 0x0100004a, 0x04, 0x00, 0x0000 }, + { 61, 0xffff, 0x01000000, 0x0c, 0x08, 0x0102 }, + { 62, 0xffff, 0x01000033, 0x00, 0x00, 0x0000 }, + { 62, 0xffff, 0x0100003f, 0x01, 0x00, 0x0000 }, + { 62, 0xffff, 0x0100004b, 0x04, 0x00, 0x0000 }, + { 62, 0xffff, 0x01000000, 0x0c, 0x08, 0x0103 }, + { 63, 0xffff, 0x01000034, 0x00, 0x00, 0x0000 }, + { 63, 0xffff, 0x01000040, 0x01, 0x00, 0x0000 }, + { 63, 0xffff, 0x0100004c, 0x04, 0x00, 0x0000 }, + { 63, 0xffff, 0x01000000, 0x0c, 0x08, 0x0104 }, + { 64, 0xffff, 0x01000035, 0x00, 0x00, 0x0000 }, + { 64, 0xffff, 0x01000041, 0x01, 0x00, 0x0000 }, + { 64, 0xffff, 0x0100004d, 0x04, 0x00, 0x0000 }, + { 64, 0xffff, 0x01000000, 0x0c, 0x08, 0x0105 }, + { 65, 0xffff, 0x01000036, 0x00, 0x00, 0x0000 }, + { 65, 0xffff, 0x01000042, 0x01, 0x00, 0x0000 }, + { 65, 0xffff, 0x0100004e, 0x04, 0x00, 0x0000 }, + { 65, 0xffff, 0x01000000, 0x0c, 0x08, 0x0106 }, + { 66, 0xffff, 0x01000037, 0x00, 0x00, 0x0000 }, + { 66, 0xffff, 0x01000043, 0x01, 0x00, 0x0000 }, + { 66, 0xffff, 0x0100004f, 0x04, 0x00, 0x0000 }, + { 66, 0xffff, 0x01000000, 0x0c, 0x08, 0x0107 }, + { 67, 0xffff, 0x01000038, 0x00, 0x00, 0x0000 }, + { 67, 0xffff, 0x01000044, 0x01, 0x00, 0x0000 }, + { 67, 0xffff, 0x01000050, 0x04, 0x00, 0x0000 }, + { 67, 0xffff, 0x01000000, 0x0c, 0x08, 0x0108 }, + { 68, 0xffff, 0x01000039, 0x00, 0x00, 0x0000 }, + { 68, 0xffff, 0x01000045, 0x01, 0x00, 0x0000 }, + { 68, 0xffff, 0x01000051, 0x04, 0x00, 0x0000 }, + { 68, 0xffff, 0x01000000, 0x0c, 0x08, 0x0109 }, + { 69, 0xffff, 0x01000025, 0x00, 0x00, 0x0000 }, + { 70, 0xffff, 0x01000026, 0x00, 0x00, 0x0000 }, + { 70, 0xffff, 0x01000026, 0x08, 0x00, 0x0000 }, + { 71, 0x0037, 0x20000037, 0x00, 0x00, 0x0000 }, + { 72, 0x0038, 0x20000038, 0x00, 0x00, 0x0000 }, + { 73, 0x0039, 0x20000039, 0x00, 0x00, 0x0000 }, + { 74, 0x002d, 0x2000002d, 0x00, 0x00, 0x0000 }, + { 75, 0x0034, 0x20000034, 0x00, 0x00, 0x0000 }, + { 76, 0x0035, 0x20000035, 0x00, 0x00, 0x0000 }, + { 77, 0x0036, 0x20000036, 0x00, 0x00, 0x0000 }, + { 78, 0x002b, 0x2000002b, 0x00, 0x00, 0x0000 }, + { 79, 0x0031, 0x20000031, 0x00, 0x00, 0x0000 }, + { 80, 0x0032, 0x20000032, 0x00, 0x00, 0x0000 }, + { 81, 0x0033, 0x20000033, 0x00, 0x00, 0x0000 }, + { 82, 0x0030, 0x20000030, 0x00, 0x00, 0x0000 }, + { 83, 0x002e, 0x2000002e, 0x00, 0x00, 0x0000 }, + { 83, 0xffff, 0x01000000, 0x06, 0x08, 0x0200 }, + { 83, 0xffff, 0x01000000, 0x0c, 0x08, 0x0200 }, + { 86, 0x003c, 0x0000003c, 0x00, 0x00, 0x0000 }, + { 86, 0x003e, 0x0000003e, 0x01, 0x00, 0x0000 }, + { 86, 0x007c, 0x0000007c, 0x02, 0x00, 0x0000 }, + { 87, 0xffff, 0x0100003a, 0x00, 0x00, 0x0000 }, + { 87, 0xffff, 0x01000046, 0x01, 0x00, 0x0000 }, + { 87, 0xffff, 0x01000052, 0x04, 0x00, 0x0000 }, + { 87, 0xffff, 0x01000000, 0x0c, 0x08, 0x010a }, + { 88, 0xffff, 0x0100003b, 0x00, 0x00, 0x0000 }, + { 88, 0xffff, 0x01000047, 0x01, 0x00, 0x0000 }, + { 88, 0xffff, 0x01000000, 0x0c, 0x08, 0x010b }, + { 96, 0xffff, 0x21000005, 0x00, 0x00, 0x0000 }, + { 97, 0xffff, 0x01000021, 0x00, 0x04, 0x0004 }, + { 98, 0x002f, 0x2000002f, 0x00, 0x00, 0x0000 }, + { 99, 0x005c, 0x0400005c, 0x00, 0x00, 0x0000 }, + { 100, 0xffff, 0x01001103, 0x00, 0x04, 0x0002 }, + { 102, 0xffff, 0x01000010, 0x00, 0x00, 0x0000 }, + { 103, 0xffff, 0x01000013, 0x00, 0x00, 0x0000 }, + { 104, 0xffff, 0x01000016, 0x00, 0x00, 0x0000 }, + { 105, 0xffff, 0x01000012, 0x00, 0x00, 0x0000 }, + { 105, 0xffff, 0x01000000, 0x0c, 0x08, 0x0180 }, + { 106, 0xffff, 0x01000014, 0x00, 0x00, 0x0000 }, + { 106, 0xffff, 0x01000000, 0x0c, 0x08, 0x0181 }, + { 107, 0xffff, 0x01000011, 0x00, 0x00, 0x0000 }, + { 108, 0xffff, 0x01000015, 0x00, 0x00, 0x0000 }, + { 109, 0xffff, 0x01000017, 0x00, 0x00, 0x0000 }, + { 110, 0xffff, 0x01000006, 0x00, 0x00, 0x0000 }, + { 111, 0xffff, 0x01000007, 0x00, 0x00, 0x0000 }, + { 111, 0xffff, 0x01000000, 0x06, 0x08, 0x0200 }, + { 111, 0xffff, 0x01000000, 0x0c, 0x08, 0x0200 }, + { 119, 0xffff, 0x01000008, 0x00, 0x00, 0x0000 }, +}; + +const QEvdevKeyboardMap::Composing QEvdevKeyboardHandler::s_keycompose_default[] = { + { 0x0060, 0x0041, 0x00c0 }, + { 0x0060, 0x0061, 0x00e0 }, + { 0x0027, 0x0041, 0x00c1 }, + { 0x0027, 0x0061, 0x00e1 }, + { 0x005e, 0x0041, 0x00c2 }, + { 0x005e, 0x0061, 0x00e2 }, + { 0x007e, 0x0041, 0x00c3 }, + { 0x007e, 0x0061, 0x00e3 }, + { 0x0022, 0x0041, 0x00c4 }, + { 0x0022, 0x0061, 0x00e4 }, + { 0x002d, 0x0061, 0x00aa }, + { 0x002d, 0x0041, 0x00aa }, + { 0x004f, 0x0041, 0x00c5 }, + { 0x006f, 0x0061, 0x00e5 }, + { 0x0030, 0x0041, 0x00c5 }, + { 0x0030, 0x0061, 0x00e5 }, + { 0x0041, 0x0041, 0x00c5 }, + { 0x0061, 0x0061, 0x00e5 }, + { 0x00b0, 0x0041, 0x00c5 }, + { 0x00b0, 0x0061, 0x00e5 }, + { 0x0041, 0x0045, 0x00c6 }, + { 0x0061, 0x0065, 0x00e6 }, + { 0x002c, 0x0043, 0x00c7 }, + { 0x002c, 0x0063, 0x00e7 }, + { 0x005e, 0x0043, 0x00c7 }, + { 0x005e, 0x0063, 0x00e7 }, + { 0x0060, 0x0045, 0x00c8 }, + { 0x0060, 0x0065, 0x00e8 }, + { 0x0027, 0x0045, 0x00c9 }, + { 0x0027, 0x0065, 0x00e9 }, + { 0x005e, 0x0045, 0x00ca }, + { 0x005e, 0x0065, 0x00ea }, + { 0x0022, 0x0045, 0x00cb }, + { 0x0022, 0x0065, 0x00eb }, + { 0x0060, 0x0049, 0x00cc }, + { 0x0060, 0x0069, 0x00ec }, + { 0x0027, 0x0049, 0x00cd }, + { 0x0027, 0x0069, 0x00ed }, + { 0x005e, 0x0049, 0x00ce }, + { 0x005e, 0x0069, 0x00ee }, + { 0x0022, 0x0049, 0x00cf }, + { 0x0022, 0x0069, 0x00ef }, + { 0x002d, 0x0044, 0x00d0 }, + { 0x002d, 0x0064, 0x00f0 }, + { 0x005e, 0x0044, 0x00d0 }, + { 0x005e, 0x0064, 0x00f0 }, + { 0x007e, 0x004e, 0x00d1 }, + { 0x007e, 0x006e, 0x00f1 }, + { 0x005e, 0x004e, 0x00d1 }, + { 0x005e, 0x006e, 0x00f1 }, + { 0x0060, 0x004f, 0x00d2 }, + { 0x0060, 0x006f, 0x00f2 }, + { 0x0027, 0x004f, 0x00d3 }, + { 0x0027, 0x006f, 0x00f3 }, + { 0x005e, 0x004f, 0x00d4 }, + { 0x005e, 0x006f, 0x00f4 }, + { 0x007e, 0x004f, 0x00d5 }, + { 0x007e, 0x006f, 0x00f5 }, + { 0x0022, 0x004f, 0x00d6 }, + { 0x0022, 0x006f, 0x00f6 }, + { 0x002f, 0x004f, 0x00d8 }, + { 0x002f, 0x006f, 0x00f8 }, + { 0x002d, 0x006f, 0x00ba }, + { 0x002d, 0x004f, 0x00ba }, + { 0x0060, 0x0055, 0x00d9 }, + { 0x0060, 0x0075, 0x00f9 }, + { 0x0027, 0x0055, 0x00da }, + { 0x0027, 0x0075, 0x00fa }, + { 0x005e, 0x0055, 0x00db }, + { 0x005e, 0x0075, 0x00fb }, + { 0x0022, 0x0055, 0x00dc }, + { 0x0022, 0x0075, 0x00fc }, + { 0x0027, 0x0059, 0x00dd }, + { 0x0027, 0x0079, 0x00fd }, + { 0x0054, 0x0048, 0x00de }, + { 0x0074, 0x0068, 0x00fe }, + { 0x0073, 0x0073, 0x00df }, + { 0x0022, 0x0079, 0x00ff }, + { 0x0073, 0x007a, 0x00df }, + { 0x006e, 0x006e, 0x00f1 }, + { 0x006e, 0x0068, 0x00f1 }, + { 0x004e, 0x0059, 0x00d1 }, + { 0x004e, 0x004e, 0x00d1 }, + { 0x004e, 0x0048, 0x00d1 }, + { 0x004e, 0x0079, 0x00d1 }, + { 0x004e, 0x006e, 0x00d1 }, + { 0x004e, 0x0068, 0x00d1 }, + { 0x002d, 0x004c, 0x00a3 }, + { 0x003c, 0x003c, 0x00ab }, + { 0x003e, 0x003e, 0x00bb }, + { 0x003f, 0x003f, 0x00bf }, + { 0x005e, 0x003f, 0x00bf }, + { 0x0021, 0x0021, 0x00a1 }, + { 0x005e, 0x0021, 0x00a1 }, + { 0x005e, 0x0031, 0x00b9 }, + { 0x005e, 0x0032, 0x00b2 }, + { 0x005e, 0x0033, 0x00b3 }, + { 0x002b, 0x002d, 0x00b1 }, + { 0x0063, 0x003d, 0x00a2 }, + { 0x0063, 0x002f, 0x00a2 }, + { 0x002f, 0x0063, 0x00a2 }, + { 0x002d, 0x0063, 0x00a2 }, + { 0x002d, 0x0043, 0x00a2 }, + { 0x004c, 0x003d, 0x00a3 }, + { 0x002d, 0x004c, 0x00a3 }, + { 0x002d, 0x006c, 0x00a3 }, + { 0x005e, 0x002a, 0x00d7 }, + { 0x005e, 0x0078, 0x00d7 }, + { 0x0078, 0x0078, 0x00d7 }, + { 0x005e, 0x002e, 0x00b7 }, + { 0x002e, 0x002e, 0x00b7 }, + { 0x005e, 0x002f, 0x00f7 }, + { 0x005e, 0x003a, 0x00f7 }, + { 0x002d, 0x003a, 0x00f7 }, + { 0x003a, 0x002d, 0x00f7 }, + { 0x0059, 0x003d, 0x00a5 }, + { 0x002d, 0x0059, 0x00a5 }, + { 0x002d, 0x006c, 0x00a5 }, + { 0x0028, 0x0063, 0x00a9 }, + { 0x0022, 0x0063, 0x00a9 }, + { 0x002d, 0x0061, 0x00aa }, + { 0x002d, 0x0041, 0x00aa }, + { 0x002d, 0x006f, 0x00ba }, + { 0x002d, 0x004f, 0x00ba }, + { 0x0028, 0x0072, 0x00ae }, + { 0x0022, 0x0072, 0x00ae }, + { 0x006d, 0x0075, 0x00b5 }, + { 0x0031, 0x0034, 0x0152 }, + { 0x0031, 0x0032, 0x0153 }, + { 0x0033, 0x0034, 0x0178 }, + { 0x0065, 0x003d, 0x20ac }, + { 0x002d, 0x0065, 0x20ac }, + { 0x002d, 0x0045, 0x20ac }, + { 0x0076, 0x0053, 0x0160 }, + { 0x005e, 0x0053, 0x0160 }, + { 0x0076, 0x0073, 0x0161 }, + { 0x005e, 0x0073, 0x0161 }, + { 0x0076, 0x005a, 0x017d }, + { 0x005e, 0x005a, 0x017d }, + { 0x0076, 0x007a, 0x017e }, + { 0x005e, 0x007a, 0x017e }, + { 0x004f, 0x0045, 0x0152 }, + { 0x004f, 0x0065, 0x0152 }, + { 0x006f, 0x0065, 0x0153 }, + { 0x0022, 0x0059, 0x0178 }, + { 0x0069, 0x006a, 0x00ff }, + { 0x0049, 0x004a, 0x0178 }, +}; + +#endif // QEVDEVKEYBOARDHANDLER_DEFAULTMAP_P_H diff --git a/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler.cpp b/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler.cpp new file mode 100644 index 0000000000..9d596780a9 --- /dev/null +++ b/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler.cpp @@ -0,0 +1,489 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qevdevkeyboardhandler_p.h" + +#include + +#include +#include +#include +#include +#include + +#include + +//#define QT_QPA_KEYMAP_DEBUG + +#ifdef QT_QPA_KEYMAP_DEBUG +#include +#endif + +QT_BEGIN_NAMESPACE + +// simple builtin US keymap +#include "qevdevkeyboard_defaultmap_p.h" + +QEvdevKeyboardHandler::QEvdevKeyboardHandler(const QString &device, int fd, bool disableZap, bool enableCompose, const QString &keymapFile) + : m_device(device), m_fd(fd), + m_modifiers(0), m_composing(0), m_dead_unicode(0xffff), + m_no_zap(disableZap), m_do_compose(enableCompose), + m_keymap(0), m_keymap_size(0), m_keycompose(0), m_keycompose_size(0) +{ +#ifdef QT_QPA_KEYMAP_DEBUG + qWarning() << "Create keyboard handler with for device" << device; +#endif + + setObjectName(QLatin1String("LinuxInput Keyboard Handler")); + + memset(m_locks, 0, sizeof(m_locks)); + + if (keymapFile.isEmpty() || !loadKeymap(keymapFile)) + unloadKeymap(); + + // socket notifier for events on the keyboard device + QSocketNotifier *notifier; + notifier = new QSocketNotifier(m_fd, QSocketNotifier::Read, this); + connect(notifier, SIGNAL(activated(int)), this, SLOT(readKeycode())); +} + +QEvdevKeyboardHandler::~QEvdevKeyboardHandler() +{ + unloadKeymap(); + + if (m_fd >= 0) + qt_safe_close(m_fd); +} + +QEvdevKeyboardHandler *QEvdevKeyboardHandler::create(const QString &device, const QString &specification) +{ +#ifdef QT_QPA_KEYMAP_DEBUG + qWarning() << "Try to create keyboard handler for" << device << specification; +#endif + + QString keymapFile; + int repeatDelay = 400; + int repeatRate = 80; + bool disableZap = false; + bool enableCompose = false; + + QStringList args = specification.split(QLatin1Char(':')); + foreach (const QString &arg, args) { + if (arg.startsWith(QLatin1String("keymap="))) + keymapFile = arg.mid(7); + else if (arg == QLatin1String("disable-zap")) + disableZap = true; + else if (arg == QLatin1String("enable-compose")) + enableCompose = true; + else if (arg.startsWith(QLatin1String("repeat-delay="))) + repeatDelay = arg.mid(13).toInt(); + else if (arg.startsWith(QLatin1String("repeat-rate="))) + repeatRate = arg.mid(12).toInt(); + } + +#ifdef QT_QPA_KEYMAP_DEBUG + qWarning() << "Opening keyboard at" << device; +#endif + + int fd; + fd = qt_safe_open(device.toLocal8Bit().constData(), O_RDONLY | O_NDELAY, 0); + if (fd >= 0) { + if (repeatDelay > 0 && repeatRate > 0) { + int kbdrep[2] = { repeatDelay, repeatRate }; + ::ioctl(fd, EVIOCSREP, kbdrep); + } + + return new QEvdevKeyboardHandler(device, fd, disableZap, enableCompose, keymapFile); + } else { + qWarning("Cannot open keyboard input device '%s': %s", qPrintable(device), strerror(errno)); + return 0; + } +} + +void QEvdevKeyboardHandler::switchLed(int led, bool state) +{ +#ifdef QT_QPA_KEYMAP_DEBUG + qWarning() << "switchLed" << led << state; +#endif + + struct ::input_event led_ie; + ::gettimeofday(&led_ie.time, 0); + led_ie.type = EV_LED; + led_ie.code = led; + led_ie.value = state; + + qt_safe_write(m_fd, &led_ie, sizeof(led_ie)); +} + +void QEvdevKeyboardHandler::readKeycode() +{ +#ifdef QT_QPA_KEYMAP_DEBUG + qWarning() << "Read new keycode on" << m_device; +#endif + + struct ::input_event buffer[32]; + int n = 0; + + forever { + int result = qt_safe_read(m_fd, reinterpret_cast(buffer) + n, sizeof(buffer) - n); + + if (result == 0) { + qWarning("Got EOF from the input device."); + return; + } else if (result < 0) { + if (errno != EINTR && errno != EAGAIN) { + qWarning("Could not read from input device: %s", strerror(errno)); + return; + } + } else { + n += result; + if (n % sizeof(buffer[0]) == 0) + break; + } + } + + n /= sizeof(buffer[0]); + + for (int i = 0; i < n; ++i) { + if (buffer[i].type != EV_KEY) + continue; + + quint16 code = buffer[i].code; + qint32 value = buffer[i].value; + + QEvdevKeyboardHandler::KeycodeAction ka; + ka = processKeycode(code, value != 0, value == 2); + + switch (ka) { + case QEvdevKeyboardHandler::CapsLockOn: + case QEvdevKeyboardHandler::CapsLockOff: + switchLed(LED_CAPSL, ka == QEvdevKeyboardHandler::CapsLockOn); + break; + + case QEvdevKeyboardHandler::NumLockOn: + case QEvdevKeyboardHandler::NumLockOff: + switchLed(LED_NUML, ka == QEvdevKeyboardHandler::NumLockOn); + break; + + case QEvdevKeyboardHandler::ScrollLockOn: + case QEvdevKeyboardHandler::ScrollLockOff: + switchLed(LED_SCROLLL, ka == QEvdevKeyboardHandler::ScrollLockOn); + break; + + default: + // ignore console switching and reboot + break; + } + } +} + +void QEvdevKeyboardHandler::processKeyEvent(int unicode, int keycode, Qt::KeyboardModifiers modifiers, bool isPress, bool autoRepeat) +{ + QWindowSystemInterface::handleKeyEvent(0, ( isPress ? QEvent::KeyPress : QEvent::KeyRelease ), keycode, modifiers, QString( unicode ), autoRepeat ); +} + +QEvdevKeyboardHandler::KeycodeAction QEvdevKeyboardHandler::processKeycode(quint16 keycode, bool pressed, bool autorepeat) +{ + KeycodeAction result = None; + bool first_press = pressed && !autorepeat; + + const QEvdevKeyboardMap::Mapping *map_plain = 0; + const QEvdevKeyboardMap::Mapping *map_withmod = 0; + + // get a specific and plain mapping for the keycode and the current modifiers + for (int i = 0; i < m_keymap_size && !(map_plain && map_withmod); ++i) { + const QEvdevKeyboardMap::Mapping *m = m_keymap + i; + if (m->keycode == keycode) { + if (m->modifiers == 0) + map_plain = m; + + quint8 testmods = m_modifiers; + if (m_locks[0] /*CapsLock*/ && (m->flags & QEvdevKeyboardMap::IsLetter)) + testmods ^= QEvdevKeyboardMap::ModShift; + if (m->modifiers == testmods) + map_withmod = m; + } + } + +#ifdef QT_QPA_KEYMAP_DEBUG + qWarning("Processing key event: keycode=%3d, modifiers=%02x pressed=%d, autorepeat=%d | plain=%d, withmod=%d, size=%d", \ + keycode, m_modifiers, pressed ? 1 : 0, autorepeat ? 1 : 0, \ + map_plain ? map_plain - m_keymap : -1, \ + map_withmod ? map_withmod - m_keymap : -1, \ + m_keymap_size); +#endif + + const QEvdevKeyboardMap::Mapping *it = map_withmod ? map_withmod : map_plain; + + if (!it) { +#ifdef QT_QPA_KEYMAP_DEBUG + // we couldn't even find a plain mapping + qWarning("Could not find a suitable mapping for keycode: %3d, modifiers: %02x", keycode, m_modifiers); +#endif + return result; + } + + bool skip = false; + quint16 unicode = it->unicode; + quint32 qtcode = it->qtcode; + + if ((it->flags & QEvdevKeyboardMap::IsModifier) && it->special) { + // this is a modifier, i.e. Shift, Alt, ... + if (pressed) + m_modifiers |= quint8(it->special); + else + m_modifiers &= ~quint8(it->special); + } else if (qtcode >= Qt::Key_CapsLock && qtcode <= Qt::Key_ScrollLock) { + // (Caps|Num|Scroll)Lock + if (first_press) { + quint8 &lock = m_locks[qtcode - Qt::Key_CapsLock]; + lock ^= 1; + + switch (qtcode) { + case Qt::Key_CapsLock : result = lock ? CapsLockOn : CapsLockOff; m_modifiers ^= QEvdevKeyboardMap::ModShift; break; + case Qt::Key_NumLock : result = lock ? NumLockOn : NumLockOff; break; + case Qt::Key_ScrollLock: result = lock ? ScrollLockOn : ScrollLockOff; break; + default : break; + } + } + } else if ((it->flags & QEvdevKeyboardMap::IsSystem) && it->special && first_press) { + switch (it->special) { + case QEvdevKeyboardMap::SystemReboot: + result = Reboot; + break; + + case QEvdevKeyboardMap::SystemZap: + if (!m_no_zap) + qApp->quit(); + break; + + case QEvdevKeyboardMap::SystemConsolePrevious: + result = PreviousConsole; + break; + + case QEvdevKeyboardMap::SystemConsoleNext: + result = NextConsole; + break; + + default: + if (it->special >= QEvdevKeyboardMap::SystemConsoleFirst && + it->special <= QEvdevKeyboardMap::SystemConsoleLast) { + result = KeycodeAction(SwitchConsoleFirst + ((it->special & QEvdevKeyboardMap::SystemConsoleMask) & SwitchConsoleMask)); + } + break; + } + + skip = true; // no need to tell Qt about it + } else if ((qtcode == Qt::Key_Multi_key) && m_do_compose) { + // the Compose key was pressed + if (first_press) + m_composing = 2; + skip = true; + } else if ((it->flags & QEvdevKeyboardMap::IsDead) && m_do_compose) { + // a Dead key was pressed + if (first_press && m_composing == 1 && m_dead_unicode == unicode) { // twice + m_composing = 0; + qtcode = Qt::Key_unknown; // otherwise it would be Qt::Key_Dead... + } else if (first_press && unicode != 0xffff) { + m_dead_unicode = unicode; + m_composing = 1; + skip = true; + } else { + skip = true; + } + } + + if (!skip) { + // a normal key was pressed + const int modmask = Qt::ShiftModifier | Qt::ControlModifier | Qt::AltModifier | Qt::MetaModifier | Qt::KeypadModifier; + + // we couldn't find a specific mapping for the current modifiers, + // or that mapping didn't have special modifiers: + // so just report the plain mapping with additional modifiers. + if ((it == map_plain && it != map_withmod) || + (map_withmod && !(map_withmod->qtcode & modmask))) { + qtcode |= QEvdevKeyboardHandler::toQtModifiers(m_modifiers); + } + + if (m_composing == 2 && first_press && !(it->flags & QEvdevKeyboardMap::IsModifier)) { + // the last key press was the Compose key + if (unicode != 0xffff) { + int idx = 0; + // check if this code is in the compose table at all + for ( ; idx < m_keycompose_size; ++idx) { + if (m_keycompose[idx].first == unicode) + break; + } + if (idx < m_keycompose_size) { + // found it -> simulate a Dead key press + m_dead_unicode = unicode; + unicode = 0xffff; + m_composing = 1; + skip = true; + } else { + m_composing = 0; + } + } else { + m_composing = 0; + } + } else if (m_composing == 1 && first_press && !(it->flags & QEvdevKeyboardMap::IsModifier)) { + // the last key press was a Dead key + bool valid = false; + if (unicode != 0xffff) { + int idx = 0; + // check if this code is in the compose table at all + for ( ; idx < m_keycompose_size; ++idx) { + if (m_keycompose[idx].first == m_dead_unicode && m_keycompose[idx].second == unicode) + break; + } + if (idx < m_keycompose_size) { + quint16 composed = m_keycompose[idx].result; + if (composed != 0xffff) { + unicode = composed; + qtcode = Qt::Key_unknown; + valid = true; + } + } + } + if (!valid) { + unicode = m_dead_unicode; + qtcode = Qt::Key_unknown; + } + m_composing = 0; + } + + if (!skip) { +#ifdef QT_QPA_KEYMAP_DEBUG + qWarning("Processing: uni=%04x, qt=%08x, qtmod=%08x", unicode, qtcode & ~modmask, (qtcode & modmask)); +#endif + + // send the result to the server + processKeyEvent(unicode, qtcode & ~modmask, Qt::KeyboardModifiers(qtcode & modmask), pressed, autorepeat); + } + } + return result; +} + +void QEvdevKeyboardHandler::unloadKeymap() +{ +#ifdef QT_QPA_KEYMAP_DEBUG + qWarning() << "Unload current keymap and restore built-in"; +#endif + + if (m_keymap && m_keymap != s_keymap_default) + delete [] m_keymap; + if (m_keycompose && m_keycompose != s_keycompose_default) + delete [] m_keycompose; + + m_keymap = s_keymap_default; + m_keymap_size = sizeof(s_keymap_default) / sizeof(s_keymap_default[0]); + m_keycompose = s_keycompose_default; + m_keycompose_size = sizeof(s_keycompose_default) / sizeof(s_keycompose_default[0]); + + // reset state, so we could switch keymaps at runtime + m_modifiers = 0; + memset(m_locks, 0, sizeof(m_locks)); + m_composing = 0; + m_dead_unicode = 0xffff; +} + +bool QEvdevKeyboardHandler::loadKeymap(const QString &file) +{ +#ifdef QT_QPA_KEYMAP_DEBUG + qWarning() << "Load keymap" << file; +#endif + + QFile f(file); + + if (!f.open(QIODevice::ReadOnly)) { + qWarning("Could not open keymap file '%s'", qPrintable(file)); + return false; + } + + // .qmap files have a very simple structure: + // quint32 magic (QKeyboard::FileMagic) + // quint32 version (1) + // quint32 keymap_size (# of struct QKeyboard::Mappings) + // quint32 keycompose_size (# of struct QKeyboard::Composings) + // all QKeyboard::Mappings via QDataStream::operator(<<|>>) + // all QKeyboard::Composings via QDataStream::operator(<<|>>) + + quint32 qmap_magic, qmap_version, qmap_keymap_size, qmap_keycompose_size; + + QDataStream ds(&f); + + ds >> qmap_magic >> qmap_version >> qmap_keymap_size >> qmap_keycompose_size; + + if (ds.status() != QDataStream::Ok || qmap_magic != QEvdevKeyboardMap::FileMagic || qmap_version != 1 || qmap_keymap_size == 0) { + qWarning("'%s' is ot a valid.qmap keymap file.", qPrintable(file)); + return false; + } + + QEvdevKeyboardMap::Mapping *qmap_keymap = new QEvdevKeyboardMap::Mapping[qmap_keymap_size]; + QEvdevKeyboardMap::Composing *qmap_keycompose = qmap_keycompose_size ? new QEvdevKeyboardMap::Composing[qmap_keycompose_size] : 0; + + for (quint32 i = 0; i < qmap_keymap_size; ++i) + ds >> qmap_keymap[i]; + for (quint32 i = 0; i < qmap_keycompose_size; ++i) + ds >> qmap_keycompose[i]; + + if (ds.status() != QDataStream::Ok) { + delete [] qmap_keymap; + delete [] qmap_keycompose; + + qWarning("Keymap file '%s' can not be loaded.", qPrintable(file)); + return false; + } + + // unload currently active and clear state + unloadKeymap(); + + m_keymap = qmap_keymap; + m_keymap_size = qmap_keymap_size; + m_keycompose = qmap_keycompose; + m_keycompose_size = qmap_keycompose_size; + + m_do_compose = true; + + return true; +} + +QT_END_NAMESPACE diff --git a/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler_p.h b/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler_p.h new file mode 100644 index 0000000000..2d38df814d --- /dev/null +++ b/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler_p.h @@ -0,0 +1,202 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QEVDEVKEYBOARDHANDLER_P_H +#define QEVDEVKEYBOARDHANDLER_P_H + +#include +#include +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +namespace QEvdevKeyboardMap { + const quint32 FileMagic = 0x514d4150; // 'QMAP' + + struct Mapping { + quint16 keycode; + quint16 unicode; + quint32 qtcode; + quint8 modifiers; + quint8 flags; + quint16 special; + + }; + + enum Flags { + IsDead = 0x01, + IsLetter = 0x02, + IsModifier = 0x04, + IsSystem = 0x08 + }; + + enum System { + SystemConsoleFirst = 0x0100, + SystemConsoleMask = 0x007f, + SystemConsoleLast = 0x017f, + SystemConsolePrevious = 0x0180, + SystemConsoleNext = 0x0181, + SystemReboot = 0x0200, + SystemZap = 0x0300 + }; + + struct Composing { + quint16 first; + quint16 second; + quint16 result; + }; + + enum Modifiers { + ModPlain = 0x00, + ModShift = 0x01, + ModAltGr = 0x02, + ModControl = 0x04, + ModAlt = 0x08, + ModShiftL = 0x10, + ModShiftR = 0x20, + ModCtrlL = 0x40, + ModCtrlR = 0x80 + // ModCapsShift = 0x100, // not supported! + }; +} + +inline QDataStream &operator>>(QDataStream &ds, QEvdevKeyboardMap::Mapping &m) +{ + return ds >> m.keycode >> m.unicode >> m.qtcode >> m.modifiers >> m.flags >> m.special; +} + +inline QDataStream &operator<<(QDataStream &ds, const QEvdevKeyboardMap::Mapping &m) +{ + return ds << m.keycode << m.unicode << m.qtcode << m.modifiers << m.flags << m.special; +} + +inline QDataStream &operator>>(QDataStream &ds, QEvdevKeyboardMap::Composing &c) +{ + return ds >> c.first >> c.second >> c.result; +} + +inline QDataStream &operator<<(QDataStream &ds, const QEvdevKeyboardMap::Composing &c) +{ + return ds << c.first << c.second << c.result; +} + + +class QEvdevKeyboardHandler : public QObject +{ + Q_OBJECT +public: + QEvdevKeyboardHandler(const QString &device, int fd, bool disableZap, bool enableCompose, const QString &keymapFile); + ~QEvdevKeyboardHandler(); + + enum KeycodeAction { + None = 0, + + CapsLockOff = 0x01000000, + CapsLockOn = 0x01000001, + NumLockOff = 0x02000000, + NumLockOn = 0x02000001, + ScrollLockOff = 0x03000000, + ScrollLockOn = 0x03000001, + + Reboot = 0x04000000, + + PreviousConsole = 0x05000000, + NextConsole = 0x05000001, + SwitchConsoleFirst = 0x06000000, + SwitchConsoleLast = 0x0600007f, + SwitchConsoleMask = 0x0000007f + }; + + static QEvdevKeyboardHandler *create(const QString &device, const QString &specification); + + static Qt::KeyboardModifiers toQtModifiers(quint8 mod) + { + Qt::KeyboardModifiers qtmod = Qt::NoModifier; + + if (mod & (QEvdevKeyboardMap::ModShift | QEvdevKeyboardMap::ModShiftL | QEvdevKeyboardMap::ModShiftR)) + qtmod |= Qt::ShiftModifier; + if (mod & (QEvdevKeyboardMap::ModControl | QEvdevKeyboardMap::ModCtrlL | QEvdevKeyboardMap::ModCtrlR)) + qtmod |= Qt::ControlModifier; + if (mod & QEvdevKeyboardMap::ModAlt) + qtmod |= Qt::AltModifier; + + return qtmod; + } + +private slots: + void readKeycode(); + KeycodeAction processKeycode(quint16 keycode, bool pressed, bool autorepeat); + +private: + void unloadKeymap(); + bool loadKeymap(const QString &file); + void processKeyEvent(int unicode, int keycode, Qt::KeyboardModifiers modifiers, bool isPress, bool autoRepeat); + void switchLed(int, bool); + + QString m_device; + int m_fd; + + // keymap handling + quint8 m_modifiers; + quint8 m_locks[3]; + int m_composing; + quint16 m_dead_unicode; + + bool m_no_zap; + bool m_do_compose; + + const QEvdevKeyboardMap::Mapping *m_keymap; + int m_keymap_size; + const QEvdevKeyboardMap::Composing *m_keycompose; + int m_keycompose_size; + + static const QEvdevKeyboardMap::Mapping s_keymap_default[]; + static const QEvdevKeyboardMap::Composing s_keycompose_default[]; +}; + + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QEVDEVKEYBOARDHANDLER_P_H diff --git a/src/platformsupport/input/evdevkeyboard/qevdevkeyboardmanager.cpp b/src/platformsupport/input/evdevkeyboard/qevdevkeyboardmanager.cpp new file mode 100644 index 0000000000..4143d10244 --- /dev/null +++ b/src/platformsupport/input/evdevkeyboard/qevdevkeyboardmanager.cpp @@ -0,0 +1,129 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qevdevkeyboardmanager_p.h" + +#include +#include + +//#define QT_QPA_KEYMAP_DEBUG + +#ifdef QT_QPA_KEYMAP_DEBUG +#include +#endif + +QT_BEGIN_NAMESPACE + +QEvdevKeyboardManager::QEvdevKeyboardManager(const QString &key, const QString &specification, QObject *parent) + : QObject(parent) +{ + Q_UNUSED(key); + + QStringList args = specification.split(QLatin1Char(':')); + QStringList devices; + + foreach (const QString &arg, args) { + if (arg.startsWith(QLatin1String("/dev/"))) { + // if device is specified try to use it + devices.append(arg); + args.removeAll(arg); + } + } + + // build new specification without /dev/ elements + m_spec = args.join(QLatin1String(":")); + + // add all keyboards for devices specified in the argument list + foreach (const QString &device, devices) + addKeyboard(device); + + if (devices.isEmpty()) { +#ifdef QT_QPA_KEYMAP_DEBUG + qWarning() << "Use device discovery"; +#endif + + m_deviceDiscovery = QDeviceDiscovery::create(QDeviceDiscovery::Device_Keyboard, this); + if (m_deviceDiscovery) { + // scan and add already connected keyboards + QStringList devices = m_deviceDiscovery->scanConnectedDevices(); + foreach (QString device, devices) { + addKeyboard(device); + } + + connect(m_deviceDiscovery, SIGNAL(deviceDetected(QString)), this, SLOT(addKeyboard(QString))); + connect(m_deviceDiscovery, SIGNAL(deviceRemoved(QString)), this, SLOT(removeKeyboard(QString))); + } + } +} + +QEvdevKeyboardManager::~QEvdevKeyboardManager() +{ + qDeleteAll(m_keyboards); + m_keyboards.clear(); +} + +void QEvdevKeyboardManager::addKeyboard(const QString &deviceNode) +{ +#ifdef QT_QPA_KEYMAP_DEBUG + qWarning() << "Adding keyboard at" << deviceNode; +#endif + + QEvdevKeyboardHandler *keyboard; + keyboard = QEvdevKeyboardHandler::create(deviceNode, m_spec); + if (keyboard) + m_keyboards.insert(deviceNode, keyboard); + else + qWarning("Failed to open keyboard"); +} + +void QEvdevKeyboardManager::removeKeyboard(const QString &deviceNode) +{ + if (m_keyboards.contains(deviceNode)) { +#ifdef QT_QPA_KEYMAP_DEBUG + qWarning() << "Removing keyboard at" << deviceNode; +#endif + QEvdevKeyboardHandler *keyboard = m_keyboards.value(deviceNode); + m_keyboards.remove(deviceNode); + delete keyboard; + } +} + +QT_END_NAMESPACE diff --git a/src/platformsupport/input/evdevkeyboard/qevdevkeyboardmanager_p.h b/src/platformsupport/input/evdevkeyboard/qevdevkeyboardmanager_p.h new file mode 100644 index 0000000000..35e0d14bcd --- /dev/null +++ b/src/platformsupport/input/evdevkeyboard/qevdevkeyboardmanager_p.h @@ -0,0 +1,78 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QEVDEVKEYBOARDMANAGER_P_H +#define QEVDEVKEYBOARDMANAGER_P_H + +#include "qevdevkeyboardhandler_p.h" + +#include + +#include +#include +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +class QEvdevKeyboardManager : public QObject +{ + Q_OBJECT +public: + QEvdevKeyboardManager(const QString &key, const QString &specification, QObject *parent = 0); + ~QEvdevKeyboardManager(); + +private slots: + void addKeyboard(const QString &deviceNode = QString()); + void removeKeyboard(const QString &deviceNode); + +private: + QString m_spec; + QHash m_keyboards; + QDeviceDiscovery *m_deviceDiscovery; +}; + +QT_END_HEADER + +QT_END_NAMESPACE + +#endif // QEVDEVKEYBOARDMANAGER_P_H diff --git a/src/platformsupport/input/evdevmouse/evdevmouse.pri b/src/platformsupport/input/evdevmouse/evdevmouse.pri new file mode 100644 index 0000000000..16b456683d --- /dev/null +++ b/src/platformsupport/input/evdevmouse/evdevmouse.pri @@ -0,0 +1,12 @@ +HEADERS += \ + $$PWD/qevdevmousehandler_p.h \ + $$PWD/qevdevmousemanager_p.h + +SOURCES += \ + $$PWD/qevdevmousehandler.cpp \ + $$PWD/qevdevmousemanager.cpp + +contains(QT_CONFIG, libudev) { + LIBS += $$QMAKE_LIBS_LIBUDEV +} + diff --git a/src/platformsupport/input/evdevmouse/qevdevmousehandler.cpp b/src/platformsupport/input/evdevmouse/qevdevmousehandler.cpp new file mode 100644 index 0000000000..2e318a0c3a --- /dev/null +++ b/src/platformsupport/input/evdevmouse/qevdevmousehandler.cpp @@ -0,0 +1,233 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qevdevmousehandler_p.h" + +#include +#include +#include +#include +#include +#include + +#include +#include // overrides QT_OPEN + +#include + +#include +#include + +#include + +//#define QT_QPA_MOUSE_HANDLER_DEBUG + +QT_BEGIN_NAMESPACE + +QEvdevMouseHandler *QEvdevMouseHandler::create(const QString &device, const QString &specification) +{ +#ifdef QT_QPA_MOUSE_HANDLER_DEBUG + qWarning() << "Try to create mouse handler for" << device << specification; +#endif + + bool compression = true; + int jitterLimit = 0; + + QStringList args = specification.split(QLatin1Char(':')); + foreach (const QString &arg, args) { + if (arg == QLatin1String("nocompress")) + compression = false; + else if (arg.startsWith(QLatin1String("dejitter="))) + jitterLimit = arg.mid(9).toInt(); + } + + int fd; + fd = qt_safe_open(device.toLocal8Bit().constData(), O_RDONLY | O_NDELAY, 0); + if (fd >= 0) { + return new QEvdevMouseHandler(device, fd, compression, jitterLimit); + } else { + qWarning("Cannot open mouse input device '%s': %s", qPrintable(device), strerror(errno)); + return 0; + } +} + +QEvdevMouseHandler::QEvdevMouseHandler(const QString &device, int fd, bool compression, int jitterLimit) + : m_device(device), m_fd(fd), m_notify(0), m_x(0), m_y(0), m_prevx(0), m_prevy(0), + m_compression(compression), m_buttons(0) +{ + setObjectName(QLatin1String("Evdev Mouse Handler")); + + m_jitterLimitSquared = jitterLimit * jitterLimit; + + // socket notifier for events on the mouse device + QSocketNotifier *notifier; + notifier = new QSocketNotifier(m_fd, QSocketNotifier::Read, this); + connect(notifier, SIGNAL(activated(int)), this, SLOT(readMouseData())); +} + +QEvdevMouseHandler::~QEvdevMouseHandler() +{ + if (m_fd >= 0) + qt_safe_close(m_fd); +} + +void QEvdevMouseHandler::sendMouseEvent() +{ + emit handleMouseEvent(m_x - m_prevx, m_y - m_prevy, m_buttons); + + m_prevx = m_x; + m_prevy = m_y; +} + +void QEvdevMouseHandler::readMouseData() +{ + struct ::input_event buffer[32]; + int n = 0; + bool posChanged = false; + bool pendingMouseEvent = false; + int eventCompressCount = 0; + forever { + int result = QT_READ(m_fd, reinterpret_cast(buffer) + n, sizeof(buffer) - n); + + if (result == 0) { + qWarning("Got EOF from the input device."); + return; + } else if (result < 0) { + if (errno != EINTR && errno != EAGAIN) { + qWarning("Could not read from input device: %s", strerror(errno)); + return; + } + } else { + n += result; + if (n % sizeof(buffer[0]) == 0) + break; + } + } + + n /= sizeof(buffer[0]); + + for (int i = 0; i < n; ++i) { + struct ::input_event *data = &buffer[i]; + //qDebug() << ">>" << hex << data->type << data->code << dec << data->value; + if (data->type == EV_ABS) { + if (data->code == ABS_X && m_x != data->value) { + m_x = data->value; + posChanged = true; + } else if (data->code == ABS_Y && m_y != data->value) { + m_y = data->value; + posChanged = true; + } + } else if (data->type == EV_REL) { + if (data->code == REL_X) { + m_x += data->value; + posChanged = true; + } else if (data->code == REL_Y) { + m_y += data->value; + posChanged = true; + } else if (data->code == ABS_WHEEL) { // vertical scroll + // data->value: 1 == up, -1 == down + int delta = 120 * data->value; + QWindowSystemInterface::handleWheelEvent(0, QPoint(m_x, m_y), + QPoint(m_x, m_y), + delta, Qt::Vertical); + } else if (data->code == ABS_THROTTLE) { // horizontal scroll + // data->value: 1 == right, -1 == left + int delta = 120 * -data->value; + QWindowSystemInterface::handleWheelEvent(0, QPoint(m_x, m_y), + QPoint(m_x, m_y), + delta, Qt::Horizontal); + } + } else if (data->type == EV_KEY && data->code == BTN_TOUCH) { + m_buttons = data->value ? Qt::LeftButton : Qt::NoButton; + + sendMouseEvent(); + pendingMouseEvent = false; + } else if (data->type == EV_KEY && data->code >= BTN_LEFT && data->code <= BTN_JOYSTICK) { + Qt::MouseButton button = Qt::NoButton; + // BTN_LEFT == 0x110 in kernel's input.h + // The range of possible mouse buttons ends just before BTN_JOYSTICK, value 0x120. + switch (data->code) { + case 0x110: button = Qt::LeftButton; break; // BTN_LEFT + case 0x111: button = Qt::RightButton; break; + case 0x112: button = Qt::MiddleButton; break; + case 0x113: button = Qt::ExtraButton1; break; // AKA Qt::BackButton + case 0x114: button = Qt::ExtraButton2; break; // AKA Qt::ForwardButton + case 0x115: button = Qt::ExtraButton3; break; // AKA Qt::TaskButton + case 0x116: button = Qt::ExtraButton4; break; + case 0x117: button = Qt::ExtraButton5; break; + case 0x118: button = Qt::ExtraButton6; break; + case 0x119: button = Qt::ExtraButton7; break; + case 0x11a: button = Qt::ExtraButton8; break; + case 0x11b: button = Qt::ExtraButton9; break; + case 0x11c: button = Qt::ExtraButton10; break; + case 0x11d: button = Qt::ExtraButton11; break; + case 0x11e: button = Qt::ExtraButton12; break; + case 0x11f: button = Qt::ExtraButton13; break; + } + if (data->value) + m_buttons |= button; + else + m_buttons &= ~button; + sendMouseEvent(); + pendingMouseEvent = false; + } else if (data->type == EV_SYN && data->code == SYN_REPORT) { + if (posChanged) { + posChanged = false; + if (m_compression) { + pendingMouseEvent = true; + eventCompressCount++; + } else { + sendMouseEvent(); + } + } + } else if (data->type == EV_MSC && data->code == MSC_SCAN) { + // kernel encountered an unmapped key - just ignore it + continue; + } + } + if (m_compression && pendingMouseEvent) { + int distanceSquared = (m_x - m_prevx)*(m_x - m_prevx) + (m_y - m_prevy)*(m_y - m_prevy); + if (distanceSquared > m_jitterLimitSquared) + sendMouseEvent(); + } +} + +QT_END_NAMESPACE diff --git a/src/platformsupport/input/evdevmouse/qevdevmousehandler_p.h b/src/platformsupport/input/evdevmouse/qevdevmousehandler_p.h new file mode 100644 index 0000000000..38ee312372 --- /dev/null +++ b/src/platformsupport/input/evdevmouse/qevdevmousehandler_p.h @@ -0,0 +1,86 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QEVDEVMOUSEHANDLER_P_H +#define QEVDEVMOUSEHANDLER_P_H + +#include +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +class QSocketNotifier; + +class QEvdevMouseHandler : public QObject +{ + Q_OBJECT +public: + static QEvdevMouseHandler *create(const QString &device, const QString &specification); + ~QEvdevMouseHandler(); + +signals: + void handleMouseEvent(int x, int y, Qt::MouseButtons buttons); + +private slots: + void readMouseData(); + +private: + QEvdevMouseHandler(const QString &device, int fd, bool compression, int jitterLimit); + + void sendMouseEvent(); + + QString m_device; + int m_fd; + QSocketNotifier *m_notify; + int m_x, m_y; + int m_prevx, m_prevy; + bool m_compression; + Qt::MouseButtons m_buttons; + int m_jitterLimitSquared; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QEVDEVMOUSEHANDLER_P_H diff --git a/src/platformsupport/input/evdevmouse/qevdevmousemanager.cpp b/src/platformsupport/input/evdevmouse/qevdevmousemanager.cpp new file mode 100644 index 0000000000..f1a86cb15a --- /dev/null +++ b/src/platformsupport/input/evdevmouse/qevdevmousemanager.cpp @@ -0,0 +1,163 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qevdevmousemanager_p.h" + +#include +#include +#include +#include + +//#define QT_QPA_MOUSEMANAGER_DEBUG + +#ifdef QT_QPA_MOUSEMANAGER_DEBUG +#include +#endif + +QT_BEGIN_NAMESPACE + +QEvdevMouseManager::QEvdevMouseManager(const QString &key, const QString &specification, QObject *parent) + : QObject(parent), m_x(0), m_y(0), m_xoffset(0), m_yoffset(0) +{ + Q_UNUSED(key); + + QStringList args = specification.split(QLatin1Char(':')); + QStringList devices; + + foreach (const QString &arg, args) { + if (arg.startsWith(QLatin1String("/dev/"))) { + // if device is specified try to use it + devices.append(arg); + args.removeAll(arg); + } else if (arg.startsWith(QLatin1String("xoffset="))) { + m_xoffset = arg.mid(8).toInt(); + } else if (arg.startsWith(QLatin1String("yoffset="))) { + m_yoffset = arg.mid(8).toInt(); + } + } + + // build new specification without /dev/ elements + m_spec = args.join(QLatin1String(":")); + + // add all mice for devices specified in the argument list + foreach (const QString &device, devices) + addMouse(device); + + if (devices.isEmpty()) { +#ifdef QT_QPA_MOUSEMANAGER_DEBUG + qWarning() << "Use device discovery"; +#endif + + m_deviceDiscovery = QDeviceDiscovery::create(QDeviceDiscovery::Device_Mouse | QDeviceDiscovery::Device_Touchpad, this); + if (m_deviceDiscovery) { + // scan and add already connected keyboards + QStringList devices = m_deviceDiscovery->scanConnectedDevices(); + foreach (QString device, devices) { + addMouse(device); + } + + connect(m_deviceDiscovery, SIGNAL(deviceDetected(QString)), this, SLOT(addMouse(QString))); + connect(m_deviceDiscovery, SIGNAL(deviceRemoved(QString)), this, SLOT(removeMouse(QString))); + } + } +} + +QEvdevMouseManager::~QEvdevMouseManager() +{ + qDeleteAll(m_mice); + m_mice.clear(); +} + +void QEvdevMouseManager::handleMouseEvent(int x, int y, Qt::MouseButtons buttons) +{ + // update current absolute coordinates + m_x += x; + m_y += y; + + // clamp to screen geometry + QRect g = QGuiApplication::primaryScreen()->virtualGeometry(); + if (m_x + m_xoffset < g.left()) + m_x = g.left() - m_xoffset; + else if (m_x + m_xoffset > g.right()) + m_x = g.right() - m_xoffset; + + if (m_y + m_yoffset < g.top()) + m_y = g.top() - m_yoffset; + else if (m_y + m_yoffset > g.bottom()) + m_y = g.bottom() - m_yoffset; + + QPoint pos(m_x + m_xoffset, m_y + m_yoffset); + QWindowSystemInterface::handleMouseEvent(0, pos, pos, buttons); + +#ifdef QT_QPA_MOUSEMANAGER_DEBUG + qDebug("mouse event %d %d %d", pos.x(), pos.y(), int(buttons)); +#endif +} + +void QEvdevMouseManager::addMouse(const QString &deviceNode) +{ +#ifdef QT_QPA_MOUSEMANAGER_DEBUG + qWarning() << "Adding mouse at" << deviceNode; +#endif + + QEvdevMouseHandler *handler; + handler = QEvdevMouseHandler::create(deviceNode, m_spec); + if (handler) { + connect(handler, SIGNAL(handleMouseEvent(int, int, Qt::MouseButtons)), this, SLOT(handleMouseEvent(int, int, Qt::MouseButtons))); + m_mice.insert(deviceNode, handler); + } else { + qWarning("Failed to open mouse"); + } +} + +void QEvdevMouseManager::removeMouse(const QString &deviceNode) +{ + if (m_mice.contains(deviceNode)) { +#ifdef QT_QPA_MOUSEMANAGER_DEBUG + qWarning() << "Removing mouse at" << deviceNode; +#endif + QEvdevMouseHandler *handler = m_mice.value(deviceNode); + m_mice.remove(deviceNode); + delete handler; + } +} + +QT_END_NAMESPACE diff --git a/src/platformsupport/input/evdevmouse/qevdevmousemanager_p.h b/src/platformsupport/input/evdevmouse/qevdevmousemanager_p.h new file mode 100644 index 0000000000..2bc3fa798d --- /dev/null +++ b/src/platformsupport/input/evdevmouse/qevdevmousemanager_p.h @@ -0,0 +1,85 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QEVDEVMOUSEMANAGER_P_H +#define QEVDEVMOUSEMANAGER_P_H + +#include "qevdevmousehandler_p.h" + +#include + +#include +#include +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +class QEvdevMouseManager : public QObject +{ + Q_OBJECT +public: + QEvdevMouseManager(const QString &key, const QString &specification, QObject *parent = 0); + ~QEvdevMouseManager(); + +public slots: + void handleMouseEvent(int x, int y, Qt::MouseButtons buttons); + +private slots: + void addMouse(const QString &deviceNode = QString()); + void removeMouse(const QString &deviceNode); + +private: + QString m_spec; + QHash m_mice; + QDeviceDiscovery *m_deviceDiscovery; + int m_x; + int m_y; + int m_xoffset; + int m_yoffset; +}; + +QT_END_HEADER + +QT_END_NAMESPACE + +#endif // QEVDEVMOUSEMANAGER_P_H diff --git a/src/platformsupport/input/evdevtouch/evdevtouch.pri b/src/platformsupport/input/evdevtouch/evdevtouch.pri new file mode 100644 index 0000000000..64c4b9afd9 --- /dev/null +++ b/src/platformsupport/input/evdevtouch/evdevtouch.pri @@ -0,0 +1,13 @@ +HEADERS += \ + $$PWD/qevdevtouch_p.h + +SOURCES += \ + $$PWD/qevdevtouch.cpp + +contains(QT_CONFIG, libudev) { + LIBS += $$QMAKE_LIBS_LIBUDEV +} + +# DEFINES += USE_MTDEV + +contains(DEFINES, USE_MTDEV): LIBS += -lmtdev diff --git a/src/platformsupport/input/evdevtouch/qevdevtouch.cpp b/src/platformsupport/input/evdevtouch/qevdevtouch.cpp new file mode 100644 index 0000000000..1369e2ae53 --- /dev/null +++ b/src/platformsupport/input/evdevtouch/qevdevtouch.cpp @@ -0,0 +1,517 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the plugins module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qevdevtouch_p.h" +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef USE_MTDEV +extern "C" { +#include +} +#endif + +QT_BEGIN_NAMESPACE + +#ifndef ABS_MT_SLOT +#define ABS_MT_SLOT 0x2f +#endif + +class QTouchScreenData +{ +public: + QTouchScreenData(QTouchScreenHandler *q_ptr, const QStringList &args); + + void processInputEvent(input_event *data); + void assignIds(); + + QTouchScreenHandler *q; + int m_lastEventType; + QList m_touchPoints; + + struct Contact { + int trackingId; + int x; + int y; + int maj; + int pressure; + Qt::TouchPointState state; + QTouchEvent::TouchPoint::InfoFlags flags; + Contact() : trackingId(-1), + x(0), y(0), maj(1), pressure(0), + state(Qt::TouchPointPressed), flags(0) { } + }; + QHash m_contacts; // The key is a tracking id for type A, slot number for type B. + QHash m_lastContacts; + Contact m_currentData; + int m_currentSlot; + + int findClosestContact(const QHash &contacts, int x, int y, int *dist); + void reportPoints(); + void registerDevice(); + + int hw_range_x_min; + int hw_range_x_max; + int hw_range_y_min; + int hw_range_y_max; + int hw_pressure_min; + int hw_pressure_max; + QString hw_name; + bool m_forceToActiveWindow; + QTouchDevice *m_device; + bool m_typeB; +}; + +QTouchScreenData::QTouchScreenData(QTouchScreenHandler *q_ptr, const QStringList &args) + : q(q_ptr), + m_lastEventType(-1), + m_currentSlot(0), + hw_range_x_min(0), hw_range_x_max(0), + hw_range_y_min(0), hw_range_y_max(0), + hw_pressure_min(0), hw_pressure_max(0), + m_device(0), m_typeB(false) +{ + m_forceToActiveWindow = args.contains(QLatin1String("force_window")); +} + +void QTouchScreenData::registerDevice() +{ + m_device = new QTouchDevice; + m_device->setName(hw_name); + m_device->setType(QTouchDevice::TouchScreen); + m_device->setCapabilities(QTouchDevice::Position | QTouchDevice::Area); + if (hw_pressure_max > hw_pressure_min) + m_device->setCapabilities(m_device->capabilities() | QTouchDevice::Pressure); + + QWindowSystemInterface::registerTouchDevice(m_device); +} + +#define LONG_BITS (sizeof(long) << 3) +#define NUM_LONGS(bits) (((bits) + LONG_BITS - 1) / LONG_BITS) + +static inline bool testBit(long bit, const long *array) +{ + return (array[bit / LONG_BITS] >> bit % LONG_BITS) & 1; +} + +QTouchScreenHandler::QTouchScreenHandler(const QString &spec, QObject *parent) + : QObject(parent), m_notify(0), m_fd(-1), d(0) +#ifdef USE_MTDEV + , m_mtdev(0) +#endif +{ + setObjectName(QLatin1String("Evdev Touch Handler")); + + QString dev; + + // only the first device argument is used for now + QStringList args = spec.split(QLatin1Char(':')); + for (int i = 0; i < args.count(); ++i) { + if (args.at(i).startsWith(QLatin1String("/dev/"))) { + dev = args.at(i); + break; + } + } + + if (dev.isEmpty()) { + // try to let udev scan for already connected devices + QScopedPointer deviceDiscovery(QDeviceDiscovery::create(QDeviceDiscovery::Device_Touchpad | QDeviceDiscovery::Device_Touchscreen, this)); + if (deviceDiscovery) { + QStringList devices = deviceDiscovery->scanConnectedDevices(); + + // only the first device found is used for now + if (devices.size() > 0) + dev = devices[0]; + } + } + + if (dev.isEmpty()) + return; + + qDebug("evdevtouch: Using device %s", qPrintable(dev)); + m_fd = QT_OPEN(dev.toLocal8Bit().constData(), O_RDONLY | O_NDELAY, 0); + + if (m_fd >= 0) { + m_notify = new QSocketNotifier(m_fd, QSocketNotifier::Read, this); + connect(m_notify, SIGNAL(activated(int)), this, SLOT(readData())); + } else { + qWarning("Cannot open input device '%s': %s", qPrintable(dev), strerror(errno)); + return; + } + +#ifdef USE_MTDEV + m_mtdev = static_cast(calloc(1, sizeof(mtdev))); + int mtdeverr = mtdev_open(m_mtdev, m_fd); + if (mtdeverr) { + qWarning("mtdev_open failed: %d", mtdeverr); + QT_CLOSE(m_fd); + return; + } +#endif + + d = new QTouchScreenData(this, args); + + input_absinfo absInfo; + memset(&absInfo, 0, sizeof(input_absinfo)); + if (ioctl(m_fd, EVIOCGABS(ABS_MT_POSITION_X), &absInfo) >= 0) { + qDebug("min X: %d max X: %d", absInfo.minimum, absInfo.maximum); + d->hw_range_x_min = absInfo.minimum; + d->hw_range_x_max = absInfo.maximum; + } + if (ioctl(m_fd, EVIOCGABS(ABS_MT_POSITION_Y), &absInfo) >= 0) { + qDebug("min Y: %d max Y: %d", absInfo.minimum, absInfo.maximum); + d->hw_range_y_min = absInfo.minimum; + d->hw_range_y_max = absInfo.maximum; + } + if (ioctl(m_fd, EVIOCGABS(ABS_PRESSURE), &absInfo) >= 0) { + qDebug("min pressure: %d max pressure: %d", absInfo.minimum, absInfo.maximum); + if (absInfo.maximum > absInfo.minimum) { + d->hw_pressure_min = absInfo.minimum; + d->hw_pressure_max = absInfo.maximum; + } + } + char name[1024]; + if (ioctl(m_fd, EVIOCGNAME(sizeof(name) - 1), name) >= 0) { + d->hw_name = QString::fromLocal8Bit(name); + qDebug("device name: %s", name); + } + +#ifdef USE_MTDEV + const char *mtdevStr = "(mtdev)"; + d->m_typeB = true; +#else + const char *mtdevStr = ""; + d->m_typeB = false; + long absbits[NUM_LONGS(ABS_CNT)]; + if (ioctl(m_fd, EVIOCGBIT(EV_ABS, sizeof(absbits)), absbits) >= 0) + d->m_typeB = testBit(ABS_MT_SLOT, absbits); +#endif + qDebug("Protocol type %c %s", d->m_typeB ? 'B' : 'A', mtdevStr); + + d->registerDevice(); +} + +QTouchScreenHandler::~QTouchScreenHandler() +{ +#ifdef USE_MTDEV + if (m_mtdev) { + mtdev_close(m_mtdev); + free(m_mtdev); + } +#endif + + if (m_fd >= 0) + QT_CLOSE(m_fd); + + delete d; +} + +void QTouchScreenHandler::readData() +{ + ::input_event buffer[32]; + int n = 0; + for (; ;) { +#ifdef USE_MTDEV + int result = mtdev_get(m_mtdev, m_fd, buffer, sizeof(buffer) / sizeof(::input_event)); + if (result > 0) + result *= sizeof(::input_event); +#else + int result = QT_READ(m_fd, reinterpret_cast(buffer) + n, sizeof(buffer) - n); +#endif + if (!result) { + qWarning("Got EOF from input device"); + return; + } else if (result < 0) { + if (errno != EINTR && errno != EAGAIN) { + qWarning("Could not read from input device: %s", strerror(errno)); + if (errno == ENODEV) { // device got disconnected -> stop reading + delete m_notify; + m_notify = 0; + QT_CLOSE(m_fd); + m_fd = -1; + } + return; + } + } else { + n += result; + if (n % sizeof(::input_event) == 0) + break; + } + } + + n /= sizeof(::input_event); + + for (int i = 0; i < n; ++i) + d->processInputEvent(&buffer[i]); +} + +void QTouchScreenData::processInputEvent(input_event *data) +{ + if (data->type == EV_ABS) { + + if (data->code == ABS_MT_POSITION_X) { + m_currentData.x = qBound(hw_range_x_min, data->value, hw_range_x_max); + if (m_typeB) + m_contacts[m_currentSlot].x = m_currentData.x; + } else if (data->code == ABS_MT_POSITION_Y) { + m_currentData.y = qBound(hw_range_y_min, data->value, hw_range_y_max); + if (m_typeB) + m_contacts[m_currentSlot].y = m_currentData.y; + } else if (data->code == ABS_MT_TRACKING_ID) { + m_currentData.trackingId = data->value; + if (m_typeB) { + if (m_currentData.trackingId == -1) + m_contacts[m_currentSlot].state = Qt::TouchPointReleased; + else + m_contacts[m_currentSlot].trackingId = m_currentData.trackingId; + } + } else if (data->code == ABS_MT_TOUCH_MAJOR) { + m_currentData.maj = data->value; + if (data->value == 0) + m_currentData.state = Qt::TouchPointReleased; + if (m_typeB) + m_contacts[m_currentSlot].maj = m_currentData.maj; + } else if (data->code == ABS_PRESSURE) { + m_currentData.pressure = qBound(hw_pressure_min, data->value, hw_pressure_max); + if (m_typeB) + m_contacts[m_currentSlot].pressure = m_currentData.pressure; + } else if (data->code == ABS_MT_SLOT) { + m_currentSlot = data->value; + } + + } else if (data->type == EV_SYN && data->code == SYN_MT_REPORT && m_lastEventType != EV_SYN) { + + // If there is no tracking id, one will be generated later. + // Until that use a temporary key. + int key = m_currentData.trackingId; + if (key == -1) + key = m_contacts.count(); + + m_contacts.insert(key, m_currentData); + m_currentData = Contact(); + + } else if (data->type == EV_SYN && data->code == SYN_REPORT) { + + // Ensure valid IDs even when the driver does not report ABS_MT_TRACKING_ID. + if (!m_contacts.isEmpty() && m_contacts.constBegin().value().trackingId == -1) + assignIds(); + + m_touchPoints.clear(); + Qt::TouchPointStates combinedStates; + QMutableHashIterator it(m_contacts); + while (it.hasNext()) { + it.next(); + QWindowSystemInterface::TouchPoint tp; + Contact &contact(it.value()); + tp.id = contact.trackingId; + tp.flags = contact.flags; + + int key = m_typeB ? it.key() : contact.trackingId; + if (m_lastContacts.contains(key)) { + const Contact &prev(m_lastContacts.value(key)); + if (contact.state == Qt::TouchPointReleased) { + // Copy over the previous values for released points, just in case. + contact.x = prev.x; + contact.y = prev.y; + contact.maj = prev.maj; + } else { + contact.state = (prev.x == contact.x && prev.y == contact.y) + ? Qt::TouchPointStationary : Qt::TouchPointMoved; + } + } + + // Avoid reporting a contact in released state more than once. + if (contact.state == Qt::TouchPointReleased + && !m_lastContacts.contains(key)) { + it.remove(); + continue; + } + + tp.state = contact.state; + combinedStates |= tp.state; + + // Store the HW coordinates for now, will be updated later. + tp.area = QRectF(0, 0, contact.maj, contact.maj); + tp.area.moveCenter(QPoint(contact.x, contact.y)); + tp.pressure = contact.pressure; + + // Get a normalized position in range 0..1. + tp.normalPosition = QPointF((contact.x - hw_range_x_min) / qreal(hw_range_x_max - hw_range_x_min), + (contact.y - hw_range_y_min) / qreal(hw_range_y_max - hw_range_y_min)); + + m_touchPoints.append(tp); + + if (contact.state == Qt::TouchPointReleased) + it.remove(); + } + + m_lastContacts = m_contacts; + if (!m_typeB) + m_contacts.clear(); + + if (!m_touchPoints.isEmpty() && combinedStates != Qt::TouchPointStationary) + reportPoints(); + } + + m_lastEventType = data->type; +} + +int QTouchScreenData::findClosestContact(const QHash &contacts, int x, int y, int *dist) +{ + int minDist = -1, id = -1; + for (QHash::const_iterator it = contacts.constBegin(), ite = contacts.constEnd(); + it != ite; ++it) { + const Contact &contact(it.value()); + int dx = x - contact.x; + int dy = y - contact.y; + int dist = dx * dx + dy * dy; + if (minDist == -1 || dist < minDist) { + minDist = dist; + id = contact.trackingId; + } + } + if (dist) + *dist = minDist; + return id; +} + +void QTouchScreenData::assignIds() +{ + QHash candidates = m_lastContacts, pending = m_contacts, newContacts; + int maxId = -1; + QHash::iterator it, ite, bestMatch; + while (!pending.isEmpty() && !candidates.isEmpty()) { + int bestDist = -1, bestId; + for (it = pending.begin(), ite = pending.end(); it != ite; ++it) { + int dist; + int id = findClosestContact(candidates, it->x, it->y, &dist); + if (id >= 0 && (bestDist == -1 || dist < bestDist)) { + bestDist = dist; + bestId = id; + bestMatch = it; + } + } + if (bestDist >= 0) { + bestMatch->trackingId = bestId; + newContacts.insert(bestId, *bestMatch); + candidates.remove(bestId); + pending.erase(bestMatch); + if (bestId > maxId) + maxId = bestId; + } + } + if (candidates.isEmpty()) { + for (it = pending.begin(), ite = pending.end(); it != ite; ++it) { + it->trackingId = ++maxId; + newContacts.insert(it->trackingId, *it); + } + } + m_contacts = newContacts; +} + +void QTouchScreenData::reportPoints() +{ + QRect winRect; + if (m_forceToActiveWindow) { + QWindow *win = QGuiApplication::focusWindow(); + if (!win) + return; + winRect = win->geometry(); + } else { + winRect = QGuiApplication::primaryScreen()->geometry(); + } + + const int hw_w = hw_range_x_max - hw_range_x_min; + const int hw_h = hw_range_y_max - hw_range_y_min; + + // Map the coordinates based on the normalized position. QPA expects 'area' + // to be in screen coordinates. + const int pointCount = m_touchPoints.count(); + for (int i = 0; i < pointCount; ++i) { + QWindowSystemInterface::TouchPoint &tp(m_touchPoints[i]); + + // Generate a screen position that is always inside the active window + // or the primary screen. + const qreal wx = winRect.left() + tp.normalPosition.x() * winRect.width(); + const qreal wy = winRect.top() + tp.normalPosition.y() * winRect.height(); + const qreal sizeRatio = (winRect.width() + winRect.height()) / qreal(hw_w + hw_h); + tp.area = QRectF(0, 0, tp.area.width() * sizeRatio, tp.area.height() * sizeRatio); + tp.area.moveCenter(QPointF(wx, wy)); + + // Calculate normalized pressure. + if (!hw_pressure_min && !hw_pressure_max) + tp.pressure = tp.state == Qt::TouchPointReleased ? 0 : 1; + else + tp.pressure = (tp.pressure - hw_pressure_min) / qreal(hw_pressure_max - hw_pressure_min); + } + + QWindowSystemInterface::handleTouchEvent(0, m_device, m_touchPoints); +} + + +QTouchScreenHandlerThread::QTouchScreenHandlerThread(const QString &spec) + : m_spec(spec), m_handler(0) +{ + start(); +} + +QTouchScreenHandlerThread::~QTouchScreenHandlerThread() +{ + quit(); + wait(); +} + +void QTouchScreenHandlerThread::run() +{ + m_handler = new QTouchScreenHandler(m_spec); + exec(); + delete m_handler; + m_handler = 0; +} + + +QT_END_NAMESPACE diff --git a/src/platformsupport/input/evdevtouch/qevdevtouch_p.h b/src/platformsupport/input/evdevtouch/qevdevtouch_p.h new file mode 100644 index 0000000000..63b02f2086 --- /dev/null +++ b/src/platformsupport/input/evdevtouch/qevdevtouch_p.h @@ -0,0 +1,98 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the plugins module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QEVDEVTOUCH_P_H +#define QEVDEVTOUCH_P_H + +#include +#include +#include +#include +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +class QSocketNotifier; +class QTouchScreenData; +#ifdef USE_MTDEV +struct mtdev; +#endif + +class QTouchScreenHandler : public QObject +{ + Q_OBJECT + +public: + QTouchScreenHandler(const QString &spec = QString(), QObject *parent = 0); + ~QTouchScreenHandler(); + +private slots: + void readData(); + +private: + QSocketNotifier *m_notify; + int m_fd; + QTouchScreenData *d; +#ifdef USE_MTDEV + mtdev *m_mtdev; +#endif +}; + +class QTouchScreenHandlerThread : public QThread +{ +public: + QTouchScreenHandlerThread(const QString &spec); + ~QTouchScreenHandlerThread(); + void run(); + QTouchScreenHandler *handler() { return m_handler; } + +private: + QString m_spec; + QTouchScreenHandler *m_handler; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QEVDEVTOUCH_P_H diff --git a/src/platformsupport/input/input.pri b/src/platformsupport/input/input.pri new file mode 100644 index 0000000000..f377aeaf4c --- /dev/null +++ b/src/platformsupport/input/input.pri @@ -0,0 +1,6 @@ +contains(QT_CONFIG, evdev) { + include($$PWD/evdevmouse/evdevmouse.pri) + include($$PWD/evdevkeyboard/evdevkeyboard.pri) + include($$PWD/evdevtouch/evdevtouch.pri) +} + diff --git a/src/platformsupport/platformsupport.pro b/src/platformsupport/platformsupport.pro index e55bbe0627..fba1096ab2 100644 --- a/src/platformsupport/platformsupport.pro +++ b/src/platformsupport/platformsupport.pro @@ -31,6 +31,7 @@ include(eventdispatchers/eventdispatchers.pri) include(fb_base/fb_base.pri) include(fontdatabases/fontdatabases.pri) include(glxconvenience/glxconvenience.pri) +include(input/input.pri) include(inputcontext/inputcontext.pri) include(devicediscovery/devicediscovery.pri) include(services/services.pri) diff --git a/src/plugins/generic/evdevkeyboard/evdevkeyboard.pro b/src/plugins/generic/evdevkeyboard/evdevkeyboard.pro index b632e5b7ec..2d808a029e 100644 --- a/src/plugins/generic/evdevkeyboard/evdevkeyboard.pro +++ b/src/plugins/generic/evdevkeyboard/evdevkeyboard.pro @@ -5,20 +5,10 @@ DESTDIR = $$QT.gui.plugins/generic target.path = $$[QT_INSTALL_PLUGINS]/generic INSTALLS += target -HEADERS = \ - qevdevkeyboard_defaultmap.h \ - qevdevkeyboardhandler.h \ - qevdevkeyboardmanager.h - QT += core-private platformsupport-private -SOURCES = main.cpp \ - qevdevkeyboardhandler.cpp \ - qevdevkeyboardmanager.cpp +SOURCES = main.cpp OTHER_FILES += \ evdevkeyboard.json -contains(QT_CONFIG, libudev) { - LIBS += $$QMAKE_LIBS_LIBUDEV -} diff --git a/src/plugins/generic/evdevkeyboard/main.cpp b/src/plugins/generic/evdevkeyboard/main.cpp index 5d769d0ecf..b23fac810d 100644 --- a/src/plugins/generic/evdevkeyboard/main.cpp +++ b/src/plugins/generic/evdevkeyboard/main.cpp @@ -40,7 +40,7 @@ ****************************************************************************/ #include -#include "qevdevkeyboardmanager.h" +#include QT_BEGIN_NAMESPACE diff --git a/src/plugins/generic/evdevkeyboard/qevdevkeyboard_defaultmap.h b/src/plugins/generic/evdevkeyboard/qevdevkeyboard_defaultmap.h deleted file mode 100644 index 49b07efff9..0000000000 --- a/src/plugins/generic/evdevkeyboard/qevdevkeyboard_defaultmap.h +++ /dev/null @@ -1,787 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QEVDEVKEYBOARDHANDLER_DEFAULTMAP_H -#define QEVDEVKEYBOARDHANDLER_DEFAULTMAP_H - -// no QT_BEGIN_NAMESPACE, since we include it internally... - -const QEvdevKeyboardMap::Mapping QEvdevKeyboardHandler::s_keymap_default[] = { - { 1, 0xffff, 0x01000000, 0x00, 0x00, 0x0000 }, - { 2, 0x0031, 0x00000031, 0x00, 0x00, 0x0000 }, - { 2, 0x0021, 0x00000021, 0x01, 0x00, 0x0000 }, - { 3, 0x0032, 0x00000032, 0x00, 0x00, 0x0000 }, - { 3, 0x0040, 0x00000040, 0x01, 0x00, 0x0000 }, - { 3, 0x0040, 0x00000040, 0x02, 0x00, 0x0000 }, - { 4, 0x0033, 0x00000033, 0x00, 0x00, 0x0000 }, - { 4, 0x0023, 0x00000023, 0x01, 0x00, 0x0000 }, - { 4, 0xffff, 0x01000000, 0x04, 0x00, 0x0000 }, - { 5, 0x0034, 0x00000034, 0x00, 0x00, 0x0000 }, - { 5, 0x0024, 0x00000024, 0x01, 0x00, 0x0000 }, - { 5, 0x0024, 0x00000024, 0x02, 0x00, 0x0000 }, - { 5, 0x005c, 0x0400005c, 0x04, 0x00, 0x0000 }, - { 6, 0x0035, 0x00000035, 0x00, 0x00, 0x0000 }, - { 6, 0x0025, 0x00000025, 0x01, 0x00, 0x0000 }, - { 6, 0x005d, 0x0400005d, 0x04, 0x00, 0x0000 }, - { 7, 0x0036, 0x00000036, 0x00, 0x00, 0x0000 }, - { 7, 0x005e, 0x0000005e, 0x01, 0x00, 0x0000 }, - { 7, 0x005e, 0x01001252, 0x02, 0x01, 0x0000 }, - { 7, 0x005e, 0x0400005e, 0x04, 0x00, 0x0000 }, - { 8, 0x0037, 0x00000037, 0x00, 0x00, 0x0000 }, - { 8, 0x0026, 0x00000026, 0x01, 0x00, 0x0000 }, - { 8, 0x007b, 0x0000007b, 0x02, 0x00, 0x0000 }, - { 8, 0x005f, 0x0400005f, 0x04, 0x00, 0x0000 }, - { 9, 0x0038, 0x00000038, 0x00, 0x00, 0x0000 }, - { 9, 0x002a, 0x0000002a, 0x01, 0x00, 0x0000 }, - { 9, 0x005b, 0x0000005b, 0x02, 0x00, 0x0000 }, - { 9, 0xffff, 0x01000003, 0x04, 0x00, 0x0000 }, - { 10, 0x0039, 0x00000039, 0x00, 0x00, 0x0000 }, - { 10, 0x0028, 0x00000028, 0x01, 0x00, 0x0000 }, - { 10, 0x005d, 0x0000005d, 0x02, 0x00, 0x0000 }, - { 11, 0x0030, 0x00000030, 0x00, 0x00, 0x0000 }, - { 11, 0x0029, 0x00000029, 0x01, 0x00, 0x0000 }, - { 11, 0x007d, 0x0000007d, 0x02, 0x00, 0x0000 }, - { 12, 0x002d, 0x0000002d, 0x00, 0x00, 0x0000 }, - { 12, 0x005f, 0x0000005f, 0x01, 0x00, 0x0000 }, - { 12, 0x005c, 0x0000005c, 0x02, 0x00, 0x0000 }, - { 12, 0x005f, 0x0400005f, 0x04, 0x00, 0x0000 }, - { 12, 0x005f, 0x0400005f, 0x05, 0x00, 0x0000 }, - { 13, 0x003d, 0x0000003d, 0x00, 0x00, 0x0000 }, - { 13, 0x002b, 0x0000002b, 0x01, 0x00, 0x0000 }, - { 14, 0xffff, 0x01000003, 0x00, 0x00, 0x0000 }, - { 14, 0xffff, 0x01000000, 0x0c, 0x08, 0x0300 }, - { 15, 0xffff, 0x01000001, 0x00, 0x00, 0x0000 }, - { 16, 0x0071, 0x00000051, 0x00, 0x00, 0x0000 }, - { 16, 0x0051, 0x00000051, 0x01, 0x00, 0x0000 }, - { 16, 0x0071, 0x00000051, 0x02, 0x00, 0x0000 }, - { 16, 0x0051, 0x00000051, 0x03, 0x00, 0x0000 }, - { 16, 0x0071, 0x04000051, 0x04, 0x00, 0x0000 }, - { 16, 0x0071, 0x04000051, 0x05, 0x00, 0x0000 }, - { 16, 0x0071, 0x04000051, 0x06, 0x00, 0x0000 }, - { 16, 0x0071, 0x04000051, 0x07, 0x00, 0x0000 }, - { 16, 0x0071, 0x08000051, 0x08, 0x00, 0x0000 }, - { 16, 0x0071, 0x08000051, 0x09, 0x00, 0x0000 }, - { 16, 0x0071, 0x08000051, 0x0a, 0x00, 0x0000 }, - { 16, 0x0071, 0x08000051, 0x0b, 0x00, 0x0000 }, - { 16, 0x0071, 0x0c000051, 0x0c, 0x00, 0x0000 }, - { 16, 0x0071, 0x0c000051, 0x0d, 0x00, 0x0000 }, - { 16, 0x0071, 0x0c000051, 0x0e, 0x00, 0x0000 }, - { 16, 0x0071, 0x0c000051, 0x0f, 0x00, 0x0000 }, - { 17, 0x0077, 0x00000057, 0x00, 0x00, 0x0000 }, - { 17, 0x0057, 0x00000057, 0x01, 0x00, 0x0000 }, - { 17, 0x0077, 0x00000057, 0x02, 0x00, 0x0000 }, - { 17, 0x0057, 0x00000057, 0x03, 0x00, 0x0000 }, - { 17, 0x0077, 0x04000057, 0x04, 0x00, 0x0000 }, - { 17, 0x0077, 0x04000057, 0x05, 0x00, 0x0000 }, - { 17, 0x0077, 0x04000057, 0x06, 0x00, 0x0000 }, - { 17, 0x0077, 0x04000057, 0x07, 0x00, 0x0000 }, - { 17, 0x0077, 0x08000057, 0x08, 0x00, 0x0000 }, - { 17, 0x0077, 0x08000057, 0x09, 0x00, 0x0000 }, - { 17, 0x0077, 0x08000057, 0x0a, 0x00, 0x0000 }, - { 17, 0x0077, 0x08000057, 0x0b, 0x00, 0x0000 }, - { 17, 0x0077, 0x0c000057, 0x0c, 0x00, 0x0000 }, - { 17, 0x0077, 0x0c000057, 0x0d, 0x00, 0x0000 }, - { 17, 0x0077, 0x0c000057, 0x0e, 0x00, 0x0000 }, - { 17, 0x0077, 0x0c000057, 0x0f, 0x00, 0x0000 }, - { 18, 0x0065, 0x00000045, 0x00, 0x00, 0x0000 }, - { 18, 0x0045, 0x00000045, 0x01, 0x00, 0x0000 }, - { 18, 0x0065, 0x00000045, 0x02, 0x00, 0x0000 }, - { 18, 0x0045, 0x00000045, 0x03, 0x00, 0x0000 }, - { 18, 0x0065, 0x04000045, 0x04, 0x00, 0x0000 }, - { 18, 0x0065, 0x04000045, 0x05, 0x00, 0x0000 }, - { 18, 0x0065, 0x04000045, 0x06, 0x00, 0x0000 }, - { 18, 0x0065, 0x04000045, 0x07, 0x00, 0x0000 }, - { 18, 0x0065, 0x08000045, 0x08, 0x00, 0x0000 }, - { 18, 0x0065, 0x08000045, 0x09, 0x00, 0x0000 }, - { 18, 0x0065, 0x08000045, 0x0a, 0x00, 0x0000 }, - { 18, 0x0065, 0x08000045, 0x0b, 0x00, 0x0000 }, - { 18, 0x0065, 0x0c000045, 0x0c, 0x00, 0x0000 }, - { 18, 0x0065, 0x0c000045, 0x0d, 0x00, 0x0000 }, - { 18, 0x0065, 0x0c000045, 0x0e, 0x00, 0x0000 }, - { 18, 0x0065, 0x0c000045, 0x0f, 0x00, 0x0000 }, - { 19, 0x0072, 0x00000052, 0x00, 0x00, 0x0000 }, - { 19, 0x0052, 0x00000052, 0x01, 0x00, 0x0000 }, - { 19, 0x0072, 0x00000052, 0x02, 0x00, 0x0000 }, - { 19, 0x0052, 0x00000052, 0x03, 0x00, 0x0000 }, - { 19, 0x0072, 0x04000052, 0x04, 0x00, 0x0000 }, - { 19, 0x0072, 0x04000052, 0x05, 0x00, 0x0000 }, - { 19, 0x0072, 0x04000052, 0x06, 0x00, 0x0000 }, - { 19, 0x0072, 0x04000052, 0x07, 0x00, 0x0000 }, - { 19, 0x0072, 0x08000052, 0x08, 0x00, 0x0000 }, - { 19, 0x0072, 0x08000052, 0x09, 0x00, 0x0000 }, - { 19, 0x0072, 0x08000052, 0x0a, 0x00, 0x0000 }, - { 19, 0x0072, 0x08000052, 0x0b, 0x00, 0x0000 }, - { 19, 0x0072, 0x0c000052, 0x0c, 0x00, 0x0000 }, - { 19, 0x0072, 0x0c000052, 0x0d, 0x00, 0x0000 }, - { 19, 0x0072, 0x0c000052, 0x0e, 0x00, 0x0000 }, - { 19, 0x0072, 0x0c000052, 0x0f, 0x00, 0x0000 }, - { 20, 0x0074, 0x00000054, 0x00, 0x00, 0x0000 }, - { 20, 0x0054, 0x00000054, 0x01, 0x00, 0x0000 }, - { 20, 0x0074, 0x00000054, 0x02, 0x00, 0x0000 }, - { 20, 0x0054, 0x00000054, 0x03, 0x00, 0x0000 }, - { 20, 0x0074, 0x04000054, 0x04, 0x00, 0x0000 }, - { 20, 0x0074, 0x04000054, 0x05, 0x00, 0x0000 }, - { 20, 0x0074, 0x04000054, 0x06, 0x00, 0x0000 }, - { 20, 0x0074, 0x04000054, 0x07, 0x00, 0x0000 }, - { 20, 0x0074, 0x08000054, 0x08, 0x00, 0x0000 }, - { 20, 0x0074, 0x08000054, 0x09, 0x00, 0x0000 }, - { 20, 0x0074, 0x08000054, 0x0a, 0x00, 0x0000 }, - { 20, 0x0074, 0x08000054, 0x0b, 0x00, 0x0000 }, - { 20, 0x0074, 0x0c000054, 0x0c, 0x00, 0x0000 }, - { 20, 0x0074, 0x0c000054, 0x0d, 0x00, 0x0000 }, - { 20, 0x0074, 0x0c000054, 0x0e, 0x00, 0x0000 }, - { 20, 0x0074, 0x0c000054, 0x0f, 0x00, 0x0000 }, - { 21, 0x0079, 0x00000059, 0x00, 0x00, 0x0000 }, - { 21, 0x0059, 0x00000059, 0x01, 0x00, 0x0000 }, - { 21, 0x0079, 0x00000059, 0x02, 0x00, 0x0000 }, - { 21, 0x0059, 0x00000059, 0x03, 0x00, 0x0000 }, - { 21, 0x0079, 0x04000059, 0x04, 0x00, 0x0000 }, - { 21, 0x0079, 0x04000059, 0x05, 0x00, 0x0000 }, - { 21, 0x0079, 0x04000059, 0x06, 0x00, 0x0000 }, - { 21, 0x0079, 0x04000059, 0x07, 0x00, 0x0000 }, - { 21, 0x0079, 0x08000059, 0x08, 0x00, 0x0000 }, - { 21, 0x0079, 0x08000059, 0x09, 0x00, 0x0000 }, - { 21, 0x0079, 0x08000059, 0x0a, 0x00, 0x0000 }, - { 21, 0x0079, 0x08000059, 0x0b, 0x00, 0x0000 }, - { 21, 0x0079, 0x0c000059, 0x0c, 0x00, 0x0000 }, - { 21, 0x0079, 0x0c000059, 0x0d, 0x00, 0x0000 }, - { 21, 0x0079, 0x0c000059, 0x0e, 0x00, 0x0000 }, - { 21, 0x0079, 0x0c000059, 0x0f, 0x00, 0x0000 }, - { 22, 0x0075, 0x00000055, 0x00, 0x00, 0x0000 }, - { 22, 0x0055, 0x00000055, 0x01, 0x00, 0x0000 }, - { 22, 0x0075, 0x00000055, 0x02, 0x00, 0x0000 }, - { 22, 0x0055, 0x00000055, 0x03, 0x00, 0x0000 }, - { 22, 0x0075, 0x04000055, 0x04, 0x00, 0x0000 }, - { 22, 0x0075, 0x04000055, 0x05, 0x00, 0x0000 }, - { 22, 0x0075, 0x04000055, 0x06, 0x00, 0x0000 }, - { 22, 0x0075, 0x04000055, 0x07, 0x00, 0x0000 }, - { 22, 0x0075, 0x08000055, 0x08, 0x00, 0x0000 }, - { 22, 0x0075, 0x08000055, 0x09, 0x00, 0x0000 }, - { 22, 0x0075, 0x08000055, 0x0a, 0x00, 0x0000 }, - { 22, 0x0075, 0x08000055, 0x0b, 0x00, 0x0000 }, - { 22, 0x0075, 0x0c000055, 0x0c, 0x00, 0x0000 }, - { 22, 0x0075, 0x0c000055, 0x0d, 0x00, 0x0000 }, - { 22, 0x0075, 0x0c000055, 0x0e, 0x00, 0x0000 }, - { 22, 0x0075, 0x0c000055, 0x0f, 0x00, 0x0000 }, - { 23, 0x0069, 0x00000049, 0x00, 0x00, 0x0000 }, - { 23, 0x0049, 0x00000049, 0x01, 0x00, 0x0000 }, - { 23, 0x0069, 0x00000049, 0x02, 0x00, 0x0000 }, - { 23, 0x0049, 0x00000049, 0x03, 0x00, 0x0000 }, - { 23, 0x0069, 0x04000049, 0x04, 0x00, 0x0000 }, - { 23, 0x0069, 0x04000049, 0x05, 0x00, 0x0000 }, - { 23, 0x0069, 0x04000049, 0x06, 0x00, 0x0000 }, - { 23, 0x0069, 0x04000049, 0x07, 0x00, 0x0000 }, - { 23, 0x0069, 0x08000049, 0x08, 0x00, 0x0000 }, - { 23, 0x0069, 0x08000049, 0x09, 0x00, 0x0000 }, - { 23, 0x0069, 0x08000049, 0x0a, 0x00, 0x0000 }, - { 23, 0x0069, 0x08000049, 0x0b, 0x00, 0x0000 }, - { 23, 0x0069, 0x0c000049, 0x0c, 0x00, 0x0000 }, - { 23, 0x0069, 0x0c000049, 0x0d, 0x00, 0x0000 }, - { 23, 0x0069, 0x0c000049, 0x0e, 0x00, 0x0000 }, - { 23, 0x0069, 0x0c000049, 0x0f, 0x00, 0x0000 }, - { 24, 0x006f, 0x0000004f, 0x00, 0x00, 0x0000 }, - { 24, 0x004f, 0x0000004f, 0x01, 0x00, 0x0000 }, - { 24, 0x006f, 0x0000004f, 0x02, 0x00, 0x0000 }, - { 24, 0x004f, 0x0000004f, 0x03, 0x00, 0x0000 }, - { 24, 0x006f, 0x0400004f, 0x04, 0x00, 0x0000 }, - { 24, 0x006f, 0x0400004f, 0x05, 0x00, 0x0000 }, - { 24, 0x006f, 0x0400004f, 0x06, 0x00, 0x0000 }, - { 24, 0x006f, 0x0400004f, 0x07, 0x00, 0x0000 }, - { 24, 0x006f, 0x0800004f, 0x08, 0x00, 0x0000 }, - { 24, 0x006f, 0x0800004f, 0x09, 0x00, 0x0000 }, - { 24, 0x006f, 0x0800004f, 0x0a, 0x00, 0x0000 }, - { 24, 0x006f, 0x0800004f, 0x0b, 0x00, 0x0000 }, - { 24, 0x006f, 0x0c00004f, 0x0c, 0x00, 0x0000 }, - { 24, 0x006f, 0x0c00004f, 0x0d, 0x00, 0x0000 }, - { 24, 0x006f, 0x0c00004f, 0x0e, 0x00, 0x0000 }, - { 24, 0x006f, 0x0c00004f, 0x0f, 0x00, 0x0000 }, - { 25, 0x0070, 0x00000050, 0x00, 0x00, 0x0000 }, - { 25, 0x0050, 0x00000050, 0x01, 0x00, 0x0000 }, - { 25, 0x0070, 0x00000050, 0x02, 0x00, 0x0000 }, - { 25, 0x0050, 0x00000050, 0x03, 0x00, 0x0000 }, - { 25, 0x0070, 0x04000050, 0x04, 0x00, 0x0000 }, - { 25, 0x0070, 0x04000050, 0x05, 0x00, 0x0000 }, - { 25, 0x0070, 0x04000050, 0x06, 0x00, 0x0000 }, - { 25, 0x0070, 0x04000050, 0x07, 0x00, 0x0000 }, - { 25, 0x0070, 0x08000050, 0x08, 0x00, 0x0000 }, - { 25, 0x0070, 0x08000050, 0x09, 0x00, 0x0000 }, - { 25, 0x0070, 0x08000050, 0x0a, 0x00, 0x0000 }, - { 25, 0x0070, 0x08000050, 0x0b, 0x00, 0x0000 }, - { 25, 0x0070, 0x0c000050, 0x0c, 0x00, 0x0000 }, - { 25, 0x0070, 0x0c000050, 0x0d, 0x00, 0x0000 }, - { 25, 0x0070, 0x0c000050, 0x0e, 0x00, 0x0000 }, - { 25, 0x0070, 0x0c000050, 0x0f, 0x00, 0x0000 }, - { 26, 0x005b, 0x0000005b, 0x00, 0x00, 0x0000 }, - { 26, 0x007b, 0x0000007b, 0x01, 0x00, 0x0000 }, - { 26, 0xffff, 0x01000000, 0x04, 0x00, 0x0000 }, - { 27, 0x005d, 0x0000005d, 0x00, 0x00, 0x0000 }, - { 27, 0x007d, 0x0000007d, 0x01, 0x00, 0x0000 }, - { 27, 0x007e, 0x0000007e, 0x02, 0x00, 0x0000 }, - { 27, 0x005d, 0x0400005d, 0x04, 0x00, 0x0000 }, - { 28, 0xffff, 0x01000004, 0x00, 0x00, 0x0000 }, - { 28, 0x006d, 0x0c00004d, 0x08, 0x00, 0x0000 }, - { 29, 0xffff, 0x01000021, 0x00, 0x04, 0x0004 }, - { 30, 0x0061, 0x00000041, 0x00, 0x00, 0x0000 }, - { 30, 0x0041, 0x00000041, 0x01, 0x00, 0x0000 }, - { 30, 0x0061, 0x00000041, 0x02, 0x00, 0x0000 }, - { 30, 0x0041, 0x00000041, 0x03, 0x00, 0x0000 }, - { 30, 0x0061, 0x04000041, 0x04, 0x00, 0x0000 }, - { 30, 0x0061, 0x04000041, 0x05, 0x00, 0x0000 }, - { 30, 0x0061, 0x04000041, 0x06, 0x00, 0x0000 }, - { 30, 0x0061, 0x04000041, 0x07, 0x00, 0x0000 }, - { 30, 0x0061, 0x08000041, 0x08, 0x00, 0x0000 }, - { 30, 0x0061, 0x08000041, 0x09, 0x00, 0x0000 }, - { 30, 0x0061, 0x08000041, 0x0a, 0x00, 0x0000 }, - { 30, 0x0061, 0x08000041, 0x0b, 0x00, 0x0000 }, - { 30, 0x0061, 0x0c000041, 0x0c, 0x00, 0x0000 }, - { 30, 0x0061, 0x0c000041, 0x0d, 0x00, 0x0000 }, - { 30, 0x0061, 0x0c000041, 0x0e, 0x00, 0x0000 }, - { 30, 0x0061, 0x0c000041, 0x0f, 0x00, 0x0000 }, - { 31, 0x0073, 0x00000053, 0x00, 0x00, 0x0000 }, - { 31, 0x0053, 0x00000053, 0x01, 0x00, 0x0000 }, - { 31, 0x0073, 0x00000053, 0x02, 0x00, 0x0000 }, - { 31, 0x0053, 0x00000053, 0x03, 0x00, 0x0000 }, - { 31, 0x0073, 0x04000053, 0x04, 0x00, 0x0000 }, - { 31, 0x0073, 0x04000053, 0x05, 0x00, 0x0000 }, - { 31, 0x0073, 0x04000053, 0x06, 0x00, 0x0000 }, - { 31, 0x0073, 0x04000053, 0x07, 0x00, 0x0000 }, - { 31, 0x0073, 0x08000053, 0x08, 0x00, 0x0000 }, - { 31, 0x0073, 0x08000053, 0x09, 0x00, 0x0000 }, - { 31, 0x0073, 0x08000053, 0x0a, 0x00, 0x0000 }, - { 31, 0x0073, 0x08000053, 0x0b, 0x00, 0x0000 }, - { 31, 0x0073, 0x0c000053, 0x0c, 0x00, 0x0000 }, - { 31, 0x0073, 0x0c000053, 0x0d, 0x00, 0x0000 }, - { 31, 0x0073, 0x0c000053, 0x0e, 0x00, 0x0000 }, - { 31, 0x0073, 0x0c000053, 0x0f, 0x00, 0x0000 }, - { 32, 0x0064, 0x00000044, 0x00, 0x00, 0x0000 }, - { 32, 0x0044, 0x00000044, 0x01, 0x00, 0x0000 }, - { 32, 0x0064, 0x00000044, 0x02, 0x00, 0x0000 }, - { 32, 0x0044, 0x00000044, 0x03, 0x00, 0x0000 }, - { 32, 0x0064, 0x04000044, 0x04, 0x00, 0x0000 }, - { 32, 0x0064, 0x04000044, 0x05, 0x00, 0x0000 }, - { 32, 0x0064, 0x04000044, 0x06, 0x00, 0x0000 }, - { 32, 0x0064, 0x04000044, 0x07, 0x00, 0x0000 }, - { 32, 0x0064, 0x08000044, 0x08, 0x00, 0x0000 }, - { 32, 0x0064, 0x08000044, 0x09, 0x00, 0x0000 }, - { 32, 0x0064, 0x08000044, 0x0a, 0x00, 0x0000 }, - { 32, 0x0064, 0x08000044, 0x0b, 0x00, 0x0000 }, - { 32, 0x0064, 0x0c000044, 0x0c, 0x00, 0x0000 }, - { 32, 0x0064, 0x0c000044, 0x0d, 0x00, 0x0000 }, - { 32, 0x0064, 0x0c000044, 0x0e, 0x00, 0x0000 }, - { 32, 0x0064, 0x0c000044, 0x0f, 0x00, 0x0000 }, - { 33, 0x0066, 0x00000046, 0x00, 0x00, 0x0000 }, - { 33, 0x0046, 0x00000046, 0x01, 0x00, 0x0000 }, - { 33, 0x0066, 0x00000046, 0x02, 0x00, 0x0000 }, - { 33, 0x0046, 0x00000046, 0x03, 0x00, 0x0000 }, - { 33, 0x0066, 0x04000046, 0x04, 0x00, 0x0000 }, - { 33, 0x0066, 0x04000046, 0x05, 0x00, 0x0000 }, - { 33, 0x0066, 0x04000046, 0x06, 0x00, 0x0000 }, - { 33, 0x0066, 0x04000046, 0x07, 0x00, 0x0000 }, - { 33, 0x0066, 0x08000046, 0x08, 0x00, 0x0000 }, - { 33, 0x0066, 0x08000046, 0x09, 0x00, 0x0000 }, - { 33, 0x0066, 0x08000046, 0x0a, 0x00, 0x0000 }, - { 33, 0x0066, 0x08000046, 0x0b, 0x00, 0x0000 }, - { 33, 0x0066, 0x0c000046, 0x0c, 0x00, 0x0000 }, - { 33, 0x0066, 0x0c000046, 0x0d, 0x00, 0x0000 }, - { 33, 0x0066, 0x0c000046, 0x0e, 0x00, 0x0000 }, - { 33, 0x0066, 0x0c000046, 0x0f, 0x00, 0x0000 }, - { 34, 0x0067, 0x00000047, 0x00, 0x00, 0x0000 }, - { 34, 0x0047, 0x00000047, 0x01, 0x00, 0x0000 }, - { 34, 0x0067, 0x00000047, 0x02, 0x00, 0x0000 }, - { 34, 0x0047, 0x00000047, 0x03, 0x00, 0x0000 }, - { 34, 0x0067, 0x04000047, 0x04, 0x00, 0x0000 }, - { 34, 0x0067, 0x04000047, 0x05, 0x00, 0x0000 }, - { 34, 0x0067, 0x04000047, 0x06, 0x00, 0x0000 }, - { 34, 0x0067, 0x04000047, 0x07, 0x00, 0x0000 }, - { 34, 0x0067, 0x08000047, 0x08, 0x00, 0x0000 }, - { 34, 0x0067, 0x08000047, 0x09, 0x00, 0x0000 }, - { 34, 0x0067, 0x08000047, 0x0a, 0x00, 0x0000 }, - { 34, 0x0067, 0x08000047, 0x0b, 0x00, 0x0000 }, - { 34, 0x0067, 0x0c000047, 0x0c, 0x00, 0x0000 }, - { 34, 0x0067, 0x0c000047, 0x0d, 0x00, 0x0000 }, - { 34, 0x0067, 0x0c000047, 0x0e, 0x00, 0x0000 }, - { 34, 0x0067, 0x0c000047, 0x0f, 0x00, 0x0000 }, - { 35, 0x0068, 0x00000048, 0x00, 0x00, 0x0000 }, - { 35, 0x0048, 0x00000048, 0x01, 0x00, 0x0000 }, - { 35, 0x0068, 0x00000048, 0x02, 0x00, 0x0000 }, - { 35, 0x0048, 0x00000048, 0x03, 0x00, 0x0000 }, - { 35, 0x0068, 0x04000048, 0x04, 0x00, 0x0000 }, - { 35, 0x0068, 0x04000048, 0x05, 0x00, 0x0000 }, - { 35, 0x0068, 0x04000048, 0x06, 0x00, 0x0000 }, - { 35, 0x0068, 0x04000048, 0x07, 0x00, 0x0000 }, - { 35, 0x0068, 0x08000048, 0x08, 0x00, 0x0000 }, - { 35, 0x0068, 0x08000048, 0x09, 0x00, 0x0000 }, - { 35, 0x0068, 0x08000048, 0x0a, 0x00, 0x0000 }, - { 35, 0x0068, 0x08000048, 0x0b, 0x00, 0x0000 }, - { 35, 0x0068, 0x0c000048, 0x0c, 0x00, 0x0000 }, - { 35, 0x0068, 0x0c000048, 0x0d, 0x00, 0x0000 }, - { 35, 0x0068, 0x0c000048, 0x0e, 0x00, 0x0000 }, - { 35, 0x0068, 0x0c000048, 0x0f, 0x00, 0x0000 }, - { 36, 0x006a, 0x0000004a, 0x00, 0x00, 0x0000 }, - { 36, 0x004a, 0x0000004a, 0x01, 0x00, 0x0000 }, - { 36, 0x006a, 0x0000004a, 0x02, 0x00, 0x0000 }, - { 36, 0x004a, 0x0000004a, 0x03, 0x00, 0x0000 }, - { 36, 0x006a, 0x0400004a, 0x04, 0x00, 0x0000 }, - { 36, 0x006a, 0x0400004a, 0x05, 0x00, 0x0000 }, - { 36, 0x006a, 0x0400004a, 0x06, 0x00, 0x0000 }, - { 36, 0x006a, 0x0400004a, 0x07, 0x00, 0x0000 }, - { 36, 0x006a, 0x0800004a, 0x08, 0x00, 0x0000 }, - { 36, 0x006a, 0x0800004a, 0x09, 0x00, 0x0000 }, - { 36, 0x006a, 0x0800004a, 0x0a, 0x00, 0x0000 }, - { 36, 0x006a, 0x0800004a, 0x0b, 0x00, 0x0000 }, - { 36, 0x006a, 0x0c00004a, 0x0c, 0x00, 0x0000 }, - { 36, 0x006a, 0x0c00004a, 0x0d, 0x00, 0x0000 }, - { 36, 0x006a, 0x0c00004a, 0x0e, 0x00, 0x0000 }, - { 36, 0x006a, 0x0c00004a, 0x0f, 0x00, 0x0000 }, - { 37, 0x006b, 0x0000004b, 0x00, 0x00, 0x0000 }, - { 37, 0x004b, 0x0000004b, 0x01, 0x00, 0x0000 }, - { 37, 0x006b, 0x0000004b, 0x02, 0x00, 0x0000 }, - { 37, 0x004b, 0x0000004b, 0x03, 0x00, 0x0000 }, - { 37, 0x006b, 0x0400004b, 0x04, 0x00, 0x0000 }, - { 37, 0x006b, 0x0400004b, 0x05, 0x00, 0x0000 }, - { 37, 0x006b, 0x0400004b, 0x06, 0x00, 0x0000 }, - { 37, 0x006b, 0x0400004b, 0x07, 0x00, 0x0000 }, - { 37, 0x006b, 0x0800004b, 0x08, 0x00, 0x0000 }, - { 37, 0x006b, 0x0800004b, 0x09, 0x00, 0x0000 }, - { 37, 0x006b, 0x0800004b, 0x0a, 0x00, 0x0000 }, - { 37, 0x006b, 0x0800004b, 0x0b, 0x00, 0x0000 }, - { 37, 0x006b, 0x0c00004b, 0x0c, 0x00, 0x0000 }, - { 37, 0x006b, 0x0c00004b, 0x0d, 0x00, 0x0000 }, - { 37, 0x006b, 0x0c00004b, 0x0e, 0x00, 0x0000 }, - { 37, 0x006b, 0x0c00004b, 0x0f, 0x00, 0x0000 }, - { 38, 0x006c, 0x0000004c, 0x00, 0x00, 0x0000 }, - { 38, 0x004c, 0x0000004c, 0x01, 0x00, 0x0000 }, - { 38, 0x006c, 0x0000004c, 0x02, 0x00, 0x0000 }, - { 38, 0x004c, 0x0000004c, 0x03, 0x00, 0x0000 }, - { 38, 0x006c, 0x0400004c, 0x04, 0x00, 0x0000 }, - { 38, 0x006c, 0x0400004c, 0x05, 0x00, 0x0000 }, - { 38, 0x006c, 0x0400004c, 0x06, 0x00, 0x0000 }, - { 38, 0x006c, 0x0400004c, 0x07, 0x00, 0x0000 }, - { 38, 0x006c, 0x0800004c, 0x08, 0x00, 0x0000 }, - { 38, 0x006c, 0x0800004c, 0x09, 0x00, 0x0000 }, - { 38, 0x006c, 0x0800004c, 0x0a, 0x00, 0x0000 }, - { 38, 0x006c, 0x0800004c, 0x0b, 0x00, 0x0000 }, - { 38, 0x006c, 0x0c00004c, 0x0c, 0x00, 0x0000 }, - { 38, 0x006c, 0x0c00004c, 0x0d, 0x00, 0x0000 }, - { 38, 0x006c, 0x0c00004c, 0x0e, 0x00, 0x0000 }, - { 38, 0x006c, 0x0c00004c, 0x0f, 0x00, 0x0000 }, - { 39, 0x003b, 0x0000003b, 0x00, 0x00, 0x0000 }, - { 39, 0x003a, 0x0000003a, 0x01, 0x00, 0x0000 }, - { 40, 0x0027, 0x00000027, 0x00, 0x00, 0x0000 }, - { 40, 0x0022, 0x00000022, 0x01, 0x00, 0x0000 }, - { 40, 0x0027, 0x01001251, 0x02, 0x01, 0x0000 }, - { 40, 0x0022, 0x01001257, 0x03, 0x01, 0x0000 }, - { 40, 0x0067, 0x04000047, 0x04, 0x00, 0x0000 }, - { 41, 0x0060, 0x00000060, 0x00, 0x00, 0x0000 }, - { 41, 0x007e, 0x0000007e, 0x01, 0x00, 0x0000 }, - { 41, 0x0060, 0x01001250, 0x02, 0x01, 0x0000 }, - { 41, 0x007e, 0x01001253, 0x03, 0x01, 0x0000 }, - { 42, 0xffff, 0x01000020, 0x00, 0x04, 0x0001 }, - { 43, 0x005c, 0x0000005c, 0x00, 0x00, 0x0000 }, - { 43, 0x007c, 0x0000007c, 0x01, 0x00, 0x0000 }, - { 43, 0x005c, 0x0400005c, 0x04, 0x00, 0x0000 }, - { 44, 0x007a, 0x0000005a, 0x00, 0x00, 0x0000 }, - { 44, 0x005a, 0x0000005a, 0x01, 0x00, 0x0000 }, - { 44, 0x007a, 0x0000005a, 0x02, 0x00, 0x0000 }, - { 44, 0x005a, 0x0000005a, 0x03, 0x00, 0x0000 }, - { 44, 0x007a, 0x0400005a, 0x04, 0x00, 0x0000 }, - { 44, 0x007a, 0x0400005a, 0x05, 0x00, 0x0000 }, - { 44, 0x007a, 0x0400005a, 0x06, 0x00, 0x0000 }, - { 44, 0x007a, 0x0400005a, 0x07, 0x00, 0x0000 }, - { 44, 0x007a, 0x0800005a, 0x08, 0x00, 0x0000 }, - { 44, 0x007a, 0x0800005a, 0x09, 0x00, 0x0000 }, - { 44, 0x007a, 0x0800005a, 0x0a, 0x00, 0x0000 }, - { 44, 0x007a, 0x0800005a, 0x0b, 0x00, 0x0000 }, - { 44, 0x007a, 0x0c00005a, 0x0c, 0x00, 0x0000 }, - { 44, 0x007a, 0x0c00005a, 0x0d, 0x00, 0x0000 }, - { 44, 0x007a, 0x0c00005a, 0x0e, 0x00, 0x0000 }, - { 44, 0x007a, 0x0c00005a, 0x0f, 0x00, 0x0000 }, - { 45, 0x0078, 0x00000058, 0x00, 0x00, 0x0000 }, - { 45, 0x0058, 0x00000058, 0x01, 0x00, 0x0000 }, - { 45, 0x0078, 0x00000058, 0x02, 0x00, 0x0000 }, - { 45, 0x0058, 0x00000058, 0x03, 0x00, 0x0000 }, - { 45, 0x0078, 0x04000058, 0x04, 0x00, 0x0000 }, - { 45, 0x0078, 0x04000058, 0x05, 0x00, 0x0000 }, - { 45, 0x0078, 0x04000058, 0x06, 0x00, 0x0000 }, - { 45, 0x0078, 0x04000058, 0x07, 0x00, 0x0000 }, - { 45, 0x0078, 0x08000058, 0x08, 0x00, 0x0000 }, - { 45, 0x0078, 0x08000058, 0x09, 0x00, 0x0000 }, - { 45, 0x0078, 0x08000058, 0x0a, 0x00, 0x0000 }, - { 45, 0x0078, 0x08000058, 0x0b, 0x00, 0x0000 }, - { 45, 0x0078, 0x0c000058, 0x0c, 0x00, 0x0000 }, - { 45, 0x0078, 0x0c000058, 0x0d, 0x00, 0x0000 }, - { 45, 0x0078, 0x0c000058, 0x0e, 0x00, 0x0000 }, - { 45, 0x0078, 0x0c000058, 0x0f, 0x00, 0x0000 }, - { 46, 0x0063, 0x00000043, 0x00, 0x00, 0x0000 }, - { 46, 0x0043, 0x00000043, 0x01, 0x00, 0x0000 }, - { 46, 0x0063, 0x00000043, 0x02, 0x00, 0x0000 }, - { 46, 0x0043, 0x00000043, 0x03, 0x00, 0x0000 }, - { 46, 0x0063, 0x04000043, 0x04, 0x00, 0x0000 }, - { 46, 0x0063, 0x04000043, 0x05, 0x00, 0x0000 }, - { 46, 0x0063, 0x04000043, 0x06, 0x00, 0x0000 }, - { 46, 0x0063, 0x04000043, 0x07, 0x00, 0x0000 }, - { 46, 0x0063, 0x08000043, 0x08, 0x00, 0x0000 }, - { 46, 0x0063, 0x08000043, 0x09, 0x00, 0x0000 }, - { 46, 0x0063, 0x08000043, 0x0a, 0x00, 0x0000 }, - { 46, 0x0063, 0x08000043, 0x0b, 0x00, 0x0000 }, - { 46, 0x0063, 0x0c000043, 0x0c, 0x00, 0x0000 }, - { 46, 0x0063, 0x0c000043, 0x0d, 0x00, 0x0000 }, - { 46, 0x0063, 0x0c000043, 0x0e, 0x00, 0x0000 }, - { 46, 0x0063, 0x0c000043, 0x0f, 0x00, 0x0000 }, - { 47, 0x0076, 0x00000056, 0x00, 0x00, 0x0000 }, - { 47, 0x0056, 0x00000056, 0x01, 0x00, 0x0000 }, - { 47, 0x0076, 0x00000056, 0x02, 0x00, 0x0000 }, - { 47, 0x0056, 0x00000056, 0x03, 0x00, 0x0000 }, - { 47, 0x0076, 0x04000056, 0x04, 0x00, 0x0000 }, - { 47, 0x0076, 0x04000056, 0x05, 0x00, 0x0000 }, - { 47, 0x0076, 0x04000056, 0x06, 0x00, 0x0000 }, - { 47, 0x0076, 0x04000056, 0x07, 0x00, 0x0000 }, - { 47, 0x0076, 0x08000056, 0x08, 0x00, 0x0000 }, - { 47, 0x0076, 0x08000056, 0x09, 0x00, 0x0000 }, - { 47, 0x0076, 0x08000056, 0x0a, 0x00, 0x0000 }, - { 47, 0x0076, 0x08000056, 0x0b, 0x00, 0x0000 }, - { 47, 0x0076, 0x0c000056, 0x0c, 0x00, 0x0000 }, - { 47, 0x0076, 0x0c000056, 0x0d, 0x00, 0x0000 }, - { 47, 0x0076, 0x0c000056, 0x0e, 0x00, 0x0000 }, - { 47, 0x0076, 0x0c000056, 0x0f, 0x00, 0x0000 }, - { 48, 0x0062, 0x00000042, 0x00, 0x00, 0x0000 }, - { 48, 0x0042, 0x00000042, 0x01, 0x00, 0x0000 }, - { 48, 0x0062, 0x00000042, 0x02, 0x00, 0x0000 }, - { 48, 0x0042, 0x00000042, 0x03, 0x00, 0x0000 }, - { 48, 0x0062, 0x04000042, 0x04, 0x00, 0x0000 }, - { 48, 0x0062, 0x04000042, 0x05, 0x00, 0x0000 }, - { 48, 0x0062, 0x04000042, 0x06, 0x00, 0x0000 }, - { 48, 0x0062, 0x04000042, 0x07, 0x00, 0x0000 }, - { 48, 0x0062, 0x08000042, 0x08, 0x00, 0x0000 }, - { 48, 0x0062, 0x08000042, 0x09, 0x00, 0x0000 }, - { 48, 0x0062, 0x08000042, 0x0a, 0x00, 0x0000 }, - { 48, 0x0062, 0x08000042, 0x0b, 0x00, 0x0000 }, - { 48, 0x0062, 0x0c000042, 0x0c, 0x00, 0x0000 }, - { 48, 0x0062, 0x0c000042, 0x0d, 0x00, 0x0000 }, - { 48, 0x0062, 0x0c000042, 0x0e, 0x00, 0x0000 }, - { 48, 0x0062, 0x0c000042, 0x0f, 0x00, 0x0000 }, - { 49, 0x006e, 0x0000004e, 0x00, 0x00, 0x0000 }, - { 49, 0x004e, 0x0000004e, 0x01, 0x00, 0x0000 }, - { 49, 0x006e, 0x0000004e, 0x02, 0x00, 0x0000 }, - { 49, 0x004e, 0x0000004e, 0x03, 0x00, 0x0000 }, - { 49, 0x006e, 0x0400004e, 0x04, 0x00, 0x0000 }, - { 49, 0x006e, 0x0400004e, 0x05, 0x00, 0x0000 }, - { 49, 0x006e, 0x0400004e, 0x06, 0x00, 0x0000 }, - { 49, 0x006e, 0x0400004e, 0x07, 0x00, 0x0000 }, - { 49, 0x006e, 0x0800004e, 0x08, 0x00, 0x0000 }, - { 49, 0x006e, 0x0800004e, 0x09, 0x00, 0x0000 }, - { 49, 0x006e, 0x0800004e, 0x0a, 0x00, 0x0000 }, - { 49, 0x006e, 0x0800004e, 0x0b, 0x00, 0x0000 }, - { 49, 0x006e, 0x0c00004e, 0x0c, 0x00, 0x0000 }, - { 49, 0x006e, 0x0c00004e, 0x0d, 0x00, 0x0000 }, - { 49, 0x006e, 0x0c00004e, 0x0e, 0x00, 0x0000 }, - { 49, 0x006e, 0x0c00004e, 0x0f, 0x00, 0x0000 }, - { 50, 0x006d, 0x0000004d, 0x00, 0x00, 0x0000 }, - { 50, 0x004d, 0x0000004d, 0x01, 0x00, 0x0000 }, - { 50, 0x006d, 0x0000004d, 0x02, 0x00, 0x0000 }, - { 50, 0x004d, 0x0000004d, 0x03, 0x00, 0x0000 }, - { 50, 0x006d, 0x0400004d, 0x04, 0x00, 0x0000 }, - { 50, 0x006d, 0x0400004d, 0x05, 0x00, 0x0000 }, - { 50, 0x006d, 0x0400004d, 0x06, 0x00, 0x0000 }, - { 50, 0x006d, 0x0400004d, 0x07, 0x00, 0x0000 }, - { 50, 0x006d, 0x0800004d, 0x08, 0x00, 0x0000 }, - { 50, 0x006d, 0x0800004d, 0x09, 0x00, 0x0000 }, - { 50, 0x006d, 0x0800004d, 0x0a, 0x00, 0x0000 }, - { 50, 0x006d, 0x0800004d, 0x0b, 0x00, 0x0000 }, - { 50, 0x006d, 0x0c00004d, 0x0c, 0x00, 0x0000 }, - { 50, 0x006d, 0x0c00004d, 0x0d, 0x00, 0x0000 }, - { 50, 0x006d, 0x0c00004d, 0x0e, 0x00, 0x0000 }, - { 50, 0x006d, 0x0c00004d, 0x0f, 0x00, 0x0000 }, - { 51, 0x002c, 0x0000002c, 0x00, 0x00, 0x0000 }, - { 51, 0x003c, 0x0000003c, 0x01, 0x00, 0x0000 }, - { 51, 0x002c, 0x0100125b, 0x02, 0x01, 0x0000 }, - { 52, 0x002e, 0x0000002e, 0x00, 0x00, 0x0000 }, - { 52, 0x003e, 0x0000003e, 0x01, 0x00, 0x0000 }, - { 52, 0xffff, 0x01001120, 0x02, 0x00, 0x0000 }, - { 53, 0x002f, 0x0000002f, 0x00, 0x00, 0x0000 }, - { 53, 0x003f, 0x0000003f, 0x01, 0x00, 0x0000 }, - { 53, 0xffff, 0x01000003, 0x04, 0x00, 0x0000 }, - { 54, 0xffff, 0x01000020, 0x00, 0x04, 0x0001 }, - { 55, 0x002a, 0x2000002a, 0x00, 0x00, 0x0000 }, - { 56, 0xffff, 0x01000023, 0x00, 0x04, 0x0008 }, - { 57, 0x0020, 0x00000020, 0x00, 0x00, 0x0000 }, - { 58, 0xffff, 0x01000024, 0x00, 0x00, 0x0000 }, - { 59, 0xffff, 0x01000030, 0x00, 0x00, 0x0000 }, - { 59, 0xffff, 0x0100003c, 0x01, 0x00, 0x0000 }, - { 59, 0xffff, 0x01000048, 0x04, 0x00, 0x0000 }, - { 59, 0xffff, 0x01000000, 0x0c, 0x08, 0x0100 }, - { 60, 0xffff, 0x01000031, 0x00, 0x00, 0x0000 }, - { 60, 0xffff, 0x0100003d, 0x01, 0x00, 0x0000 }, - { 60, 0xffff, 0x01000049, 0x04, 0x00, 0x0000 }, - { 60, 0xffff, 0x01000000, 0x0c, 0x08, 0x0101 }, - { 61, 0xffff, 0x01000032, 0x00, 0x00, 0x0000 }, - { 61, 0xffff, 0x0100003e, 0x01, 0x00, 0x0000 }, - { 61, 0xffff, 0x0100004a, 0x04, 0x00, 0x0000 }, - { 61, 0xffff, 0x01000000, 0x0c, 0x08, 0x0102 }, - { 62, 0xffff, 0x01000033, 0x00, 0x00, 0x0000 }, - { 62, 0xffff, 0x0100003f, 0x01, 0x00, 0x0000 }, - { 62, 0xffff, 0x0100004b, 0x04, 0x00, 0x0000 }, - { 62, 0xffff, 0x01000000, 0x0c, 0x08, 0x0103 }, - { 63, 0xffff, 0x01000034, 0x00, 0x00, 0x0000 }, - { 63, 0xffff, 0x01000040, 0x01, 0x00, 0x0000 }, - { 63, 0xffff, 0x0100004c, 0x04, 0x00, 0x0000 }, - { 63, 0xffff, 0x01000000, 0x0c, 0x08, 0x0104 }, - { 64, 0xffff, 0x01000035, 0x00, 0x00, 0x0000 }, - { 64, 0xffff, 0x01000041, 0x01, 0x00, 0x0000 }, - { 64, 0xffff, 0x0100004d, 0x04, 0x00, 0x0000 }, - { 64, 0xffff, 0x01000000, 0x0c, 0x08, 0x0105 }, - { 65, 0xffff, 0x01000036, 0x00, 0x00, 0x0000 }, - { 65, 0xffff, 0x01000042, 0x01, 0x00, 0x0000 }, - { 65, 0xffff, 0x0100004e, 0x04, 0x00, 0x0000 }, - { 65, 0xffff, 0x01000000, 0x0c, 0x08, 0x0106 }, - { 66, 0xffff, 0x01000037, 0x00, 0x00, 0x0000 }, - { 66, 0xffff, 0x01000043, 0x01, 0x00, 0x0000 }, - { 66, 0xffff, 0x0100004f, 0x04, 0x00, 0x0000 }, - { 66, 0xffff, 0x01000000, 0x0c, 0x08, 0x0107 }, - { 67, 0xffff, 0x01000038, 0x00, 0x00, 0x0000 }, - { 67, 0xffff, 0x01000044, 0x01, 0x00, 0x0000 }, - { 67, 0xffff, 0x01000050, 0x04, 0x00, 0x0000 }, - { 67, 0xffff, 0x01000000, 0x0c, 0x08, 0x0108 }, - { 68, 0xffff, 0x01000039, 0x00, 0x00, 0x0000 }, - { 68, 0xffff, 0x01000045, 0x01, 0x00, 0x0000 }, - { 68, 0xffff, 0x01000051, 0x04, 0x00, 0x0000 }, - { 68, 0xffff, 0x01000000, 0x0c, 0x08, 0x0109 }, - { 69, 0xffff, 0x01000025, 0x00, 0x00, 0x0000 }, - { 70, 0xffff, 0x01000026, 0x00, 0x00, 0x0000 }, - { 70, 0xffff, 0x01000026, 0x08, 0x00, 0x0000 }, - { 71, 0x0037, 0x20000037, 0x00, 0x00, 0x0000 }, - { 72, 0x0038, 0x20000038, 0x00, 0x00, 0x0000 }, - { 73, 0x0039, 0x20000039, 0x00, 0x00, 0x0000 }, - { 74, 0x002d, 0x2000002d, 0x00, 0x00, 0x0000 }, - { 75, 0x0034, 0x20000034, 0x00, 0x00, 0x0000 }, - { 76, 0x0035, 0x20000035, 0x00, 0x00, 0x0000 }, - { 77, 0x0036, 0x20000036, 0x00, 0x00, 0x0000 }, - { 78, 0x002b, 0x2000002b, 0x00, 0x00, 0x0000 }, - { 79, 0x0031, 0x20000031, 0x00, 0x00, 0x0000 }, - { 80, 0x0032, 0x20000032, 0x00, 0x00, 0x0000 }, - { 81, 0x0033, 0x20000033, 0x00, 0x00, 0x0000 }, - { 82, 0x0030, 0x20000030, 0x00, 0x00, 0x0000 }, - { 83, 0x002e, 0x2000002e, 0x00, 0x00, 0x0000 }, - { 83, 0xffff, 0x01000000, 0x06, 0x08, 0x0200 }, - { 83, 0xffff, 0x01000000, 0x0c, 0x08, 0x0200 }, - { 86, 0x003c, 0x0000003c, 0x00, 0x00, 0x0000 }, - { 86, 0x003e, 0x0000003e, 0x01, 0x00, 0x0000 }, - { 86, 0x007c, 0x0000007c, 0x02, 0x00, 0x0000 }, - { 87, 0xffff, 0x0100003a, 0x00, 0x00, 0x0000 }, - { 87, 0xffff, 0x01000046, 0x01, 0x00, 0x0000 }, - { 87, 0xffff, 0x01000052, 0x04, 0x00, 0x0000 }, - { 87, 0xffff, 0x01000000, 0x0c, 0x08, 0x010a }, - { 88, 0xffff, 0x0100003b, 0x00, 0x00, 0x0000 }, - { 88, 0xffff, 0x01000047, 0x01, 0x00, 0x0000 }, - { 88, 0xffff, 0x01000000, 0x0c, 0x08, 0x010b }, - { 96, 0xffff, 0x21000005, 0x00, 0x00, 0x0000 }, - { 97, 0xffff, 0x01000021, 0x00, 0x04, 0x0004 }, - { 98, 0x002f, 0x2000002f, 0x00, 0x00, 0x0000 }, - { 99, 0x005c, 0x0400005c, 0x00, 0x00, 0x0000 }, - { 100, 0xffff, 0x01001103, 0x00, 0x04, 0x0002 }, - { 102, 0xffff, 0x01000010, 0x00, 0x00, 0x0000 }, - { 103, 0xffff, 0x01000013, 0x00, 0x00, 0x0000 }, - { 104, 0xffff, 0x01000016, 0x00, 0x00, 0x0000 }, - { 105, 0xffff, 0x01000012, 0x00, 0x00, 0x0000 }, - { 105, 0xffff, 0x01000000, 0x0c, 0x08, 0x0180 }, - { 106, 0xffff, 0x01000014, 0x00, 0x00, 0x0000 }, - { 106, 0xffff, 0x01000000, 0x0c, 0x08, 0x0181 }, - { 107, 0xffff, 0x01000011, 0x00, 0x00, 0x0000 }, - { 108, 0xffff, 0x01000015, 0x00, 0x00, 0x0000 }, - { 109, 0xffff, 0x01000017, 0x00, 0x00, 0x0000 }, - { 110, 0xffff, 0x01000006, 0x00, 0x00, 0x0000 }, - { 111, 0xffff, 0x01000007, 0x00, 0x00, 0x0000 }, - { 111, 0xffff, 0x01000000, 0x06, 0x08, 0x0200 }, - { 111, 0xffff, 0x01000000, 0x0c, 0x08, 0x0200 }, - { 119, 0xffff, 0x01000008, 0x00, 0x00, 0x0000 }, -}; - -const QEvdevKeyboardMap::Composing QEvdevKeyboardHandler::s_keycompose_default[] = { - { 0x0060, 0x0041, 0x00c0 }, - { 0x0060, 0x0061, 0x00e0 }, - { 0x0027, 0x0041, 0x00c1 }, - { 0x0027, 0x0061, 0x00e1 }, - { 0x005e, 0x0041, 0x00c2 }, - { 0x005e, 0x0061, 0x00e2 }, - { 0x007e, 0x0041, 0x00c3 }, - { 0x007e, 0x0061, 0x00e3 }, - { 0x0022, 0x0041, 0x00c4 }, - { 0x0022, 0x0061, 0x00e4 }, - { 0x002d, 0x0061, 0x00aa }, - { 0x002d, 0x0041, 0x00aa }, - { 0x004f, 0x0041, 0x00c5 }, - { 0x006f, 0x0061, 0x00e5 }, - { 0x0030, 0x0041, 0x00c5 }, - { 0x0030, 0x0061, 0x00e5 }, - { 0x0041, 0x0041, 0x00c5 }, - { 0x0061, 0x0061, 0x00e5 }, - { 0x00b0, 0x0041, 0x00c5 }, - { 0x00b0, 0x0061, 0x00e5 }, - { 0x0041, 0x0045, 0x00c6 }, - { 0x0061, 0x0065, 0x00e6 }, - { 0x002c, 0x0043, 0x00c7 }, - { 0x002c, 0x0063, 0x00e7 }, - { 0x005e, 0x0043, 0x00c7 }, - { 0x005e, 0x0063, 0x00e7 }, - { 0x0060, 0x0045, 0x00c8 }, - { 0x0060, 0x0065, 0x00e8 }, - { 0x0027, 0x0045, 0x00c9 }, - { 0x0027, 0x0065, 0x00e9 }, - { 0x005e, 0x0045, 0x00ca }, - { 0x005e, 0x0065, 0x00ea }, - { 0x0022, 0x0045, 0x00cb }, - { 0x0022, 0x0065, 0x00eb }, - { 0x0060, 0x0049, 0x00cc }, - { 0x0060, 0x0069, 0x00ec }, - { 0x0027, 0x0049, 0x00cd }, - { 0x0027, 0x0069, 0x00ed }, - { 0x005e, 0x0049, 0x00ce }, - { 0x005e, 0x0069, 0x00ee }, - { 0x0022, 0x0049, 0x00cf }, - { 0x0022, 0x0069, 0x00ef }, - { 0x002d, 0x0044, 0x00d0 }, - { 0x002d, 0x0064, 0x00f0 }, - { 0x005e, 0x0044, 0x00d0 }, - { 0x005e, 0x0064, 0x00f0 }, - { 0x007e, 0x004e, 0x00d1 }, - { 0x007e, 0x006e, 0x00f1 }, - { 0x005e, 0x004e, 0x00d1 }, - { 0x005e, 0x006e, 0x00f1 }, - { 0x0060, 0x004f, 0x00d2 }, - { 0x0060, 0x006f, 0x00f2 }, - { 0x0027, 0x004f, 0x00d3 }, - { 0x0027, 0x006f, 0x00f3 }, - { 0x005e, 0x004f, 0x00d4 }, - { 0x005e, 0x006f, 0x00f4 }, - { 0x007e, 0x004f, 0x00d5 }, - { 0x007e, 0x006f, 0x00f5 }, - { 0x0022, 0x004f, 0x00d6 }, - { 0x0022, 0x006f, 0x00f6 }, - { 0x002f, 0x004f, 0x00d8 }, - { 0x002f, 0x006f, 0x00f8 }, - { 0x002d, 0x006f, 0x00ba }, - { 0x002d, 0x004f, 0x00ba }, - { 0x0060, 0x0055, 0x00d9 }, - { 0x0060, 0x0075, 0x00f9 }, - { 0x0027, 0x0055, 0x00da }, - { 0x0027, 0x0075, 0x00fa }, - { 0x005e, 0x0055, 0x00db }, - { 0x005e, 0x0075, 0x00fb }, - { 0x0022, 0x0055, 0x00dc }, - { 0x0022, 0x0075, 0x00fc }, - { 0x0027, 0x0059, 0x00dd }, - { 0x0027, 0x0079, 0x00fd }, - { 0x0054, 0x0048, 0x00de }, - { 0x0074, 0x0068, 0x00fe }, - { 0x0073, 0x0073, 0x00df }, - { 0x0022, 0x0079, 0x00ff }, - { 0x0073, 0x007a, 0x00df }, - { 0x006e, 0x006e, 0x00f1 }, - { 0x006e, 0x0068, 0x00f1 }, - { 0x004e, 0x0059, 0x00d1 }, - { 0x004e, 0x004e, 0x00d1 }, - { 0x004e, 0x0048, 0x00d1 }, - { 0x004e, 0x0079, 0x00d1 }, - { 0x004e, 0x006e, 0x00d1 }, - { 0x004e, 0x0068, 0x00d1 }, - { 0x002d, 0x004c, 0x00a3 }, - { 0x003c, 0x003c, 0x00ab }, - { 0x003e, 0x003e, 0x00bb }, - { 0x003f, 0x003f, 0x00bf }, - { 0x005e, 0x003f, 0x00bf }, - { 0x0021, 0x0021, 0x00a1 }, - { 0x005e, 0x0021, 0x00a1 }, - { 0x005e, 0x0031, 0x00b9 }, - { 0x005e, 0x0032, 0x00b2 }, - { 0x005e, 0x0033, 0x00b3 }, - { 0x002b, 0x002d, 0x00b1 }, - { 0x0063, 0x003d, 0x00a2 }, - { 0x0063, 0x002f, 0x00a2 }, - { 0x002f, 0x0063, 0x00a2 }, - { 0x002d, 0x0063, 0x00a2 }, - { 0x002d, 0x0043, 0x00a2 }, - { 0x004c, 0x003d, 0x00a3 }, - { 0x002d, 0x004c, 0x00a3 }, - { 0x002d, 0x006c, 0x00a3 }, - { 0x005e, 0x002a, 0x00d7 }, - { 0x005e, 0x0078, 0x00d7 }, - { 0x0078, 0x0078, 0x00d7 }, - { 0x005e, 0x002e, 0x00b7 }, - { 0x002e, 0x002e, 0x00b7 }, - { 0x005e, 0x002f, 0x00f7 }, - { 0x005e, 0x003a, 0x00f7 }, - { 0x002d, 0x003a, 0x00f7 }, - { 0x003a, 0x002d, 0x00f7 }, - { 0x0059, 0x003d, 0x00a5 }, - { 0x002d, 0x0059, 0x00a5 }, - { 0x002d, 0x006c, 0x00a5 }, - { 0x0028, 0x0063, 0x00a9 }, - { 0x0022, 0x0063, 0x00a9 }, - { 0x002d, 0x0061, 0x00aa }, - { 0x002d, 0x0041, 0x00aa }, - { 0x002d, 0x006f, 0x00ba }, - { 0x002d, 0x004f, 0x00ba }, - { 0x0028, 0x0072, 0x00ae }, - { 0x0022, 0x0072, 0x00ae }, - { 0x006d, 0x0075, 0x00b5 }, - { 0x0031, 0x0034, 0x0152 }, - { 0x0031, 0x0032, 0x0153 }, - { 0x0033, 0x0034, 0x0178 }, - { 0x0065, 0x003d, 0x20ac }, - { 0x002d, 0x0065, 0x20ac }, - { 0x002d, 0x0045, 0x20ac }, - { 0x0076, 0x0053, 0x0160 }, - { 0x005e, 0x0053, 0x0160 }, - { 0x0076, 0x0073, 0x0161 }, - { 0x005e, 0x0073, 0x0161 }, - { 0x0076, 0x005a, 0x017d }, - { 0x005e, 0x005a, 0x017d }, - { 0x0076, 0x007a, 0x017e }, - { 0x005e, 0x007a, 0x017e }, - { 0x004f, 0x0045, 0x0152 }, - { 0x004f, 0x0065, 0x0152 }, - { 0x006f, 0x0065, 0x0153 }, - { 0x0022, 0x0059, 0x0178 }, - { 0x0069, 0x006a, 0x00ff }, - { 0x0049, 0x004a, 0x0178 }, -}; - -#endif // QEVDEVKEYBOARDHANDLER_DEFAULTMAP_H diff --git a/src/plugins/generic/evdevkeyboard/qevdevkeyboardhandler.cpp b/src/plugins/generic/evdevkeyboard/qevdevkeyboardhandler.cpp deleted file mode 100644 index c963606305..0000000000 --- a/src/plugins/generic/evdevkeyboard/qevdevkeyboardhandler.cpp +++ /dev/null @@ -1,489 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qevdevkeyboardhandler.h" - -#include - -#include -#include -#include -#include -#include - -#include - -//#define QT_QPA_KEYMAP_DEBUG - -#ifdef QT_QPA_KEYMAP_DEBUG -#include -#endif - -QT_BEGIN_NAMESPACE - -// simple builtin US keymap -#include "qevdevkeyboard_defaultmap.h" - -QEvdevKeyboardHandler::QEvdevKeyboardHandler(const QString &device, int fd, bool disableZap, bool enableCompose, const QString &keymapFile) - : m_device(device), m_fd(fd), - m_modifiers(0), m_composing(0), m_dead_unicode(0xffff), - m_no_zap(disableZap), m_do_compose(enableCompose), - m_keymap(0), m_keymap_size(0), m_keycompose(0), m_keycompose_size(0) -{ -#ifdef QT_QPA_KEYMAP_DEBUG - qWarning() << "Create keyboard handler with for device" << device; -#endif - - setObjectName(QLatin1String("LinuxInput Keyboard Handler")); - - memset(m_locks, 0, sizeof(m_locks)); - - if (keymapFile.isEmpty() || !loadKeymap(keymapFile)) - unloadKeymap(); - - // socket notifier for events on the keyboard device - QSocketNotifier *notifier; - notifier = new QSocketNotifier(m_fd, QSocketNotifier::Read, this); - connect(notifier, SIGNAL(activated(int)), this, SLOT(readKeycode())); -} - -QEvdevKeyboardHandler::~QEvdevKeyboardHandler() -{ - unloadKeymap(); - - if (m_fd >= 0) - qt_safe_close(m_fd); -} - -QEvdevKeyboardHandler *QEvdevKeyboardHandler::create(const QString &device, const QString &specification) -{ -#ifdef QT_QPA_KEYMAP_DEBUG - qWarning() << "Try to create keyboard handler for" << device << specification; -#endif - - QString keymapFile; - int repeatDelay = 400; - int repeatRate = 80; - bool disableZap = false; - bool enableCompose = false; - - QStringList args = specification.split(QLatin1Char(':')); - foreach (const QString &arg, args) { - if (arg.startsWith(QLatin1String("keymap="))) - keymapFile = arg.mid(7); - else if (arg == QLatin1String("disable-zap")) - disableZap = true; - else if (arg == QLatin1String("enable-compose")) - enableCompose = true; - else if (arg.startsWith(QLatin1String("repeat-delay="))) - repeatDelay = arg.mid(13).toInt(); - else if (arg.startsWith(QLatin1String("repeat-rate="))) - repeatRate = arg.mid(12).toInt(); - } - -#ifdef QT_QPA_KEYMAP_DEBUG - qWarning() << "Opening keyboard at" << device; -#endif - - int fd; - fd = qt_safe_open(device.toLocal8Bit().constData(), O_RDONLY | O_NDELAY, 0); - if (fd >= 0) { - if (repeatDelay > 0 && repeatRate > 0) { - int kbdrep[2] = { repeatDelay, repeatRate }; - ::ioctl(fd, EVIOCSREP, kbdrep); - } - - return new QEvdevKeyboardHandler(device, fd, disableZap, enableCompose, keymapFile); - } else { - qWarning("Cannot open keyboard input device '%s': %s", qPrintable(device), strerror(errno)); - return 0; - } -} - -void QEvdevKeyboardHandler::switchLed(int led, bool state) -{ -#ifdef QT_QPA_KEYMAP_DEBUG - qWarning() << "switchLed" << led << state; -#endif - - struct ::input_event led_ie; - ::gettimeofday(&led_ie.time, 0); - led_ie.type = EV_LED; - led_ie.code = led; - led_ie.value = state; - - qt_safe_write(m_fd, &led_ie, sizeof(led_ie)); -} - -void QEvdevKeyboardHandler::readKeycode() -{ -#ifdef QT_QPA_KEYMAP_DEBUG - qWarning() << "Read new keycode on" << m_device; -#endif - - struct ::input_event buffer[32]; - int n = 0; - - forever { - int result = qt_safe_read(m_fd, reinterpret_cast(buffer) + n, sizeof(buffer) - n); - - if (result == 0) { - qWarning("Got EOF from the input device."); - return; - } else if (result < 0) { - if (errno != EINTR && errno != EAGAIN) { - qWarning("Could not read from input device: %s", strerror(errno)); - return; - } - } else { - n += result; - if (n % sizeof(buffer[0]) == 0) - break; - } - } - - n /= sizeof(buffer[0]); - - for (int i = 0; i < n; ++i) { - if (buffer[i].type != EV_KEY) - continue; - - quint16 code = buffer[i].code; - qint32 value = buffer[i].value; - - QEvdevKeyboardHandler::KeycodeAction ka; - ka = processKeycode(code, value != 0, value == 2); - - switch (ka) { - case QEvdevKeyboardHandler::CapsLockOn: - case QEvdevKeyboardHandler::CapsLockOff: - switchLed(LED_CAPSL, ka == QEvdevKeyboardHandler::CapsLockOn); - break; - - case QEvdevKeyboardHandler::NumLockOn: - case QEvdevKeyboardHandler::NumLockOff: - switchLed(LED_NUML, ka == QEvdevKeyboardHandler::NumLockOn); - break; - - case QEvdevKeyboardHandler::ScrollLockOn: - case QEvdevKeyboardHandler::ScrollLockOff: - switchLed(LED_SCROLLL, ka == QEvdevKeyboardHandler::ScrollLockOn); - break; - - default: - // ignore console switching and reboot - break; - } - } -} - -void QEvdevKeyboardHandler::processKeyEvent(int unicode, int keycode, Qt::KeyboardModifiers modifiers, bool isPress, bool autoRepeat) -{ - QWindowSystemInterface::handleKeyEvent(0, ( isPress ? QEvent::KeyPress : QEvent::KeyRelease ), keycode, modifiers, QString( unicode ), autoRepeat ); -} - -QEvdevKeyboardHandler::KeycodeAction QEvdevKeyboardHandler::processKeycode(quint16 keycode, bool pressed, bool autorepeat) -{ - KeycodeAction result = None; - bool first_press = pressed && !autorepeat; - - const QEvdevKeyboardMap::Mapping *map_plain = 0; - const QEvdevKeyboardMap::Mapping *map_withmod = 0; - - // get a specific and plain mapping for the keycode and the current modifiers - for (int i = 0; i < m_keymap_size && !(map_plain && map_withmod); ++i) { - const QEvdevKeyboardMap::Mapping *m = m_keymap + i; - if (m->keycode == keycode) { - if (m->modifiers == 0) - map_plain = m; - - quint8 testmods = m_modifiers; - if (m_locks[0] /*CapsLock*/ && (m->flags & QEvdevKeyboardMap::IsLetter)) - testmods ^= QEvdevKeyboardMap::ModShift; - if (m->modifiers == testmods) - map_withmod = m; - } - } - -#ifdef QT_QPA_KEYMAP_DEBUG - qWarning("Processing key event: keycode=%3d, modifiers=%02x pressed=%d, autorepeat=%d | plain=%d, withmod=%d, size=%d", \ - keycode, m_modifiers, pressed ? 1 : 0, autorepeat ? 1 : 0, \ - map_plain ? map_plain - m_keymap : -1, \ - map_withmod ? map_withmod - m_keymap : -1, \ - m_keymap_size); -#endif - - const QEvdevKeyboardMap::Mapping *it = map_withmod ? map_withmod : map_plain; - - if (!it) { -#ifdef QT_QPA_KEYMAP_DEBUG - // we couldn't even find a plain mapping - qWarning("Could not find a suitable mapping for keycode: %3d, modifiers: %02x", keycode, m_modifiers); -#endif - return result; - } - - bool skip = false; - quint16 unicode = it->unicode; - quint32 qtcode = it->qtcode; - - if ((it->flags & QEvdevKeyboardMap::IsModifier) && it->special) { - // this is a modifier, i.e. Shift, Alt, ... - if (pressed) - m_modifiers |= quint8(it->special); - else - m_modifiers &= ~quint8(it->special); - } else if (qtcode >= Qt::Key_CapsLock && qtcode <= Qt::Key_ScrollLock) { - // (Caps|Num|Scroll)Lock - if (first_press) { - quint8 &lock = m_locks[qtcode - Qt::Key_CapsLock]; - lock ^= 1; - - switch (qtcode) { - case Qt::Key_CapsLock : result = lock ? CapsLockOn : CapsLockOff; m_modifiers ^= QEvdevKeyboardMap::ModShift; break; - case Qt::Key_NumLock : result = lock ? NumLockOn : NumLockOff; break; - case Qt::Key_ScrollLock: result = lock ? ScrollLockOn : ScrollLockOff; break; - default : break; - } - } - } else if ((it->flags & QEvdevKeyboardMap::IsSystem) && it->special && first_press) { - switch (it->special) { - case QEvdevKeyboardMap::SystemReboot: - result = Reboot; - break; - - case QEvdevKeyboardMap::SystemZap: - if (!m_no_zap) - qApp->quit(); - break; - - case QEvdevKeyboardMap::SystemConsolePrevious: - result = PreviousConsole; - break; - - case QEvdevKeyboardMap::SystemConsoleNext: - result = NextConsole; - break; - - default: - if (it->special >= QEvdevKeyboardMap::SystemConsoleFirst && - it->special <= QEvdevKeyboardMap::SystemConsoleLast) { - result = KeycodeAction(SwitchConsoleFirst + ((it->special & QEvdevKeyboardMap::SystemConsoleMask) & SwitchConsoleMask)); - } - break; - } - - skip = true; // no need to tell Qt about it - } else if ((qtcode == Qt::Key_Multi_key) && m_do_compose) { - // the Compose key was pressed - if (first_press) - m_composing = 2; - skip = true; - } else if ((it->flags & QEvdevKeyboardMap::IsDead) && m_do_compose) { - // a Dead key was pressed - if (first_press && m_composing == 1 && m_dead_unicode == unicode) { // twice - m_composing = 0; - qtcode = Qt::Key_unknown; // otherwise it would be Qt::Key_Dead... - } else if (first_press && unicode != 0xffff) { - m_dead_unicode = unicode; - m_composing = 1; - skip = true; - } else { - skip = true; - } - } - - if (!skip) { - // a normal key was pressed - const int modmask = Qt::ShiftModifier | Qt::ControlModifier | Qt::AltModifier | Qt::MetaModifier | Qt::KeypadModifier; - - // we couldn't find a specific mapping for the current modifiers, - // or that mapping didn't have special modifiers: - // so just report the plain mapping with additional modifiers. - if ((it == map_plain && it != map_withmod) || - (map_withmod && !(map_withmod->qtcode & modmask))) { - qtcode |= QEvdevKeyboardHandler::toQtModifiers(m_modifiers); - } - - if (m_composing == 2 && first_press && !(it->flags & QEvdevKeyboardMap::IsModifier)) { - // the last key press was the Compose key - if (unicode != 0xffff) { - int idx = 0; - // check if this code is in the compose table at all - for ( ; idx < m_keycompose_size; ++idx) { - if (m_keycompose[idx].first == unicode) - break; - } - if (idx < m_keycompose_size) { - // found it -> simulate a Dead key press - m_dead_unicode = unicode; - unicode = 0xffff; - m_composing = 1; - skip = true; - } else { - m_composing = 0; - } - } else { - m_composing = 0; - } - } else if (m_composing == 1 && first_press && !(it->flags & QEvdevKeyboardMap::IsModifier)) { - // the last key press was a Dead key - bool valid = false; - if (unicode != 0xffff) { - int idx = 0; - // check if this code is in the compose table at all - for ( ; idx < m_keycompose_size; ++idx) { - if (m_keycompose[idx].first == m_dead_unicode && m_keycompose[idx].second == unicode) - break; - } - if (idx < m_keycompose_size) { - quint16 composed = m_keycompose[idx].result; - if (composed != 0xffff) { - unicode = composed; - qtcode = Qt::Key_unknown; - valid = true; - } - } - } - if (!valid) { - unicode = m_dead_unicode; - qtcode = Qt::Key_unknown; - } - m_composing = 0; - } - - if (!skip) { -#ifdef QT_QPA_KEYMAP_DEBUG - qWarning("Processing: uni=%04x, qt=%08x, qtmod=%08x", unicode, qtcode & ~modmask, (qtcode & modmask)); -#endif - - // send the result to the server - processKeyEvent(unicode, qtcode & ~modmask, Qt::KeyboardModifiers(qtcode & modmask), pressed, autorepeat); - } - } - return result; -} - -void QEvdevKeyboardHandler::unloadKeymap() -{ -#ifdef QT_QPA_KEYMAP_DEBUG - qWarning() << "Unload current keymap and restore built-in"; -#endif - - if (m_keymap && m_keymap != s_keymap_default) - delete [] m_keymap; - if (m_keycompose && m_keycompose != s_keycompose_default) - delete [] m_keycompose; - - m_keymap = s_keymap_default; - m_keymap_size = sizeof(s_keymap_default) / sizeof(s_keymap_default[0]); - m_keycompose = s_keycompose_default; - m_keycompose_size = sizeof(s_keycompose_default) / sizeof(s_keycompose_default[0]); - - // reset state, so we could switch keymaps at runtime - m_modifiers = 0; - memset(m_locks, 0, sizeof(m_locks)); - m_composing = 0; - m_dead_unicode = 0xffff; -} - -bool QEvdevKeyboardHandler::loadKeymap(const QString &file) -{ -#ifdef QT_QPA_KEYMAP_DEBUG - qWarning() << "Load keymap" << file; -#endif - - QFile f(file); - - if (!f.open(QIODevice::ReadOnly)) { - qWarning("Could not open keymap file '%s'", qPrintable(file)); - return false; - } - - // .qmap files have a very simple structure: - // quint32 magic (QKeyboard::FileMagic) - // quint32 version (1) - // quint32 keymap_size (# of struct QKeyboard::Mappings) - // quint32 keycompose_size (# of struct QKeyboard::Composings) - // all QKeyboard::Mappings via QDataStream::operator(<<|>>) - // all QKeyboard::Composings via QDataStream::operator(<<|>>) - - quint32 qmap_magic, qmap_version, qmap_keymap_size, qmap_keycompose_size; - - QDataStream ds(&f); - - ds >> qmap_magic >> qmap_version >> qmap_keymap_size >> qmap_keycompose_size; - - if (ds.status() != QDataStream::Ok || qmap_magic != QEvdevKeyboardMap::FileMagic || qmap_version != 1 || qmap_keymap_size == 0) { - qWarning("'%s' is ot a valid.qmap keymap file.", qPrintable(file)); - return false; - } - - QEvdevKeyboardMap::Mapping *qmap_keymap = new QEvdevKeyboardMap::Mapping[qmap_keymap_size]; - QEvdevKeyboardMap::Composing *qmap_keycompose = qmap_keycompose_size ? new QEvdevKeyboardMap::Composing[qmap_keycompose_size] : 0; - - for (quint32 i = 0; i < qmap_keymap_size; ++i) - ds >> qmap_keymap[i]; - for (quint32 i = 0; i < qmap_keycompose_size; ++i) - ds >> qmap_keycompose[i]; - - if (ds.status() != QDataStream::Ok) { - delete [] qmap_keymap; - delete [] qmap_keycompose; - - qWarning("Keymap file '%s' can not be loaded.", qPrintable(file)); - return false; - } - - // unload currently active and clear state - unloadKeymap(); - - m_keymap = qmap_keymap; - m_keymap_size = qmap_keymap_size; - m_keycompose = qmap_keycompose; - m_keycompose_size = qmap_keycompose_size; - - m_do_compose = true; - - return true; -} - -QT_END_NAMESPACE diff --git a/src/plugins/generic/evdevkeyboard/qevdevkeyboardhandler.h b/src/plugins/generic/evdevkeyboard/qevdevkeyboardhandler.h deleted file mode 100644 index 6b7901f42e..0000000000 --- a/src/plugins/generic/evdevkeyboard/qevdevkeyboardhandler.h +++ /dev/null @@ -1,202 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QEVDEVKEYBOARDHANDLER_H -#define QEVDEVKEYBOARDHANDLER_H - -#include -#include -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -namespace QEvdevKeyboardMap { - const quint32 FileMagic = 0x514d4150; // 'QMAP' - - struct Mapping { - quint16 keycode; - quint16 unicode; - quint32 qtcode; - quint8 modifiers; - quint8 flags; - quint16 special; - - }; - - enum Flags { - IsDead = 0x01, - IsLetter = 0x02, - IsModifier = 0x04, - IsSystem = 0x08 - }; - - enum System { - SystemConsoleFirst = 0x0100, - SystemConsoleMask = 0x007f, - SystemConsoleLast = 0x017f, - SystemConsolePrevious = 0x0180, - SystemConsoleNext = 0x0181, - SystemReboot = 0x0200, - SystemZap = 0x0300 - }; - - struct Composing { - quint16 first; - quint16 second; - quint16 result; - }; - - enum Modifiers { - ModPlain = 0x00, - ModShift = 0x01, - ModAltGr = 0x02, - ModControl = 0x04, - ModAlt = 0x08, - ModShiftL = 0x10, - ModShiftR = 0x20, - ModCtrlL = 0x40, - ModCtrlR = 0x80 - // ModCapsShift = 0x100, // not supported! - }; -} - -inline QDataStream &operator>>(QDataStream &ds, QEvdevKeyboardMap::Mapping &m) -{ - return ds >> m.keycode >> m.unicode >> m.qtcode >> m.modifiers >> m.flags >> m.special; -} - -inline QDataStream &operator<<(QDataStream &ds, const QEvdevKeyboardMap::Mapping &m) -{ - return ds << m.keycode << m.unicode << m.qtcode << m.modifiers << m.flags << m.special; -} - -inline QDataStream &operator>>(QDataStream &ds, QEvdevKeyboardMap::Composing &c) -{ - return ds >> c.first >> c.second >> c.result; -} - -inline QDataStream &operator<<(QDataStream &ds, const QEvdevKeyboardMap::Composing &c) -{ - return ds << c.first << c.second << c.result; -} - - -class QEvdevKeyboardHandler : public QObject -{ - Q_OBJECT -public: - QEvdevKeyboardHandler(const QString &device, int fd, bool disableZap, bool enableCompose, const QString &keymapFile); - ~QEvdevKeyboardHandler(); - - enum KeycodeAction { - None = 0, - - CapsLockOff = 0x01000000, - CapsLockOn = 0x01000001, - NumLockOff = 0x02000000, - NumLockOn = 0x02000001, - ScrollLockOff = 0x03000000, - ScrollLockOn = 0x03000001, - - Reboot = 0x04000000, - - PreviousConsole = 0x05000000, - NextConsole = 0x05000001, - SwitchConsoleFirst = 0x06000000, - SwitchConsoleLast = 0x0600007f, - SwitchConsoleMask = 0x0000007f - }; - - static QEvdevKeyboardHandler *create(const QString &device, const QString &specification); - - static Qt::KeyboardModifiers toQtModifiers(quint8 mod) - { - Qt::KeyboardModifiers qtmod = Qt::NoModifier; - - if (mod & (QEvdevKeyboardMap::ModShift | QEvdevKeyboardMap::ModShiftL | QEvdevKeyboardMap::ModShiftR)) - qtmod |= Qt::ShiftModifier; - if (mod & (QEvdevKeyboardMap::ModControl | QEvdevKeyboardMap::ModCtrlL | QEvdevKeyboardMap::ModCtrlR)) - qtmod |= Qt::ControlModifier; - if (mod & QEvdevKeyboardMap::ModAlt) - qtmod |= Qt::AltModifier; - - return qtmod; - } - -private slots: - void readKeycode(); - KeycodeAction processKeycode(quint16 keycode, bool pressed, bool autorepeat); - -private: - void unloadKeymap(); - bool loadKeymap(const QString &file); - void processKeyEvent(int unicode, int keycode, Qt::KeyboardModifiers modifiers, bool isPress, bool autoRepeat); - void switchLed(int, bool); - - QString m_device; - int m_fd; - - // keymap handling - quint8 m_modifiers; - quint8 m_locks[3]; - int m_composing; - quint16 m_dead_unicode; - - bool m_no_zap; - bool m_do_compose; - - const QEvdevKeyboardMap::Mapping *m_keymap; - int m_keymap_size; - const QEvdevKeyboardMap::Composing *m_keycompose; - int m_keycompose_size; - - static const QEvdevKeyboardMap::Mapping s_keymap_default[]; - static const QEvdevKeyboardMap::Composing s_keycompose_default[]; -}; - - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QEVDEVKEYBOARDHANDLER_H diff --git a/src/plugins/generic/evdevkeyboard/qevdevkeyboardmanager.cpp b/src/plugins/generic/evdevkeyboard/qevdevkeyboardmanager.cpp deleted file mode 100644 index 43d20e5c0d..0000000000 --- a/src/plugins/generic/evdevkeyboard/qevdevkeyboardmanager.cpp +++ /dev/null @@ -1,129 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qevdevkeyboardmanager.h" - -#include -#include - -//#define QT_QPA_KEYMAP_DEBUG - -#ifdef QT_QPA_KEYMAP_DEBUG -#include -#endif - -QT_BEGIN_NAMESPACE - -QEvdevKeyboardManager::QEvdevKeyboardManager(const QString &key, const QString &specification, QObject *parent) - : QObject(parent) -{ - Q_UNUSED(key); - - QStringList args = specification.split(QLatin1Char(':')); - QStringList devices; - - foreach (const QString &arg, args) { - if (arg.startsWith(QLatin1String("/dev/"))) { - // if device is specified try to use it - devices.append(arg); - args.removeAll(arg); - } - } - - // build new specification without /dev/ elements - m_spec = args.join(QLatin1String(":")); - - // add all keyboards for devices specified in the argument list - foreach (const QString &device, devices) - addKeyboard(device); - - if (devices.isEmpty()) { -#ifdef QT_QPA_KEYMAP_DEBUG - qWarning() << "Use device discovery"; -#endif - - m_deviceDiscovery = QDeviceDiscovery::create(QDeviceDiscovery::Device_Keyboard, this); - if (m_deviceDiscovery) { - // scan and add already connected keyboards - QStringList devices = m_deviceDiscovery->scanConnectedDevices(); - foreach (QString device, devices) { - addKeyboard(device); - } - - connect(m_deviceDiscovery, SIGNAL(deviceDetected(QString)), this, SLOT(addKeyboard(QString))); - connect(m_deviceDiscovery, SIGNAL(deviceRemoved(QString)), this, SLOT(removeKeyboard(QString))); - } - } -} - -QEvdevKeyboardManager::~QEvdevKeyboardManager() -{ - qDeleteAll(m_keyboards); - m_keyboards.clear(); -} - -void QEvdevKeyboardManager::addKeyboard(const QString &deviceNode) -{ -#ifdef QT_QPA_KEYMAP_DEBUG - qWarning() << "Adding keyboard at" << deviceNode; -#endif - - QEvdevKeyboardHandler *keyboard; - keyboard = QEvdevKeyboardHandler::create(deviceNode, m_spec); - if (keyboard) - m_keyboards.insert(deviceNode, keyboard); - else - qWarning("Failed to open keyboard"); -} - -void QEvdevKeyboardManager::removeKeyboard(const QString &deviceNode) -{ - if (m_keyboards.contains(deviceNode)) { -#ifdef QT_QPA_KEYMAP_DEBUG - qWarning() << "Removing keyboard at" << deviceNode; -#endif - QEvdevKeyboardHandler *keyboard = m_keyboards.value(deviceNode); - m_keyboards.remove(deviceNode); - delete keyboard; - } -} - -QT_END_NAMESPACE diff --git a/src/plugins/generic/evdevkeyboard/qevdevkeyboardmanager.h b/src/plugins/generic/evdevkeyboard/qevdevkeyboardmanager.h deleted file mode 100644 index 3cd576d039..0000000000 --- a/src/plugins/generic/evdevkeyboard/qevdevkeyboardmanager.h +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QEVDEVKEYBOARDMANAGER_H -#define QEVDEVKEYBOARDMANAGER_H - -#include "qevdevkeyboardhandler.h" - -#include - -#include -#include -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -class QEvdevKeyboardManager : public QObject -{ - Q_OBJECT -public: - QEvdevKeyboardManager(const QString &key, const QString &specification, QObject *parent = 0); - ~QEvdevKeyboardManager(); - -private slots: - void addKeyboard(const QString &deviceNode = QString()); - void removeKeyboard(const QString &deviceNode); - -private: - QString m_spec; - QHash m_keyboards; - QDeviceDiscovery *m_deviceDiscovery; -}; - -QT_END_HEADER - -QT_END_NAMESPACE - -#endif // QEVDEVKEYBOARDMANAGER_H diff --git a/src/plugins/generic/evdevmouse/evdevmouse.pro b/src/plugins/generic/evdevmouse/evdevmouse.pro index fb9c0e71b8..e61a187103 100644 --- a/src/plugins/generic/evdevmouse/evdevmouse.pro +++ b/src/plugins/generic/evdevmouse/evdevmouse.pro @@ -5,18 +5,10 @@ DESTDIR = $$QT.gui.plugins/generic target.path = $$[QT_INSTALL_PLUGINS]/generic INSTALLS += target -HEADERS = qevdevmousehandler.h \ - qevdevmousemanager.h - QT += core-private platformsupport-private -SOURCES = main.cpp \ - qevdevmousehandler.cpp \ - qevdevmousemanager.cpp +SOURCES = main.cpp OTHER_FILES += \ evdevmouse.json -contains(QT_CONFIG, libudev) { - LIBS += $$QMAKE_LIBS_LIBUDEV -} diff --git a/src/plugins/generic/evdevmouse/main.cpp b/src/plugins/generic/evdevmouse/main.cpp index b49c183d7b..b1d4703902 100644 --- a/src/plugins/generic/evdevmouse/main.cpp +++ b/src/plugins/generic/evdevmouse/main.cpp @@ -40,7 +40,7 @@ ****************************************************************************/ #include -#include "qevdevmousemanager.h" +#include QT_BEGIN_NAMESPACE diff --git a/src/plugins/generic/evdevmouse/qevdevmousehandler.cpp b/src/plugins/generic/evdevmouse/qevdevmousehandler.cpp deleted file mode 100644 index 439d2c095a..0000000000 --- a/src/plugins/generic/evdevmouse/qevdevmousehandler.cpp +++ /dev/null @@ -1,233 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qevdevmousehandler.h" - -#include -#include -#include -#include -#include -#include - -#include -#include // overrides QT_OPEN - -#include - -#include -#include - -#include - -//#define QT_QPA_MOUSE_HANDLER_DEBUG - -QT_BEGIN_NAMESPACE - -QEvdevMouseHandler *QEvdevMouseHandler::create(const QString &device, const QString &specification) -{ -#ifdef QT_QPA_MOUSE_HANDLER_DEBUG - qWarning() << "Try to create mouse handler for" << device << specification; -#endif - - bool compression = true; - int jitterLimit = 0; - - QStringList args = specification.split(QLatin1Char(':')); - foreach (const QString &arg, args) { - if (arg == "nocompress") - compression = false; - else if (arg.startsWith("dejitter=")) - jitterLimit = arg.mid(9).toInt(); - } - - int fd; - fd = qt_safe_open(device.toLocal8Bit().constData(), O_RDONLY | O_NDELAY, 0); - if (fd >= 0) { - return new QEvdevMouseHandler(device, fd, compression, jitterLimit); - } else { - qWarning("Cannot open mouse input device '%s': %s", qPrintable(device), strerror(errno)); - return 0; - } -} - -QEvdevMouseHandler::QEvdevMouseHandler(const QString &device, int fd, bool compression, int jitterLimit) - : m_device(device), m_fd(fd), m_notify(0), m_x(0), m_y(0), m_prevx(0), m_prevy(0), - m_compression(compression), m_buttons(0) -{ - setObjectName(QLatin1String("Evdev Mouse Handler")); - - m_jitterLimitSquared = jitterLimit * jitterLimit; - - // socket notifier for events on the mouse device - QSocketNotifier *notifier; - notifier = new QSocketNotifier(m_fd, QSocketNotifier::Read, this); - connect(notifier, SIGNAL(activated(int)), this, SLOT(readMouseData())); -} - -QEvdevMouseHandler::~QEvdevMouseHandler() -{ - if (m_fd >= 0) - qt_safe_close(m_fd); -} - -void QEvdevMouseHandler::sendMouseEvent() -{ - emit handleMouseEvent(m_x - m_prevx, m_y - m_prevy, m_buttons); - - m_prevx = m_x; - m_prevy = m_y; -} - -void QEvdevMouseHandler::readMouseData() -{ - struct ::input_event buffer[32]; - int n = 0; - bool posChanged = false; - bool pendingMouseEvent = false; - int eventCompressCount = 0; - forever { - int result = QT_READ(m_fd, reinterpret_cast(buffer) + n, sizeof(buffer) - n); - - if (result == 0) { - qWarning("Got EOF from the input device."); - return; - } else if (result < 0) { - if (errno != EINTR && errno != EAGAIN) { - qWarning("Could not read from input device: %s", strerror(errno)); - return; - } - } else { - n += result; - if (n % sizeof(buffer[0]) == 0) - break; - } - } - - n /= sizeof(buffer[0]); - - for (int i = 0; i < n; ++i) { - struct ::input_event *data = &buffer[i]; - //qDebug() << ">>" << hex << data->type << data->code << dec << data->value; - if (data->type == EV_ABS) { - if (data->code == ABS_X && m_x != data->value) { - m_x = data->value; - posChanged = true; - } else if (data->code == ABS_Y && m_y != data->value) { - m_y = data->value; - posChanged = true; - } - } else if (data->type == EV_REL) { - if (data->code == REL_X) { - m_x += data->value; - posChanged = true; - } else if (data->code == REL_Y) { - m_y += data->value; - posChanged = true; - } else if (data->code == ABS_WHEEL) { // vertical scroll - // data->value: 1 == up, -1 == down - int delta = 120 * data->value; - QWindowSystemInterface::handleWheelEvent(0, QPoint(m_x, m_y), - QPoint(m_x, m_y), - delta, Qt::Vertical); - } else if (data->code == ABS_THROTTLE) { // horizontal scroll - // data->value: 1 == right, -1 == left - int delta = 120 * -data->value; - QWindowSystemInterface::handleWheelEvent(0, QPoint(m_x, m_y), - QPoint(m_x, m_y), - delta, Qt::Horizontal); - } - } else if (data->type == EV_KEY && data->code == BTN_TOUCH) { - m_buttons = data->value ? Qt::LeftButton : Qt::NoButton; - - sendMouseEvent(); - pendingMouseEvent = false; - } else if (data->type == EV_KEY && data->code >= BTN_LEFT && data->code <= BTN_JOYSTICK) { - Qt::MouseButton button = Qt::NoButton; - // BTN_LEFT == 0x110 in kernel's input.h - // The range of possible mouse buttons ends just before BTN_JOYSTICK, value 0x120. - switch (data->code) { - case 0x110: button = Qt::LeftButton; break; // BTN_LEFT - case 0x111: button = Qt::RightButton; break; - case 0x112: button = Qt::MiddleButton; break; - case 0x113: button = Qt::ExtraButton1; break; // AKA Qt::BackButton - case 0x114: button = Qt::ExtraButton2; break; // AKA Qt::ForwardButton - case 0x115: button = Qt::ExtraButton3; break; // AKA Qt::TaskButton - case 0x116: button = Qt::ExtraButton4; break; - case 0x117: button = Qt::ExtraButton5; break; - case 0x118: button = Qt::ExtraButton6; break; - case 0x119: button = Qt::ExtraButton7; break; - case 0x11a: button = Qt::ExtraButton8; break; - case 0x11b: button = Qt::ExtraButton9; break; - case 0x11c: button = Qt::ExtraButton10; break; - case 0x11d: button = Qt::ExtraButton11; break; - case 0x11e: button = Qt::ExtraButton12; break; - case 0x11f: button = Qt::ExtraButton13; break; - } - if (data->value) - m_buttons |= button; - else - m_buttons &= ~button; - sendMouseEvent(); - pendingMouseEvent = false; - } else if (data->type == EV_SYN && data->code == SYN_REPORT) { - if (posChanged) { - posChanged = false; - if (m_compression) { - pendingMouseEvent = true; - eventCompressCount++; - } else { - sendMouseEvent(); - } - } - } else if (data->type == EV_MSC && data->code == MSC_SCAN) { - // kernel encountered an unmapped key - just ignore it - continue; - } - } - if (m_compression && pendingMouseEvent) { - int distanceSquared = (m_x - m_prevx)*(m_x - m_prevx) + (m_y - m_prevy)*(m_y - m_prevy); - if (distanceSquared > m_jitterLimitSquared) - sendMouseEvent(); - } -} - -QT_END_NAMESPACE diff --git a/src/plugins/generic/evdevmouse/qevdevmousehandler.h b/src/plugins/generic/evdevmouse/qevdevmousehandler.h deleted file mode 100644 index e3444735fe..0000000000 --- a/src/plugins/generic/evdevmouse/qevdevmousehandler.h +++ /dev/null @@ -1,86 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QEVDEVMOUSEHANDLER_H -#define QEVDEVMOUSEHANDLER_H - -#include -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -class QSocketNotifier; - -class QEvdevMouseHandler : public QObject -{ - Q_OBJECT -public: - static QEvdevMouseHandler *create(const QString &device, const QString &specification); - ~QEvdevMouseHandler(); - -signals: - void handleMouseEvent(int x, int y, Qt::MouseButtons buttons); - -private slots: - void readMouseData(); - -private: - QEvdevMouseHandler(const QString &device, int fd, bool compression, int jitterLimit); - - void sendMouseEvent(); - - QString m_device; - int m_fd; - QSocketNotifier *m_notify; - int m_x, m_y; - int m_prevx, m_prevy; - bool m_compression; - Qt::MouseButtons m_buttons; - int m_jitterLimitSquared; -}; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QEVDEVMOUSEHANDLER_H diff --git a/src/plugins/generic/evdevmouse/qevdevmousemanager.cpp b/src/plugins/generic/evdevmouse/qevdevmousemanager.cpp deleted file mode 100644 index 132161c176..0000000000 --- a/src/plugins/generic/evdevmouse/qevdevmousemanager.cpp +++ /dev/null @@ -1,163 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qevdevmousemanager.h" - -#include -#include -#include -#include - -//#define QT_QPA_MOUSEMANAGER_DEBUG - -#ifdef QT_QPA_MOUSEMANAGER_DEBUG -#include -#endif - -QT_BEGIN_NAMESPACE - -QEvdevMouseManager::QEvdevMouseManager(const QString &key, const QString &specification, QObject *parent) - : QObject(parent), m_x(0), m_y(0), m_xoffset(0), m_yoffset(0) -{ - Q_UNUSED(key); - - QStringList args = specification.split(QLatin1Char(':')); - QStringList devices; - - foreach (const QString &arg, args) { - if (arg.startsWith("/dev/")) { - // if device is specified try to use it - devices.append(arg); - args.removeAll(arg); - } else if (arg.startsWith("xoffset=")) { - m_xoffset = arg.mid(8).toInt(); - } else if (arg.startsWith("yoffset=")) { - m_yoffset = arg.mid(8).toInt(); - } - } - - // build new specification without /dev/ elements - m_spec = args.join(":"); - - // add all mice for devices specified in the argument list - foreach (const QString &device, devices) - addMouse(device); - - if (devices.isEmpty()) { -#ifdef QT_QPA_MOUSEMANAGER_DEBUG - qWarning() << "Use device discovery"; -#endif - - m_deviceDiscovery = QDeviceDiscovery::create(QDeviceDiscovery::Device_Mouse | QDeviceDiscovery::Device_Touchpad, this); - if (m_deviceDiscovery) { - // scan and add already connected keyboards - QStringList devices = m_deviceDiscovery->scanConnectedDevices(); - foreach (QString device, devices) { - addMouse(device); - } - - connect(m_deviceDiscovery, SIGNAL(deviceDetected(QString)), this, SLOT(addMouse(QString))); - connect(m_deviceDiscovery, SIGNAL(deviceRemoved(QString)), this, SLOT(removeMouse(QString))); - } - } -} - -QEvdevMouseManager::~QEvdevMouseManager() -{ - qDeleteAll(m_mice); - m_mice.clear(); -} - -void QEvdevMouseManager::handleMouseEvent(int x, int y, Qt::MouseButtons buttons) -{ - // update current absolute coordinates - m_x += x; - m_y += y; - - // clamp to screen geometry - QRect g = QGuiApplication::primaryScreen()->virtualGeometry(); - if (m_x + m_xoffset < g.left()) - m_x = g.left() - m_xoffset; - else if (m_x + m_xoffset > g.right()) - m_x = g.right() - m_xoffset; - - if (m_y + m_yoffset < g.top()) - m_y = g.top() - m_yoffset; - else if (m_y + m_yoffset > g.bottom()) - m_y = g.bottom() - m_yoffset; - - QPoint pos(m_x + m_xoffset, m_y + m_yoffset); - QWindowSystemInterface::handleMouseEvent(0, pos, pos, buttons); - -#ifdef QT_QPA_MOUSEMANAGER_DEBUG - qDebug("mouse event %d %d %d", pos.x(), pos.y(), int(buttons)); -#endif -} - -void QEvdevMouseManager::addMouse(const QString &deviceNode) -{ -#ifdef QT_QPA_MOUSEMANAGER_DEBUG - qWarning() << "Adding mouse at" << deviceNode; -#endif - - QEvdevMouseHandler *handler; - handler = QEvdevMouseHandler::create(deviceNode, m_spec); - if (handler) { - connect(handler, SIGNAL(handleMouseEvent(int, int, Qt::MouseButtons)), this, SLOT(handleMouseEvent(int, int, Qt::MouseButtons))); - m_mice.insert(deviceNode, handler); - } else { - qWarning("Failed to open mouse"); - } -} - -void QEvdevMouseManager::removeMouse(const QString &deviceNode) -{ - if (m_mice.contains(deviceNode)) { -#ifdef QT_QPA_MOUSEMANAGER_DEBUG - qWarning() << "Removing mouse at" << deviceNode; -#endif - QEvdevMouseHandler *handler = m_mice.value(deviceNode); - m_mice.remove(deviceNode); - delete handler; - } -} - -QT_END_NAMESPACE diff --git a/src/plugins/generic/evdevmouse/qevdevmousemanager.h b/src/plugins/generic/evdevmouse/qevdevmousemanager.h deleted file mode 100644 index ee528de15c..0000000000 --- a/src/plugins/generic/evdevmouse/qevdevmousemanager.h +++ /dev/null @@ -1,85 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QEVDEVMOUSEMANAGER_H -#define QEVDEVMOUSEMANAGER_H - -#include "qevdevmousehandler.h" - -#include - -#include -#include -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -class QEvdevMouseManager : public QObject -{ - Q_OBJECT -public: - QEvdevMouseManager(const QString &key, const QString &specification, QObject *parent = 0); - ~QEvdevMouseManager(); - -public slots: - void handleMouseEvent(int x, int y, Qt::MouseButtons buttons); - -private slots: - void addMouse(const QString &deviceNode = QString()); - void removeMouse(const QString &deviceNode); - -private: - QString m_spec; - QHash m_mice; - QDeviceDiscovery *m_deviceDiscovery; - int m_x; - int m_y; - int m_xoffset; - int m_yoffset; -}; - -QT_END_HEADER - -QT_END_NAMESPACE - -#endif // QEVDEVMOUSEMANAGER_H diff --git a/src/plugins/generic/evdevtouch/evdevtouch.pro b/src/plugins/generic/evdevtouch/evdevtouch.pro index c7d298d534..a774e56023 100644 --- a/src/plugins/generic/evdevtouch/evdevtouch.pro +++ b/src/plugins/generic/evdevtouch/evdevtouch.pro @@ -5,21 +5,10 @@ DESTDIR = $$QT.gui.plugins/generic target.path = $$[QT_INSTALL_PLUGINS]/generic INSTALLS += target -HEADERS = \ - qevdevtouch.h - -SOURCES = main.cpp \ - qevdevtouch.cpp +SOURCES = main.cpp QT += core-private platformsupport-private OTHER_FILES += \ evdevtouch.json -contains(QT_CONFIG, libudev) { - LIBS += $$QMAKE_LIBS_LIBUDEV -} - -# DEFINES += USE_MTDEV - -contains(DEFINES, USE_MTDEV): LIBS += -lmtdev diff --git a/src/plugins/generic/evdevtouch/main.cpp b/src/plugins/generic/evdevtouch/main.cpp index 47b026ac96..0068ec88a8 100644 --- a/src/plugins/generic/evdevtouch/main.cpp +++ b/src/plugins/generic/evdevtouch/main.cpp @@ -40,7 +40,7 @@ ****************************************************************************/ #include -#include "qevdevtouch.h" +#include QT_BEGIN_NAMESPACE diff --git a/src/plugins/generic/evdevtouch/qevdevtouch.cpp b/src/plugins/generic/evdevtouch/qevdevtouch.cpp deleted file mode 100644 index aa43b6ac85..0000000000 --- a/src/plugins/generic/evdevtouch/qevdevtouch.cpp +++ /dev/null @@ -1,517 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the plugins module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qevdevtouch.h" -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef USE_MTDEV -extern "C" { -#include -} -#endif - -QT_BEGIN_NAMESPACE - -#ifndef ABS_MT_SLOT -#define ABS_MT_SLOT 0x2f -#endif - -class QTouchScreenData -{ -public: - QTouchScreenData(QTouchScreenHandler *q_ptr, const QStringList &args); - - void processInputEvent(input_event *data); - void assignIds(); - - QTouchScreenHandler *q; - int m_lastEventType; - QList m_touchPoints; - - struct Contact { - int trackingId; - int x; - int y; - int maj; - int pressure; - Qt::TouchPointState state; - QTouchEvent::TouchPoint::InfoFlags flags; - Contact() : trackingId(-1), - x(0), y(0), maj(1), pressure(0), - state(Qt::TouchPointPressed), flags(0) { } - }; - QHash m_contacts; // The key is a tracking id for type A, slot number for type B. - QHash m_lastContacts; - Contact m_currentData; - int m_currentSlot; - - int findClosestContact(const QHash &contacts, int x, int y, int *dist); - void reportPoints(); - void registerDevice(); - - int hw_range_x_min; - int hw_range_x_max; - int hw_range_y_min; - int hw_range_y_max; - int hw_pressure_min; - int hw_pressure_max; - QString hw_name; - bool m_forceToActiveWindow; - QTouchDevice *m_device; - bool m_typeB; -}; - -QTouchScreenData::QTouchScreenData(QTouchScreenHandler *q_ptr, const QStringList &args) - : q(q_ptr), - m_lastEventType(-1), - m_currentSlot(0), - hw_range_x_min(0), hw_range_x_max(0), - hw_range_y_min(0), hw_range_y_max(0), - hw_pressure_min(0), hw_pressure_max(0), - m_device(0), m_typeB(false) -{ - m_forceToActiveWindow = args.contains(QLatin1String("force_window")); -} - -void QTouchScreenData::registerDevice() -{ - m_device = new QTouchDevice; - m_device->setName(hw_name); - m_device->setType(QTouchDevice::TouchScreen); - m_device->setCapabilities(QTouchDevice::Position | QTouchDevice::Area); - if (hw_pressure_max > hw_pressure_min) - m_device->setCapabilities(m_device->capabilities() | QTouchDevice::Pressure); - - QWindowSystemInterface::registerTouchDevice(m_device); -} - -#define LONG_BITS (sizeof(long) << 3) -#define NUM_LONGS(bits) (((bits) + LONG_BITS - 1) / LONG_BITS) - -static inline bool testBit(long bit, const long *array) -{ - return (array[bit / LONG_BITS] >> bit % LONG_BITS) & 1; -} - -QTouchScreenHandler::QTouchScreenHandler(const QString &spec, QObject *parent) - : QObject(parent), m_notify(0), m_fd(-1), d(0) -#ifdef USE_MTDEV - , m_mtdev(0) -#endif -{ - setObjectName(QLatin1String("Evdev Touch Handler")); - - QString dev; - - // only the first device argument is used for now - QStringList args = spec.split(QLatin1Char(':')); - for (int i = 0; i < args.count(); ++i) { - if (args.at(i).startsWith(QLatin1String("/dev/"))) { - dev = args.at(i); - break; - } - } - - if (dev.isEmpty()) { - // try to let udev scan for already connected devices - QScopedPointer deviceDiscovery(QDeviceDiscovery::create(QDeviceDiscovery::Device_Touchpad | QDeviceDiscovery::Device_Touchscreen, this)); - if (deviceDiscovery) { - QStringList devices = deviceDiscovery->scanConnectedDevices(); - - // only the first device found is used for now - if (devices.size() > 0) - dev = devices[0]; - } - } - - if (dev.isEmpty()) - return; - - qDebug("evdevtouch: Using device %s", qPrintable(dev)); - m_fd = QT_OPEN(dev.toLocal8Bit().constData(), O_RDONLY | O_NDELAY, 0); - - if (m_fd >= 0) { - m_notify = new QSocketNotifier(m_fd, QSocketNotifier::Read, this); - connect(m_notify, SIGNAL(activated(int)), this, SLOT(readData())); - } else { - qWarning("Cannot open input device '%s': %s", qPrintable(dev), strerror(errno)); - return; - } - -#ifdef USE_MTDEV - m_mtdev = static_cast(calloc(1, sizeof(mtdev))); - int mtdeverr = mtdev_open(m_mtdev, m_fd); - if (mtdeverr) { - qWarning("mtdev_open failed: %d", mtdeverr); - QT_CLOSE(m_fd); - return; - } -#endif - - d = new QTouchScreenData(this, args); - - input_absinfo absInfo; - memset(&absInfo, 0, sizeof(input_absinfo)); - if (ioctl(m_fd, EVIOCGABS(ABS_MT_POSITION_X), &absInfo) >= 0) { - qDebug("min X: %d max X: %d", absInfo.minimum, absInfo.maximum); - d->hw_range_x_min = absInfo.minimum; - d->hw_range_x_max = absInfo.maximum; - } - if (ioctl(m_fd, EVIOCGABS(ABS_MT_POSITION_Y), &absInfo) >= 0) { - qDebug("min Y: %d max Y: %d", absInfo.minimum, absInfo.maximum); - d->hw_range_y_min = absInfo.minimum; - d->hw_range_y_max = absInfo.maximum; - } - if (ioctl(m_fd, EVIOCGABS(ABS_PRESSURE), &absInfo) >= 0) { - qDebug("min pressure: %d max pressure: %d", absInfo.minimum, absInfo.maximum); - if (absInfo.maximum > absInfo.minimum) { - d->hw_pressure_min = absInfo.minimum; - d->hw_pressure_max = absInfo.maximum; - } - } - char name[1024]; - if (ioctl(m_fd, EVIOCGNAME(sizeof(name) - 1), name) >= 0) { - d->hw_name = QString::fromLocal8Bit(name); - qDebug("device name: %s", name); - } - -#ifdef USE_MTDEV - const char *mtdevStr = "(mtdev)"; - d->m_typeB = true; -#else - const char *mtdevStr = ""; - d->m_typeB = false; - long absbits[NUM_LONGS(ABS_CNT)]; - if (ioctl(m_fd, EVIOCGBIT(EV_ABS, sizeof(absbits)), absbits) >= 0) - d->m_typeB = testBit(ABS_MT_SLOT, absbits); -#endif - qDebug("Protocol type %c %s", d->m_typeB ? 'B' : 'A', mtdevStr); - - d->registerDevice(); -} - -QTouchScreenHandler::~QTouchScreenHandler() -{ -#ifdef USE_MTDEV - if (m_mtdev) { - mtdev_close(m_mtdev); - free(m_mtdev); - } -#endif - - if (m_fd >= 0) - QT_CLOSE(m_fd); - - delete d; -} - -void QTouchScreenHandler::readData() -{ - ::input_event buffer[32]; - int n = 0; - for (; ;) { -#ifdef USE_MTDEV - int result = mtdev_get(m_mtdev, m_fd, buffer, sizeof(buffer) / sizeof(::input_event)); - if (result > 0) - result *= sizeof(::input_event); -#else - int result = QT_READ(m_fd, reinterpret_cast(buffer) + n, sizeof(buffer) - n); -#endif - if (!result) { - qWarning("Got EOF from input device"); - return; - } else if (result < 0) { - if (errno != EINTR && errno != EAGAIN) { - qWarning("Could not read from input device: %s", strerror(errno)); - if (errno == ENODEV) { // device got disconnected -> stop reading - delete m_notify; - m_notify = 0; - QT_CLOSE(m_fd); - m_fd = -1; - } - return; - } - } else { - n += result; - if (n % sizeof(::input_event) == 0) - break; - } - } - - n /= sizeof(::input_event); - - for (int i = 0; i < n; ++i) - d->processInputEvent(&buffer[i]); -} - -void QTouchScreenData::processInputEvent(input_event *data) -{ - if (data->type == EV_ABS) { - - if (data->code == ABS_MT_POSITION_X) { - m_currentData.x = qBound(hw_range_x_min, data->value, hw_range_x_max); - if (m_typeB) - m_contacts[m_currentSlot].x = m_currentData.x; - } else if (data->code == ABS_MT_POSITION_Y) { - m_currentData.y = qBound(hw_range_y_min, data->value, hw_range_y_max); - if (m_typeB) - m_contacts[m_currentSlot].y = m_currentData.y; - } else if (data->code == ABS_MT_TRACKING_ID) { - m_currentData.trackingId = data->value; - if (m_typeB) { - if (m_currentData.trackingId == -1) - m_contacts[m_currentSlot].state = Qt::TouchPointReleased; - else - m_contacts[m_currentSlot].trackingId = m_currentData.trackingId; - } - } else if (data->code == ABS_MT_TOUCH_MAJOR) { - m_currentData.maj = data->value; - if (data->value == 0) - m_currentData.state = Qt::TouchPointReleased; - if (m_typeB) - m_contacts[m_currentSlot].maj = m_currentData.maj; - } else if (data->code == ABS_PRESSURE) { - m_currentData.pressure = qBound(hw_pressure_min, data->value, hw_pressure_max); - if (m_typeB) - m_contacts[m_currentSlot].pressure = m_currentData.pressure; - } else if (data->code == ABS_MT_SLOT) { - m_currentSlot = data->value; - } - - } else if (data->type == EV_SYN && data->code == SYN_MT_REPORT && m_lastEventType != EV_SYN) { - - // If there is no tracking id, one will be generated later. - // Until that use a temporary key. - int key = m_currentData.trackingId; - if (key == -1) - key = m_contacts.count(); - - m_contacts.insert(key, m_currentData); - m_currentData = Contact(); - - } else if (data->type == EV_SYN && data->code == SYN_REPORT) { - - // Ensure valid IDs even when the driver does not report ABS_MT_TRACKING_ID. - if (!m_contacts.isEmpty() && m_contacts.constBegin().value().trackingId == -1) - assignIds(); - - m_touchPoints.clear(); - Qt::TouchPointStates combinedStates; - QMutableHashIterator it(m_contacts); - while (it.hasNext()) { - it.next(); - QWindowSystemInterface::TouchPoint tp; - Contact &contact(it.value()); - tp.id = contact.trackingId; - tp.flags = contact.flags; - - int key = m_typeB ? it.key() : contact.trackingId; - if (m_lastContacts.contains(key)) { - const Contact &prev(m_lastContacts.value(key)); - if (contact.state == Qt::TouchPointReleased) { - // Copy over the previous values for released points, just in case. - contact.x = prev.x; - contact.y = prev.y; - contact.maj = prev.maj; - } else { - contact.state = (prev.x == contact.x && prev.y == contact.y) - ? Qt::TouchPointStationary : Qt::TouchPointMoved; - } - } - - // Avoid reporting a contact in released state more than once. - if (contact.state == Qt::TouchPointReleased - && !m_lastContacts.contains(key)) { - it.remove(); - continue; - } - - tp.state = contact.state; - combinedStates |= tp.state; - - // Store the HW coordinates for now, will be updated later. - tp.area = QRectF(0, 0, contact.maj, contact.maj); - tp.area.moveCenter(QPoint(contact.x, contact.y)); - tp.pressure = contact.pressure; - - // Get a normalized position in range 0..1. - tp.normalPosition = QPointF((contact.x - hw_range_x_min) / qreal(hw_range_x_max - hw_range_x_min), - (contact.y - hw_range_y_min) / qreal(hw_range_y_max - hw_range_y_min)); - - m_touchPoints.append(tp); - - if (contact.state == Qt::TouchPointReleased) - it.remove(); - } - - m_lastContacts = m_contacts; - if (!m_typeB) - m_contacts.clear(); - - if (!m_touchPoints.isEmpty() && combinedStates != Qt::TouchPointStationary) - reportPoints(); - } - - m_lastEventType = data->type; -} - -int QTouchScreenData::findClosestContact(const QHash &contacts, int x, int y, int *dist) -{ - int minDist = -1, id = -1; - for (QHash::const_iterator it = contacts.constBegin(), ite = contacts.constEnd(); - it != ite; ++it) { - const Contact &contact(it.value()); - int dx = x - contact.x; - int dy = y - contact.y; - int dist = dx * dx + dy * dy; - if (minDist == -1 || dist < minDist) { - minDist = dist; - id = contact.trackingId; - } - } - if (dist) - *dist = minDist; - return id; -} - -void QTouchScreenData::assignIds() -{ - QHash candidates = m_lastContacts, pending = m_contacts, newContacts; - int maxId = -1; - QHash::iterator it, ite, bestMatch; - while (!pending.isEmpty() && !candidates.isEmpty()) { - int bestDist = -1, bestId; - for (it = pending.begin(), ite = pending.end(); it != ite; ++it) { - int dist; - int id = findClosestContact(candidates, it->x, it->y, &dist); - if (id >= 0 && (bestDist == -1 || dist < bestDist)) { - bestDist = dist; - bestId = id; - bestMatch = it; - } - } - if (bestDist >= 0) { - bestMatch->trackingId = bestId; - newContacts.insert(bestId, *bestMatch); - candidates.remove(bestId); - pending.erase(bestMatch); - if (bestId > maxId) - maxId = bestId; - } - } - if (candidates.isEmpty()) { - for (it = pending.begin(), ite = pending.end(); it != ite; ++it) { - it->trackingId = ++maxId; - newContacts.insert(it->trackingId, *it); - } - } - m_contacts = newContacts; -} - -void QTouchScreenData::reportPoints() -{ - QRect winRect; - if (m_forceToActiveWindow) { - QWindow *win = QGuiApplication::focusWindow(); - if (!win) - return; - winRect = win->geometry(); - } else { - winRect = QGuiApplication::primaryScreen()->geometry(); - } - - const int hw_w = hw_range_x_max - hw_range_x_min; - const int hw_h = hw_range_y_max - hw_range_y_min; - - // Map the coordinates based on the normalized position. QPA expects 'area' - // to be in screen coordinates. - const int pointCount = m_touchPoints.count(); - for (int i = 0; i < pointCount; ++i) { - QWindowSystemInterface::TouchPoint &tp(m_touchPoints[i]); - - // Generate a screen position that is always inside the active window - // or the primary screen. - const qreal wx = winRect.left() + tp.normalPosition.x() * winRect.width(); - const qreal wy = winRect.top() + tp.normalPosition.y() * winRect.height(); - const qreal sizeRatio = (winRect.width() + winRect.height()) / qreal(hw_w + hw_h); - tp.area = QRectF(0, 0, tp.area.width() * sizeRatio, tp.area.height() * sizeRatio); - tp.area.moveCenter(QPointF(wx, wy)); - - // Calculate normalized pressure. - if (!hw_pressure_min && !hw_pressure_max) - tp.pressure = tp.state == Qt::TouchPointReleased ? 0 : 1; - else - tp.pressure = (tp.pressure - hw_pressure_min) / qreal(hw_pressure_max - hw_pressure_min); - } - - QWindowSystemInterface::handleTouchEvent(0, m_device, m_touchPoints); -} - - -QTouchScreenHandlerThread::QTouchScreenHandlerThread(const QString &spec) - : m_spec(spec), m_handler(0) -{ - start(); -} - -QTouchScreenHandlerThread::~QTouchScreenHandlerThread() -{ - quit(); - wait(); -} - -void QTouchScreenHandlerThread::run() -{ - m_handler = new QTouchScreenHandler(m_spec); - exec(); - delete m_handler; - m_handler = 0; -} - - -QT_END_NAMESPACE diff --git a/src/plugins/generic/evdevtouch/qevdevtouch.h b/src/plugins/generic/evdevtouch/qevdevtouch.h deleted file mode 100644 index 40ed9b2a91..0000000000 --- a/src/plugins/generic/evdevtouch/qevdevtouch.h +++ /dev/null @@ -1,98 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the plugins module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QEVDEVTOUCH_H -#define QEVDEVTOUCH_H - -#include -#include -#include -#include -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -class QSocketNotifier; -class QTouchScreenData; -#ifdef USE_MTDEV -struct mtdev; -#endif - -class QTouchScreenHandler : public QObject -{ - Q_OBJECT - -public: - QTouchScreenHandler(const QString &spec = QString(), QObject *parent = 0); - ~QTouchScreenHandler(); - -private slots: - void readData(); - -private: - QSocketNotifier *m_notify; - int m_fd; - QTouchScreenData *d; -#ifdef USE_MTDEV - mtdev *m_mtdev; -#endif -}; - -class QTouchScreenHandlerThread : public QThread -{ -public: - QTouchScreenHandlerThread(const QString &spec); - ~QTouchScreenHandlerThread(); - void run(); - QTouchScreenHandler *handler() { return m_handler; } - -private: - QString m_spec; - QTouchScreenHandler *m_handler; -}; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QEVDEVTOUCH_H -- cgit v1.2.3