Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge branch 'master' into 'master'
[maliit] Guard all udev usage with ifndef HAVE_CONTEXTSUBSCRIBER. Contributes to JB#34869.

If HAVE_CONTEXTSUBSCRIBER is enabled, the udev codepaths are never used
(detectEvdev is not called). However, we still used udev code in the binary
(udev_ types and functions), which was incorrect because we don't link udev in
this case.

This went undetected until we enabled linking with -Wl,--as-needed, when it
broke.

See merge request !1
  • Loading branch information
pvuorela committed May 6, 2016
2 parents 15f0927 + 3d7f646 commit f54efac
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion maliit-framework/src/mimhwkeyboardtracker.cpp
Expand Up @@ -69,6 +69,7 @@ MImHwKeyboardTrackerPrivate::MImHwKeyboardTrackerPrivate(MImHwKeyboardTracker *q

void MImHwKeyboardTrackerPrivate::detectEvdev()
{
#ifndef HAVE_CONTEXTSUBSCRIBER
// Use udev to enumerate all input devices, using evdev on each device to
// find the first device offering a SW_TABLET_MODE switch. If found, this
// switch is used to determine keyboard presence.
Expand Down Expand Up @@ -106,10 +107,12 @@ void MImHwKeyboardTrackerPrivate::detectEvdev()
}
udev_enumerate_unref(enumerate);
udev_unref(udev);
#endif
}

void MImHwKeyboardTrackerPrivate::evdevEvent()
{
#ifndef HAVE_CONTEXTSUBSCRIBER
// Parse the evdev event and look for SW_TABLET_MODE status.

struct input_event ev;
Expand All @@ -127,11 +130,14 @@ void MImHwKeyboardTrackerPrivate::evdevEvent()
evdevTabletModePending = -1;
Q_EMIT stateChanged();
}

#endif
}

void MImHwKeyboardTrackerPrivate::tryEvdevDevice(const char *device)
{
Q_UNUSED(device);

#ifndef HAVE_CONTEXTSUBSCRIBER
QFile *qfile = new QFile(this);
unsigned char evbits[BITS2BYTES(EV_MAX)];
int fd;
Expand Down Expand Up @@ -185,6 +191,7 @@ void MImHwKeyboardTrackerPrivate::tryEvdevDevice(const char *device)
return;

evdevTabletMode = TEST_BIT(SW_TABLET_MODE, state);
#endif
}

MImHwKeyboardTrackerPrivate::~MImHwKeyboardTrackerPrivate()
Expand Down

0 comments on commit f54efac

Please sign in to comment.