Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[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: Simo Piiroinen <simo.piiroinen@jollamobile.com>
  • Loading branch information
spiiroin committed Aug 31, 2018
1 parent 6552e7e commit 9282bb8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/qusbmoded.cpp
Expand Up @@ -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();
}
}
}

Expand Down
1 change: 1 addition & 0 deletions src/qusbmoded.h
Expand Up @@ -74,6 +74,7 @@ public Q_SLOTS:
void supportedModesChanged();
void availableModesChanged();
void currentModeChanged();
void eventReceived(QString event);
void configModeChanged();
void usbStateError(QString error);
void hiddenModesChanged();
Expand Down

0 comments on commit 9282bb8

Please sign in to comment.