44 #ifndef QT_NO_QWS_KEYBOARD 46 #include <QSocketNotifier> 47 #include <QStringList> 49 #include <qplatformdefs.h> 50 #include <private/qcore_unix_p.h> 56 #include <linux/input.h> 99 : m_handler(h), m_fd(-1), m_tty_fd(-1), m_orig_kbmode(K_XLATE)
104 int repeat_delay = -1;
105 int repeat_rate = -1;
109 foreach (
const QString &arg, args) {
122 ::ioctl(
m_fd, EVIOCGRAB, grab);
123 if (repeat_delay > 0 && repeat_rate > 0) {
124 int kbdrep[2] = { repeat_delay, repeat_rate };
125 ::ioctl(
m_fd, EVIOCSREP, kbdrep);
139 struct ::termios termdata;
148 ::ioctl(
m_tty_fd, KDSKBMODE, K_MEDIUMRAW);
151 termdata.c_iflag = (IGNPAR | IGNBRK) & (~PARMRK) & (~ISTRIP);
152 termdata.c_oflag = 0;
153 termdata.c_cflag = CREAD | CS8;
154 termdata.c_lflag = 0;
155 termdata.c_cc[VTIME]=0;
156 termdata.c_cc[VMIN]=1;
157 cfsetispeed(&termdata, 9600);
158 cfsetospeed(&termdata, 9600);
159 tcsetattr(
m_tty_fd, TCSANOW, &termdata);
179 struct ::input_event led_ie;
180 ::gettimeofday(&led_ie.time, 0);
181 led_ie.type = EV_LED;
183 led_ie.value = state;
190 struct ::input_event buffer[32];
194 n =
QT_READ(
m_fd, reinterpret_cast<char *>(buffer) + n,
sizeof(buffer) - n);
197 qWarning(
"Got EOF from the input device.");
199 }
else if (n < 0 && (
errno != EINTR &&
errno != EAGAIN)) {
200 qWarning(
"Could not read from input device: %s", strerror(
errno));
202 }
else if (n %
sizeof(buffer[0]) == 0) {
207 n /=
sizeof(buffer[0]);
209 for (
int i = 0; i < n; ++i) {
210 if (buffer[i].
type != EV_KEY)
214 qint32 value = buffer[i].value;
247 #include "qkbdlinuxinput_qws.moc" 249 #endif // QT_NO_QWS_KEYBOARD The QWSKeyboardHandler class is a base class for keyboard drivers in Qt for Embedded Linux...
#define QT_END_NAMESPACE
This macro expands to.
int toInt(bool *ok=0, int base=10) const
Returns the string converted to an int using base base, which is 10 by default and must be between 2 ...
bool startsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string starts with s; otherwise returns false.
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
The QString class provides a Unicode character string.
The QObject class is the base class of all Qt objects.
The QSocketNotifier class provides support for monitoring activity on a file descriptor.
void setObjectName(const QString &name)
#define QT_BEGIN_NAMESPACE
This macro expands to.
static bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
Creates a connection of the given type from the signal in the sender object to the method in the rece...
The QStringList class provides a list of strings.
Q_CORE_EXPORT void qWarning(const char *,...)
The QLatin1String class provides a thin wrapper around an US-ASCII/Latin-1 encoded string literal...
KeycodeAction
This enum describes the various special actions that actual QWSKeyboardHandler implementations have t...
QByteArray toLocal8Bit() const Q_REQUIRED_RESULT
Returns the local 8-bit representation of the string as a QByteArray.
const char * constData() const
Returns a pointer to the data stored in the byte array.
QString mid(int position, int n=-1) const Q_REQUIRED_RESULT
Returns a string that contains n characters of this string, starting at the specified position index...
QStringList split(const QString &sep, SplitBehavior behavior=KeepEmptyParts, Qt::CaseSensitivity cs=Qt::CaseSensitive) const Q_REQUIRED_RESULT
Splits the string into substrings wherever sep occurs, and returns the list of those strings...
#define qPrintable(string)
KeycodeAction processKeycode(quint16 keycode, bool pressed, bool autorepeat)
Maps keycode according to a keymap and sends that key event to the Qt for Embedded Linux server appli...
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
#define forever
This macro is provided for convenience for writing infinite loops.