QEvdev: use printf-style qCDebug()/qWarning()
Also use qUtf16Printable() and qErrnoWarning (removing explicit errno, where present). Saves 6.6KiB in text size on optimized Linux AMD64 GCC 9.1 build across all .so's that link to QtInputSupport.a. Change-Id: I1def2cfabd2eed65390099cd1d06f8061a9355be Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This commit is contained in:
parent
c6a3507de2
commit
0ad5e16268
@ -102,7 +102,8 @@ QEvdevKeyboardHandler *QEvdevKeyboardHandler::create(const QString &device,
|
||||
const QString &specification,
|
||||
const QString &defaultKeymapFile)
|
||||
{
|
||||
qCDebug(qLcEvdevKey) << "Try to create keyboard handler for" << device << specification;
|
||||
qCDebug(qLcEvdevKey, "Try to create keyboard handler for \"%ls\" \"%ls\"",
|
||||
qUtf16Printable(device), qUtf16Printable(specification));
|
||||
|
||||
QString keymapFile = defaultKeymapFile;
|
||||
int repeatDelay = 400;
|
||||
@ -127,7 +128,7 @@ QEvdevKeyboardHandler *QEvdevKeyboardHandler::create(const QString &device,
|
||||
grab = arg.mid(5).toInt();
|
||||
}
|
||||
|
||||
qCDebug(qLcEvdevKey) << "Opening keyboard at" << device;
|
||||
qCDebug(qLcEvdevKey, "Opening keyboard at %ls", qUtf16Printable(device));
|
||||
|
||||
QFdContainer fd(qt_safe_open(device.toLocal8Bit().constData(), O_RDONLY | O_NDELAY, 0));
|
||||
if (fd.get() >= 0) {
|
||||
@ -139,14 +140,14 @@ QEvdevKeyboardHandler *QEvdevKeyboardHandler::create(const QString &device,
|
||||
|
||||
return new QEvdevKeyboardHandler(device, fd, disableZap, enableCompose, keymapFile);
|
||||
} else {
|
||||
qWarning("Cannot open keyboard input device '%s': %s", qPrintable(device), strerror(errno));
|
||||
qErrnoWarning("Cannot open keyboard input device '%ls'", qUtf16Printable(device));
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
void QEvdevKeyboardHandler::switchLed(int led, bool state)
|
||||
{
|
||||
qCDebug(qLcEvdevKey) << "switchLed" << led << state;
|
||||
qCDebug(qLcEvdevKey, "switchLed %d %d", led, int(state));
|
||||
|
||||
struct ::input_event led_ie;
|
||||
::gettimeofday(&led_ie.time, 0);
|
||||
@ -170,7 +171,7 @@ void QEvdevKeyboardHandler::readKeycode()
|
||||
return;
|
||||
} else if (result < 0) {
|
||||
if (errno != EINTR && errno != EAGAIN) {
|
||||
qErrnoWarning(errno, "evdevkeyboard: Could not read from input device");
|
||||
qErrnoWarning("evdevkeyboard: Could not read from input device");
|
||||
// If the device got disconnected, stop reading, otherwise we get flooded
|
||||
// by the above error over and over again.
|
||||
if (errno == ENODEV) {
|
||||
@ -473,7 +474,7 @@ QEvdevKeyboardHandler::KeycodeAction QEvdevKeyboardHandler::processKeycode(quint
|
||||
|
||||
void QEvdevKeyboardHandler::unloadKeymap()
|
||||
{
|
||||
qCDebug(qLcEvdevKey) << "Unload current keymap and restore built-in";
|
||||
qCDebug(qLcEvdevKey, "Unload current keymap and restore built-in");
|
||||
|
||||
if (m_keymap && m_keymap != s_keymap_default)
|
||||
delete [] m_keymap;
|
||||
@ -517,12 +518,12 @@ void QEvdevKeyboardHandler::unloadKeymap()
|
||||
|
||||
bool QEvdevKeyboardHandler::loadKeymap(const QString &file)
|
||||
{
|
||||
qCDebug(qLcEvdevKey) << "Loading keymap" << file;
|
||||
qCDebug(qLcEvdevKey, "Loading keymap %ls", qUtf16Printable(file));
|
||||
|
||||
QFile f(file);
|
||||
|
||||
if (!f.open(QIODevice::ReadOnly)) {
|
||||
qWarning("Could not open keymap file '%s'", qPrintable(file));
|
||||
qWarning("Could not open keymap file '%ls'", qUtf16Printable(file));
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -541,7 +542,7 @@ bool QEvdevKeyboardHandler::loadKeymap(const QString &file)
|
||||
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 not a valid .qmap keymap file", qPrintable(file));
|
||||
qWarning("'%ls' is not a valid .qmap keymap file", qUtf16Printable(file));
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -557,7 +558,7 @@ bool QEvdevKeyboardHandler::loadKeymap(const QString &file)
|
||||
delete [] qmap_keymap;
|
||||
delete [] qmap_keycompose;
|
||||
|
||||
qWarning("Keymap file '%s' cannot be loaded.", qPrintable(file));
|
||||
qWarning("Keymap file '%ls' cannot be loaded.", qUtf16Printable(file));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -80,7 +80,7 @@ QEvdevKeyboardManager::QEvdevKeyboardManager(const QString &key, const QString &
|
||||
addKeyboard(device);
|
||||
|
||||
if (devices.isEmpty()) {
|
||||
qCDebug(qLcEvdevKey) << "evdevkeyboard: Using device discovery";
|
||||
qCDebug(qLcEvdevKey, "evdevkeyboard: Using device discovery");
|
||||
m_deviceDiscovery = QDeviceDiscovery::create(QDeviceDiscovery::Device_Keyboard, this);
|
||||
if (m_deviceDiscovery) {
|
||||
// scan and add already connected keyboards
|
||||
@ -104,7 +104,7 @@ QEvdevKeyboardManager::~QEvdevKeyboardManager()
|
||||
|
||||
void QEvdevKeyboardManager::addKeyboard(const QString &deviceNode)
|
||||
{
|
||||
qCDebug(qLcEvdevKey) << "Adding keyboard at" << deviceNode;
|
||||
qCDebug(qLcEvdevKey, "Adding keyboard at %ls", qUtf16Printable(deviceNode));
|
||||
QEvdevKeyboardHandler *keyboard;
|
||||
keyboard = QEvdevKeyboardHandler::create(deviceNode, m_spec, m_defaultKeymapFile);
|
||||
if (keyboard) {
|
||||
@ -112,14 +112,14 @@ void QEvdevKeyboardManager::addKeyboard(const QString &deviceNode)
|
||||
QInputDeviceManagerPrivate::get(QGuiApplicationPrivate::inputDeviceManager())->setDeviceCount(
|
||||
QInputDeviceManager::DeviceTypeKeyboard, m_keyboards.count());
|
||||
} else {
|
||||
qWarning("Failed to open keyboard device %s", qPrintable(deviceNode));
|
||||
qWarning("Failed to open keyboard device %ls", qUtf16Printable(deviceNode));
|
||||
}
|
||||
}
|
||||
|
||||
void QEvdevKeyboardManager::removeKeyboard(const QString &deviceNode)
|
||||
{
|
||||
if (m_keyboards.contains(deviceNode)) {
|
||||
qCDebug(qLcEvdevKey) << "Removing keyboard at" << deviceNode;
|
||||
qCDebug(qLcEvdevKey, "Removing keyboard at %ls", qUtf16Printable(deviceNode));
|
||||
QEvdevKeyboardHandler *keyboard = m_keyboards.value(deviceNode);
|
||||
m_keyboards.remove(deviceNode);
|
||||
QInputDeviceManagerPrivate::get(QGuiApplicationPrivate::inputDeviceManager())->setDeviceCount(
|
||||
|
@ -86,7 +86,7 @@ QEvdevMouseManager::QEvdevMouseManager(const QString &key, const QString &specif
|
||||
addMouse(device);
|
||||
|
||||
if (devices.isEmpty()) {
|
||||
qCDebug(qLcEvdevMouse) << "evdevmouse: Using device discovery";
|
||||
qCDebug(qLcEvdevMouse, "evdevmouse: Using device discovery");
|
||||
m_deviceDiscovery = QDeviceDiscovery::create(QDeviceDiscovery::Device_Mouse | QDeviceDiscovery::Device_Touchpad, this);
|
||||
if (m_deviceDiscovery) {
|
||||
// scan and add already connected keyboards
|
||||
@ -159,7 +159,7 @@ void QEvdevMouseManager::handleWheelEvent(QPoint delta)
|
||||
|
||||
void QEvdevMouseManager::addMouse(const QString &deviceNode)
|
||||
{
|
||||
qCDebug(qLcEvdevMouse) << "Adding mouse at" << deviceNode;
|
||||
qCDebug(qLcEvdevMouse, "Adding mouse at %ls", qUtf16Printable(deviceNode));
|
||||
QEvdevMouseHandler *handler = QEvdevMouseHandler::create(deviceNode, m_spec);
|
||||
if (handler) {
|
||||
connect(handler, &QEvdevMouseHandler::handleMouseEvent,
|
||||
@ -170,14 +170,14 @@ void QEvdevMouseManager::addMouse(const QString &deviceNode)
|
||||
QInputDeviceManagerPrivate::get(QGuiApplicationPrivate::inputDeviceManager())->setDeviceCount(
|
||||
QInputDeviceManager::DeviceTypePointer, m_mice.count());
|
||||
} else {
|
||||
qWarning("evdevmouse: Failed to open mouse device %s", qPrintable(deviceNode));
|
||||
qWarning("evdevmouse: Failed to open mouse device %ls", qUtf16Printable(deviceNode));
|
||||
}
|
||||
}
|
||||
|
||||
void QEvdevMouseManager::removeMouse(const QString &deviceNode)
|
||||
{
|
||||
if (m_mice.contains(deviceNode)) {
|
||||
qCDebug(qLcEvdevMouse) << "Removing mouse at" << deviceNode;
|
||||
qCDebug(qLcEvdevMouse, "Removing mouse at %ls", qUtf16Printable(deviceNode));
|
||||
QEvdevMouseHandler *handler = m_mice.value(deviceNode);
|
||||
m_mice.remove(deviceNode);
|
||||
QInputDeviceManagerPrivate::get(QGuiApplicationPrivate::inputDeviceManager())->setDeviceCount(
|
||||
|
@ -172,11 +172,11 @@ QEvdevTabletHandler::QEvdevTabletHandler(const QString &device, const QString &s
|
||||
|
||||
setObjectName(QLatin1String("Evdev Tablet Handler"));
|
||||
|
||||
qCDebug(qLcEvdevTablet, "evdevtablet: using %s", qPrintable(device));
|
||||
qCDebug(qLcEvdevTablet, "evdevtablet: using %ls", qUtf16Printable(device));
|
||||
|
||||
m_fd = QT_OPEN(device.toLocal8Bit().constData(), O_RDONLY | O_NDELAY, 0);
|
||||
if (m_fd < 0) {
|
||||
qErrnoWarning(errno, "evdevtablet: Cannot open input device %s", qPrintable(device));
|
||||
qErrnoWarning("evdevtablet: Cannot open input device %ls", qUtf16Printable(device));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -184,11 +184,11 @@ QEvdevTabletHandler::QEvdevTabletHandler(const QString &device, const QString &s
|
||||
if (grabSuccess)
|
||||
ioctl(m_fd, EVIOCGRAB, (void *) 0);
|
||||
else
|
||||
qWarning("evdevtablet: %s: The device is grabbed by another process. No events will be read.", qPrintable(device));
|
||||
qWarning("evdevtablet: %ls: The device is grabbed by another process. No events will be read.", qUtf16Printable(device));
|
||||
|
||||
d = new QEvdevTabletData(this);
|
||||
if (!queryLimits())
|
||||
qWarning("evdevtablet: %s: Unset or invalid ABS limits. Behavior will be unspecified.", qPrintable(device));
|
||||
qWarning("evdevtablet: %ls: Unset or invalid ABS limits. Behavior will be unspecified.", qUtf16Printable(device));
|
||||
|
||||
m_notifier = new QSocketNotifier(m_fd, QSocketNotifier::Read, this);
|
||||
connect(m_notifier, &QSocketNotifier::activated, this, &QEvdevTabletHandler::readData);
|
||||
@ -216,32 +216,32 @@ bool QEvdevTabletHandler::queryLimits()
|
||||
if (ok) {
|
||||
d->minValues.x = absInfo.minimum;
|
||||
d->maxValues.x = absInfo.maximum;
|
||||
qCDebug(qLcEvdevTablet, "evdevtablet: %s: min X: %d max X: %d", qPrintable(m_device),
|
||||
qCDebug(qLcEvdevTablet, "evdevtablet: %ls: min X: %d max X: %d", qUtf16Printable(m_device),
|
||||
d->minValues.x, d->maxValues.x);
|
||||
}
|
||||
ok &= ioctl(m_fd, EVIOCGABS(ABS_Y), &absInfo) >= 0;
|
||||
if (ok) {
|
||||
d->minValues.y = absInfo.minimum;
|
||||
d->maxValues.y = absInfo.maximum;
|
||||
qCDebug(qLcEvdevTablet, "evdevtablet: %s: min Y: %d max Y: %d", qPrintable(m_device),
|
||||
qCDebug(qLcEvdevTablet, "evdevtablet: %ls: min Y: %d max Y: %d", qUtf16Printable(m_device),
|
||||
d->minValues.y, d->maxValues.y);
|
||||
}
|
||||
if (ioctl(m_fd, EVIOCGABS(ABS_PRESSURE), &absInfo) >= 0) {
|
||||
d->minValues.p = absInfo.minimum;
|
||||
d->maxValues.p = absInfo.maximum;
|
||||
qCDebug(qLcEvdevTablet, "evdevtablet: %s: min pressure: %d max pressure: %d", qPrintable(m_device),
|
||||
qCDebug(qLcEvdevTablet, "evdevtablet: %ls: min pressure: %d max pressure: %d", qUtf16Printable(m_device),
|
||||
d->minValues.p, d->maxValues.p);
|
||||
}
|
||||
if (ioctl(m_fd, EVIOCGABS(ABS_DISTANCE), &absInfo) >= 0) {
|
||||
d->minValues.d = absInfo.minimum;
|
||||
d->maxValues.d = absInfo.maximum;
|
||||
qCDebug(qLcEvdevTablet, "evdevtablet: %s: min distance: %d max distance: %d", qPrintable(m_device),
|
||||
qCDebug(qLcEvdevTablet, "evdevtablet: %ls: min distance: %d max distance: %d", qUtf16Printable(m_device),
|
||||
d->minValues.d, d->maxValues.d);
|
||||
}
|
||||
char name[128];
|
||||
if (ioctl(m_fd, EVIOCGNAME(sizeof(name) - 1), name) >= 0) {
|
||||
d->devName = QString::fromLocal8Bit(name);
|
||||
qCDebug(qLcEvdevTablet, "evdevtablet: %s: device name: %s", qPrintable(m_device), name);
|
||||
qCDebug(qLcEvdevTablet, "evdevtablet: %ls: device name: %s", qUtf16Printable(m_device), name);
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
@ -253,11 +253,11 @@ void QEvdevTabletHandler::readData()
|
||||
for (; ;) {
|
||||
int result = QT_READ(m_fd, reinterpret_cast<char*>(buffer) + n, sizeof(buffer) - n);
|
||||
if (!result) {
|
||||
qWarning("evdevtablet: %s: Got EOF from input device", qPrintable(m_device));
|
||||
qWarning("evdevtablet: %ls: Got EOF from input device", qUtf16Printable(m_device));
|
||||
return;
|
||||
} else if (result < 0) {
|
||||
if (errno != EINTR && errno != EAGAIN) {
|
||||
qErrnoWarning(errno, "evdevtablet: %s: Could not read from input device", qPrintable(m_device));
|
||||
qErrnoWarning("evdevtablet: %ls: Could not read from input device", qUtf16Printable(m_device));
|
||||
if (errno == ENODEV) { // device got disconnected -> stop reading
|
||||
delete m_notifier;
|
||||
m_notifier = 0;
|
||||
|
@ -82,7 +82,7 @@ QEvdevTabletManager::QEvdevTabletManager(const QString &key, const QString &spec
|
||||
|
||||
// when no devices specified, use device discovery to scan and monitor
|
||||
if (devices.isEmpty()) {
|
||||
qCDebug(qLcEvdevTablet) << "evdevtablet: Using device discovery";
|
||||
qCDebug(qLcEvdevTablet, "evdevtablet: Using device discovery");
|
||||
m_deviceDiscovery = QDeviceDiscovery::create(QDeviceDiscovery::Device_Tablet, this);
|
||||
if (m_deviceDiscovery) {
|
||||
const QStringList devices = m_deviceDiscovery->scanConnectedDevices();
|
||||
@ -104,7 +104,7 @@ QEvdevTabletManager::~QEvdevTabletManager()
|
||||
|
||||
void QEvdevTabletManager::addDevice(const QString &deviceNode)
|
||||
{
|
||||
qCDebug(qLcEvdevTablet) << "Adding device at" << deviceNode;
|
||||
qCDebug(qLcEvdevTablet, "Adding device at %ls", qUtf16Printable(deviceNode));
|
||||
QEvdevTabletHandlerThread *handler;
|
||||
handler = new QEvdevTabletHandlerThread(deviceNode, m_spec);
|
||||
if (handler) {
|
||||
@ -112,14 +112,14 @@ void QEvdevTabletManager::addDevice(const QString &deviceNode)
|
||||
QInputDeviceManagerPrivate::get(QGuiApplicationPrivate::inputDeviceManager())->setDeviceCount(
|
||||
QInputDeviceManager::DeviceTypeTablet, m_activeDevices.count());
|
||||
} else {
|
||||
qWarning("evdevtablet: Failed to open tablet device %s", qPrintable(deviceNode));
|
||||
qWarning("evdevtablet: Failed to open tablet device %ls", qUtf16Printable(deviceNode));
|
||||
}
|
||||
}
|
||||
|
||||
void QEvdevTabletManager::removeDevice(const QString &deviceNode)
|
||||
{
|
||||
if (m_activeDevices.contains(deviceNode)) {
|
||||
qCDebug(qLcEvdevTablet) << "Removing device at" << deviceNode;
|
||||
qCDebug(qLcEvdevTablet, "Removing device at %ls", qUtf16Printable(deviceNode));
|
||||
QEvdevTabletHandlerThread *handler = m_activeDevices.value(deviceNode);
|
||||
m_activeDevices.remove(deviceNode);
|
||||
QInputDeviceManagerPrivate::get(QGuiApplicationPrivate::inputDeviceManager())->setDeviceCount(
|
||||
|
@ -228,7 +228,7 @@ QEvdevTouchScreenHandler::QEvdevTouchScreenHandler(const QString &device, const
|
||||
}
|
||||
}
|
||||
|
||||
qCDebug(qLcEvdevTouch, "evdevtouch: Using device %s", qPrintable(device));
|
||||
qCDebug(qLcEvdevTouch, "evdevtouch: Using device %ls", qUtf16Printable(device));
|
||||
|
||||
m_fd = QT_OPEN(device.toLocal8Bit().constData(), O_RDONLY | O_NDELAY, 0);
|
||||
|
||||
@ -236,7 +236,7 @@ QEvdevTouchScreenHandler::QEvdevTouchScreenHandler(const QString &device, const
|
||||
m_notify = new QSocketNotifier(m_fd, QSocketNotifier::Read, this);
|
||||
connect(m_notify, &QSocketNotifier::activated, this, &QEvdevTouchScreenHandler::readData);
|
||||
} else {
|
||||
qErrnoWarning(errno, "evdevtouch: Cannot open input device %s", qPrintable(device));
|
||||
qErrnoWarning("evdevtouch: Cannot open input device %ls", qUtf16Printable(device));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -266,8 +266,8 @@ QEvdevTouchScreenHandler::QEvdevTouchScreenHandler(const QString &device, const
|
||||
|
||||
d->deviceNode = device;
|
||||
qCDebug(qLcEvdevTouch,
|
||||
"evdevtouch: %s: Protocol type %c %s (%s), filtered=%s",
|
||||
qPrintable(d->deviceNode),
|
||||
"evdevtouch: %ls: Protocol type %c %s (%s), filtered=%s",
|
||||
qUtf16Printable(d->deviceNode),
|
||||
d->m_typeB ? 'B' : 'A', mtdevStr,
|
||||
d->m_singleTouch ? "single" : "multi",
|
||||
d->m_filtered ? "yes" : "no");
|
||||
@ -279,7 +279,7 @@ QEvdevTouchScreenHandler::QEvdevTouchScreenHandler(const QString &device, const
|
||||
bool has_x_range = false, has_y_range = false;
|
||||
|
||||
if (ioctl(m_fd, EVIOCGABS((d->m_singleTouch ? ABS_X : ABS_MT_POSITION_X)), &absInfo) >= 0) {
|
||||
qCDebug(qLcEvdevTouch, "evdevtouch: %s: min X: %d max X: %d", qPrintable(device),
|
||||
qCDebug(qLcEvdevTouch, "evdevtouch: %ls: min X: %d max X: %d", qUtf16Printable(device),
|
||||
absInfo.minimum, absInfo.maximum);
|
||||
d->hw_range_x_min = absInfo.minimum;
|
||||
d->hw_range_x_max = absInfo.maximum;
|
||||
@ -287,7 +287,7 @@ QEvdevTouchScreenHandler::QEvdevTouchScreenHandler(const QString &device, const
|
||||
}
|
||||
|
||||
if (ioctl(m_fd, EVIOCGABS((d->m_singleTouch ? ABS_Y : ABS_MT_POSITION_Y)), &absInfo) >= 0) {
|
||||
qCDebug(qLcEvdevTouch, "evdevtouch: %s: min Y: %d max Y: %d", qPrintable(device),
|
||||
qCDebug(qLcEvdevTouch, "evdevtouch: %ls: min Y: %d max Y: %d", qUtf16Printable(device),
|
||||
absInfo.minimum, absInfo.maximum);
|
||||
d->hw_range_y_min = absInfo.minimum;
|
||||
d->hw_range_y_max = absInfo.maximum;
|
||||
@ -295,10 +295,10 @@ QEvdevTouchScreenHandler::QEvdevTouchScreenHandler(const QString &device, const
|
||||
}
|
||||
|
||||
if (!has_x_range || !has_y_range)
|
||||
qWarning("evdevtouch: %s: Invalid ABS limits, behavior unspecified", qPrintable(device));
|
||||
qWarning("evdevtouch: %ls: Invalid ABS limits, behavior unspecified", qUtf16Printable(device));
|
||||
|
||||
if (ioctl(m_fd, EVIOCGABS(ABS_PRESSURE), &absInfo) >= 0) {
|
||||
qCDebug(qLcEvdevTouch, "evdevtouch: %s: min pressure: %d max pressure: %d", qPrintable(device),
|
||||
qCDebug(qLcEvdevTouch, "evdevtouch: %ls: min pressure: %d max pressure: %d", qUtf16Printable(device),
|
||||
absInfo.minimum, absInfo.maximum);
|
||||
if (absInfo.maximum > absInfo.minimum) {
|
||||
d->hw_pressure_min = absInfo.minimum;
|
||||
@ -309,7 +309,7 @@ QEvdevTouchScreenHandler::QEvdevTouchScreenHandler(const QString &device, const
|
||||
char name[1024];
|
||||
if (ioctl(m_fd, EVIOCGNAME(sizeof(name) - 1), name) >= 0) {
|
||||
d->hw_name = QString::fromLocal8Bit(name);
|
||||
qCDebug(qLcEvdevTouch, "evdevtouch: %s: device name: %s", qPrintable(device), name);
|
||||
qCDebug(qLcEvdevTouch, "evdevtouch: %ls: device name: %s", qUtf16Printable(device), name);
|
||||
}
|
||||
|
||||
// Fix up the coordinate ranges for am335x in case the kernel driver does not have them fixed.
|
||||
@ -345,8 +345,8 @@ QEvdevTouchScreenHandler::QEvdevTouchScreenHandler(const QString &device, const
|
||||
if (mapping.load()) {
|
||||
d->m_screenName = mapping.screenNameForDeviceNode(d->deviceNode);
|
||||
if (!d->m_screenName.isEmpty())
|
||||
qCDebug(qLcEvdevTouch, "evdevtouch: Mapping device %s to screen %s",
|
||||
qPrintable(d->deviceNode), qPrintable(d->m_screenName));
|
||||
qCDebug(qLcEvdevTouch, "evdevtouch: Mapping device %ls to screen %ls",
|
||||
qUtf16Printable(d->deviceNode), qUtf16Printable(d->m_screenName));
|
||||
}
|
||||
|
||||
registerTouchDevice();
|
||||
@ -427,7 +427,7 @@ err:
|
||||
return;
|
||||
} else if (events < 0) {
|
||||
if (errno != EINTR && errno != EAGAIN) {
|
||||
qErrnoWarning(errno, "evdevtouch: Could not read from input device");
|
||||
qErrnoWarning("evdevtouch: Could not read from input device");
|
||||
if (errno == ENODEV) { // device got disconnected -> stop reading
|
||||
delete m_notify;
|
||||
m_notify = nullptr;
|
||||
|
@ -82,7 +82,7 @@ QEvdevTouchManager::QEvdevTouchManager(const QString &key, const QString &specif
|
||||
|
||||
// when no devices specified, use device discovery to scan and monitor
|
||||
if (devices.isEmpty()) {
|
||||
qCDebug(qLcEvdevTouch) << "evdevtouch: Using device discovery";
|
||||
qCDebug(qLcEvdevTouch, "evdevtouch: Using device discovery");
|
||||
m_deviceDiscovery = QDeviceDiscovery::create(QDeviceDiscovery::Device_Touchpad | QDeviceDiscovery::Device_Touchscreen, this);
|
||||
if (m_deviceDiscovery) {
|
||||
const QStringList devices = m_deviceDiscovery->scanConnectedDevices();
|
||||
@ -104,21 +104,21 @@ QEvdevTouchManager::~QEvdevTouchManager()
|
||||
|
||||
void QEvdevTouchManager::addDevice(const QString &deviceNode)
|
||||
{
|
||||
qCDebug(qLcEvdevTouch) << "evdevtouch: Adding device at" << deviceNode;
|
||||
qCDebug(qLcEvdevTouch, "evdevtouch: Adding device at %ls", qUtf16Printable(deviceNode));
|
||||
QEvdevTouchScreenHandlerThread *handler;
|
||||
handler = new QEvdevTouchScreenHandlerThread(deviceNode, m_spec);
|
||||
if (handler) {
|
||||
m_activeDevices.insert(deviceNode, handler);
|
||||
connect(handler, &QEvdevTouchScreenHandlerThread::touchDeviceRegistered, this, &QEvdevTouchManager::updateInputDeviceCount);
|
||||
} else {
|
||||
qWarning("evdevtouch: Failed to open touch device %s", qPrintable(deviceNode));
|
||||
qWarning("evdevtouch: Failed to open touch device %ls", qUtf16Printable(deviceNode));
|
||||
}
|
||||
}
|
||||
|
||||
void QEvdevTouchManager::removeDevice(const QString &deviceNode)
|
||||
{
|
||||
if (m_activeDevices.contains(deviceNode)) {
|
||||
qCDebug(qLcEvdevTouch) << "evdevtouch: Removing device at" << deviceNode;
|
||||
qCDebug(qLcEvdevTouch, "evdevtouch: Removing device at %ls", qUtf16Printable(deviceNode));
|
||||
QEvdevTouchScreenHandlerThread *handler = m_activeDevices.value(deviceNode);
|
||||
m_activeDevices.remove(deviceNode);
|
||||
delete handler;
|
||||
@ -135,8 +135,8 @@ void QEvdevTouchManager::updateInputDeviceCount()
|
||||
++registeredTouchDevices;
|
||||
}
|
||||
|
||||
qCDebug(qLcEvdevTouch) << "evdevtouch: Updating QInputDeviceManager device count:" << registeredTouchDevices << " touch devices,"
|
||||
<< m_activeDevices.count() - registeredTouchDevices << "pending handler(s)" ;
|
||||
qCDebug(qLcEvdevTouch, "evdevtouch: Updating QInputDeviceManager device count: %d touch devices, %d pending handler(s)",
|
||||
registeredTouchDevices, m_activeDevices.count() - registeredTouchDevices);
|
||||
|
||||
QInputDeviceManagerPrivate::get(QGuiApplicationPrivate::inputDeviceManager())->setDeviceCount(
|
||||
QInputDeviceManager::DeviceTypeTouch, registeredTouchDevices);
|
||||
|
Loading…
Reference in New Issue
Block a user