Commit 9282bb86 authored by spiiroin's avatar spiiroin

[usb-moded-qt5] Handle usb mode changes separately from events. JB#42756

Usb-moded sends both events and mode change indications via the same
D-Bus signal. Updating the cached usb-mode based on events means the
value is not necessarily in sync with what a direct query would return.

Update usb-mode only on mode changes and forward events as QT signals.
Signed-off-by: spiiroin's avatarSimo Piiroinen <simo.piiroinen@jollamobile.com>
parent 6552e7e0
......@@ -447,9 +447,13 @@ void QUsbModed::onUnhideModeFinished(QDBusPendingCallWatcher* aCall)
void QUsbModed::onUsbStateChanged(QString aMode)
{
DEBUG_(aMode);
if (iPrivate->iCurrentMode != aMode) {
iPrivate->iCurrentMode = aMode;
Q_EMIT currentModeChanged();
if (isEvent(aMode)) {
Q_EMIT eventReceived(aMode);
} else {
if (iPrivate->iCurrentMode != aMode) {
iPrivate->iCurrentMode = aMode;
Q_EMIT currentModeChanged();
}
}
}
......
......@@ -74,6 +74,7 @@ Q_SIGNALS:
void supportedModesChanged();
void availableModesChanged();
void currentModeChanged();
void eventReceived(QString event);
void configModeChanged();
void usbStateError(QString error);
void hiddenModesChanged();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment