Disable tty keyboard in kms
Set QT_KMS_TTYKBD=1 to prevent this and keep vt switching, ctrl-c, input appearing on the tty, etc. working. Change-Id: I0071685205ae9e02536dcb71f6fef6495c48f8fb Reviewed-by: Jørgen Lind <jorgen.lind@nokia.com>
This commit is contained in:
parent
8cbd591c2b
commit
06e8682cb7
@ -21,7 +21,8 @@ SOURCES = main.cpp \
|
|||||||
qkmsnativeinterface.cpp \
|
qkmsnativeinterface.cpp \
|
||||||
qkmsudevlistener.cpp \
|
qkmsudevlistener.cpp \
|
||||||
qkmsudevhandler.cpp \
|
qkmsudevhandler.cpp \
|
||||||
qkmsudevdrmhandler.cpp
|
qkmsudevdrmhandler.cpp \
|
||||||
|
qkmsvthandler.cpp
|
||||||
HEADERS = qkmsintegration.h \
|
HEADERS = qkmsintegration.h \
|
||||||
qkmsscreen.h \
|
qkmsscreen.h \
|
||||||
qkmscontext.h \
|
qkmscontext.h \
|
||||||
@ -32,7 +33,8 @@ HEADERS = qkmsintegration.h \
|
|||||||
qkmsnativeinterface.h \
|
qkmsnativeinterface.h \
|
||||||
qkmsudevlistener.h \
|
qkmsudevlistener.h \
|
||||||
qkmsudevhandler.h \
|
qkmsudevhandler.h \
|
||||||
qkmsudevdrmhandler.h
|
qkmsudevdrmhandler.h \
|
||||||
|
qkmsvthandler.h
|
||||||
|
|
||||||
target.path += $$[QT_INSTALL_PLUGINS]/platforms
|
target.path += $$[QT_INSTALL_PLUGINS]/platforms
|
||||||
INSTALLS += target
|
INSTALLS += target
|
||||||
|
@ -48,6 +48,7 @@
|
|||||||
#include "qkmsnativeinterface.h"
|
#include "qkmsnativeinterface.h"
|
||||||
#include "qkmsudevlistener.h"
|
#include "qkmsudevlistener.h"
|
||||||
#include "qkmsudevdrmhandler.h"
|
#include "qkmsudevdrmhandler.h"
|
||||||
|
#include "qkmsvthandler.h"
|
||||||
|
|
||||||
#include <QtPlatformSupport/private/qgenericunixeventdispatcher_p.h>
|
#include <QtPlatformSupport/private/qgenericunixeventdispatcher_p.h>
|
||||||
#include <QtPlatformSupport/private/qgenericunixfontdatabase_p.h>
|
#include <QtPlatformSupport/private/qgenericunixfontdatabase_p.h>
|
||||||
@ -66,6 +67,7 @@ QKmsIntegration::QKmsIntegration()
|
|||||||
{
|
{
|
||||||
QGuiApplicationPrivate::instance()->setEventDispatcher(m_eventDispatcher);
|
QGuiApplicationPrivate::instance()->setEventDispatcher(m_eventDispatcher);
|
||||||
setenv("EGL_PLATFORM", "drm",1);
|
setenv("EGL_PLATFORM", "drm",1);
|
||||||
|
m_vtHandler = new QKmsVTHandler;
|
||||||
m_drmHandler = new QKmsUdevDRMHandler(this);
|
m_drmHandler = new QKmsUdevDRMHandler(this);
|
||||||
m_udevListener->addHandler(m_drmHandler);
|
m_udevListener->addHandler(m_drmHandler);
|
||||||
}
|
}
|
||||||
@ -80,6 +82,7 @@ QKmsIntegration::~QKmsIntegration()
|
|||||||
}
|
}
|
||||||
delete m_fontDatabase;
|
delete m_fontDatabase;
|
||||||
delete m_udevListener;
|
delete m_udevListener;
|
||||||
|
delete m_vtHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
QObject *QKmsIntegration::createDevice(const char *path)
|
QObject *QKmsIntegration::createDevice(const char *path)
|
||||||
|
@ -51,6 +51,7 @@ class QKmsScreen;
|
|||||||
class QKmsDevice;
|
class QKmsDevice;
|
||||||
class QKmsUdevListener;
|
class QKmsUdevListener;
|
||||||
class QKmsUdevDRMHandler;
|
class QKmsUdevDRMHandler;
|
||||||
|
class QKmsVTHandler;
|
||||||
|
|
||||||
class QKmsIntegration : public QPlatformIntegration
|
class QKmsIntegration : public QPlatformIntegration
|
||||||
{
|
{
|
||||||
@ -82,6 +83,7 @@ private:
|
|||||||
QPlatformNativeInterface *m_nativeInterface;
|
QPlatformNativeInterface *m_nativeInterface;
|
||||||
QKmsUdevListener *m_udevListener;
|
QKmsUdevListener *m_udevListener;
|
||||||
QKmsUdevDRMHandler *m_drmHandler;
|
QKmsUdevDRMHandler *m_drmHandler;
|
||||||
|
QKmsVTHandler *m_vtHandler;
|
||||||
};
|
};
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
77
src/plugins/platforms/kms/qkmsvthandler.cpp
Normal file
77
src/plugins/platforms/kms/qkmsvthandler.cpp
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
**
|
||||||
|
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||||
|
** Contact: http://www.qt-project.org/
|
||||||
|
**
|
||||||
|
** This file is part of the plugins 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 <qkmsvthandler.h>
|
||||||
|
#include <sys/ioctl.h>
|
||||||
|
#include <linux/vt.h>
|
||||||
|
#include <linux/kd.h>
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
|
#ifdef K_OFF
|
||||||
|
#define KBD_OFF_MODE K_OFF
|
||||||
|
#else
|
||||||
|
#define KBD_OFF_MODE K_RAW
|
||||||
|
#endif
|
||||||
|
|
||||||
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
QKmsVTHandler::QKmsVTHandler(QObject *parent)
|
||||||
|
: QObject(parent), m_tty(-1)
|
||||||
|
{
|
||||||
|
if (!isatty(0))
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_tty = 0;
|
||||||
|
|
||||||
|
ioctl(m_tty, KDGKBMODE, &m_oldKbdMode);
|
||||||
|
if (!qgetenv("QT_KMS_TTYKBD").toInt())
|
||||||
|
ioctl(m_tty, KDSKBMODE, KBD_OFF_MODE);
|
||||||
|
}
|
||||||
|
|
||||||
|
QKmsVTHandler::~QKmsVTHandler()
|
||||||
|
{
|
||||||
|
if (m_tty == -1)
|
||||||
|
return;
|
||||||
|
|
||||||
|
ioctl(m_tty, KDSKBMODE, m_oldKbdMode);
|
||||||
|
}
|
||||||
|
|
||||||
|
QT_END_NAMESPACE
|
64
src/plugins/platforms/kms/qkmsvthandler.h
Normal file
64
src/plugins/platforms/kms/qkmsvthandler.h
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
**
|
||||||
|
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||||
|
** Contact: http://www.qt-project.org/
|
||||||
|
**
|
||||||
|
** This file is part of the plugins 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 QKMSVTHANDLER_H
|
||||||
|
#define QKMSVTHANDLER_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
|
||||||
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
class QKmsVTHandler : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
QKmsVTHandler(QObject *parent = 0);
|
||||||
|
~QKmsVTHandler();
|
||||||
|
|
||||||
|
private:
|
||||||
|
int m_tty;
|
||||||
|
int m_oldKbdMode;
|
||||||
|
};
|
||||||
|
|
||||||
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
|
#endif
|
Loading…
x
Reference in New Issue
Block a user