Skip to content

Commit

Permalink
[connectionagent] delay setting tethering enabled after power on.
Browse files Browse the repository at this point in the history
This fixes the case when wifi needs to be powered on, and there are no
known services in range. For some reason, setting the technology to be
tethering enabled does not work until it is delayed.
  • Loading branch information
Lorn Potter committed Jun 12, 2014
1 parent 58a09a1 commit 47018f2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
19 changes: 15 additions & 4 deletions connd/qconnectionagent.cpp
Expand Up @@ -496,13 +496,16 @@ void QConnectionAgent::setup()
void QConnectionAgent::technologyPowerChanged(bool powered)
{
NetworkTechnology *tech = static_cast<NetworkTechnology *>(sender());
qDebug() << tech->name() << powered;
if (tech->type() != "wifi")
return;
qDebug() << tetheringWifiTech->name() << powered;

if (netman && tech->type() == "wifi" && powered && delayedTethering) {
tech->setTethering(true);
if (netman && powered && delayedTethering) {
// wifi tech might not be ready, so delay this
QTimer::singleShot(1000,this,SLOT(setWifiTetheringEnabled()));
}

if (!delayedTethering && tech->type() == "wifi") {
if (!delayedTethering) {
if (!powered) {
removeAllTypes("wifi"); //dont wait for connman, he's too slow at this
QString bestService = findBestConnectableService();
Expand Down Expand Up @@ -869,3 +872,11 @@ void QConnectionAgent::stopTethering()
}
Q_EMIT tetheringFinished(false);
}

void QConnectionAgent::setWifiTetheringEnabled()
{
if (tetheringWifiTech) {
qDebug() << "set tethering";
tetheringWifiTech->setTethering(delayedTethering);
}
}
1 change: 1 addition & 0 deletions connd/qconnectionagent.h
Expand Up @@ -145,6 +145,7 @@ private slots:
void servicesChanged();

void openConnectionDialog(const QString &type);
void setWifiTetheringEnabled();
};

#endif // QCONNECTIONAGENT_H

0 comments on commit 47018f2

Please sign in to comment.