forked from dresden-elektronik/deconz-rest-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
firmware_update.cpp
640 lines (566 loc) · 19.9 KB
/
firmware_update.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
/*
* Copyright (c) 2016-2021 dresden elektronik ingenieurtechnik gmbh.
* All rights reserved.
*
* The software in this package is published under the terms of the BSD
* style license a copy of which has been included with this distribution in
* the LICENSE.txt file.
*
*/
#include <QApplication>
#include <QDesktopServices>
#include <QProcessEnvironment>
#include <QFile>
#include <QDir>
#include <QString>
#include <QProcess>
#ifdef Q_OS_LINUX
#include <unistd.h>
#endif
#include "de_web_plugin.h"
#include "de_web_plugin_private.h"
#define FW_IDLE_TIMEOUT (10 * 1000)
#define FW_WAIT_UPDATE_READY (2) //s
#define FW_IDLE_TIMEOUT_LONG (240 * 1000)
#define FW_WAIT_USER_TIMEOUT (120 * 1000)
/*! Inits the firmware update manager.
*/
void DeRestPluginPrivate::initFirmwareUpdate()
{
if (!apsCtrl)
{
return;
}
fwProcess = nullptr;
fwUpdateState = FW_Idle;
apsCtrl->setParameter(deCONZ::ParamFirmwareUpdateActive, deCONZ::FirmwareUpdateIdle);
fwUpdateStartedByUser = false;
fwUpdateTimer = new QTimer(this);
fwUpdateTimer->setSingleShot(true);
connect(fwUpdateTimer, SIGNAL(timeout()),
this, SLOT(firmwareUpdateTimerFired()));
fwUpdateTimer->start(5000);
}
/*! Starts the actual firmware update process.
*/
void DeRestPluginPrivate::updateFirmware()
{
if (gwFirmwareNeedUpdate)
{
gwFirmwareNeedUpdate = false;
}
Q_ASSERT(apsCtrl);
if (apsCtrl->getParameter(deCONZ::ParamFirmwareUpdateActive) == deCONZ::FirmwareUpdateIdle ||
apsCtrl->getParameter(deCONZ::ParamDeviceConnected) == 1)
{
DBG_Printf(DBG_INFO, "GW firmware update conditions not met, abort\n");
fwUpdateState = FW_Idle;
fwUpdateTimer->start(FW_IDLE_TIMEOUT);
updateEtag(gwConfigEtag);
return;
}
bool needSudo = true;
if (fwDeviceName == QLatin1String("ConBee II"))
{
needSudo = false;
}
QString bin;
QString gcfFlasherBin = qApp->applicationDirPath() + "/GCFFlasher";
#ifdef Q_OS_WIN
gcfFlasherBin.append(".exe");
bin = gcfFlasherBin;
#elif defined(Q_OS_LINUX) && !defined(ARCH_ARM) // on desktop linux
if (!needSudo || geteuid() == 0)
{
bin = QLatin1String("/usr/bin/GCFFlasher_internal.bin");
}
else
{
bin = QLatin1String("pkexec");
gcfFlasherBin = QLatin1String("/usr/bin/GCFFlasher_internal");
fwProcessArgs.prepend(gcfFlasherBin);
}
#elif defined(Q_OS_OSX)
// TODO
// /usr/bin/osascript -e 'do shell script "make install" with administrator privileges'
bin = "sudo";
fwProcessArgs.prepend(gcfFlasherBin);
#else
if (!needSudo || geteuid() == 0)
{
bin = QLatin1String("/usr/bin/GCFFlasher_internal.bin");
}
else // on ARM or Raspbian assume we don't need password (todo find a better solution)
{
bin = QLatin1String("sudo");
gcfFlasherBin = QLatin1String("/usr/bin/GCFFlasher_internal");
fwProcessArgs.prepend(gcfFlasherBin);
}
#endif
if (!fwProcess)
{
fwProcess = new QProcess(this);
}
fwProcessArgs << "-t" << "60" << "-f" << fwUpdateFile;
fwUpdateState = FW_UpdateWaitFinished;
updateEtag(gwConfigEtag);
fwUpdateTimer->start(250);
DBG_Printf(DBG_INFO, "exec: %s %s\n", qPrintable(bin), qPrintable(fwProcessArgs.join(' ')));
fwProcess->start(bin, fwProcessArgs);
}
/*! Observes the firmware update process.
*/
void DeRestPluginPrivate::updateFirmwareWaitFinished()
{
if (fwProcess)
{
if (fwProcess->bytesAvailable())
{
QByteArray data = fwProcess->readAllStandardOutput();
DBG_Printf(DBG_INFO, "%s", qPrintable(data));
if (apsCtrl->getParameter(deCONZ::ParamFirmwareUpdateActive) != deCONZ::FirmwareUpdateRunning)
{
if (data.contains("flashing"))
{
apsCtrl->setParameter(deCONZ::ParamFirmwareUpdateActive, deCONZ::FirmwareUpdateRunning);
}
}
}
if (fwProcess->state() == QProcess::Starting)
{
DBG_Printf(DBG_INFO, "GW firmware update starting ..\n");
}
else if (fwProcess->state() == QProcess::Running)
{
DBG_Printf(DBG_INFO_L2, "GW firmware update running ..\n");
}
else if (fwProcess->state() == QProcess::NotRunning)
{
if (fwProcess->exitStatus() == QProcess::NormalExit)
{
DBG_Printf(DBG_INFO, "GW firmware update exit code %d\n", fwProcess->exitCode());
}
else if (fwProcess->exitStatus() == QProcess::CrashExit)
{
DBG_Printf(DBG_INFO, "GW firmware update crashed %s\n", qPrintable(fwProcess->errorString()));
}
fwProcess->deleteLater();
fwProcess = nullptr;
}
}
// done
if (fwProcess == nullptr)
{
gwFirmwareVersion = QLatin1String("0x00000000"); // force reread
fwUpdateStartedByUser = false;
gwFirmwareNeedUpdate = false;
updateEtag(gwConfigEtag);
apsCtrl->setParameter(deCONZ::ParamFirmwareUpdateActive, deCONZ::FirmwareUpdateIdle);
fwUpdateState = FW_Idle;
fwUpdateTimer->start(FW_IDLE_TIMEOUT);
updateEtag(gwConfigEtag);
}
else // recheck
{
fwUpdateTimer->start(250);
}
}
/*! Starts the device disconnect so that the serial port is released.
*/
void DeRestPluginPrivate::updateFirmwareDisconnectDevice()
{
Q_ASSERT(apsCtrl);
// if (apsCtrl->getParameter(deCONZ::ParamFirmwareUpdateActive) == deCONZ::FirmwareUpdateIdle)
// {
// if (apsCtrl->getParameter(deCONZ::ParamDeviceConnected) == 1)
// {
// DBG_Printf(DBG_INFO, "GW firmware disconnect device before update\n");
// }
// }
zbConfigGood = QDateTime(); // clear
if (apsCtrl->getParameter(deCONZ::ParamDeviceConnected) == 1)
{
fwUpdateTimer->start(100); // recheck
}
else
{
DBG_Printf(DBG_INFO, "GW firmware start update (device not connected)\n");
fwUpdateState = FW_Update;
fwUpdateTimer->start(0);
updateEtag(gwConfigEtag);
}
}
/*! Starts the firmware update.
*/
bool DeRestPluginPrivate::startUpdateFirmware()
{
fwUpdateStartedByUser = true;
if (fwUpdateState == FW_WaitUserConfirm)
{
apsCtrl->setParameter(deCONZ::ParamFirmwareUpdateActive, deCONZ::FirmwareUpdateRunning);
updateEtag(gwConfigEtag);
fwUpdateState = FW_DisconnectDevice;
fwUpdateTimer->start(100);
zbConfigGood = QDateTime();
return true;
}
return false;
}
/*! Delayed trigger to update the firmware.
*/
void DeRestPluginPrivate::firmwareUpdateTimerFired()
{
// TODO(mpi): whole firmware module needs to be rewritten for upcoming GCFFlasher4 based connectiongs
return; // disabled for now, causes SEGV on some setups since v2.23.x
if (otauLastBusyTimeDelta() < OTA_LOW_PRIORITY_TIME)
{
fwUpdateState = FW_Idle;
fwUpdateTimer->start(FW_IDLE_TIMEOUT);
}
else if (fwUpdateState == FW_Idle)
{
if (gwFirmwareNeedUpdate)
{
gwFirmwareNeedUpdate = false;
updateEtag(gwConfigEtag);
}
if (gwFirmwareVersion == QLatin1String("0x00000000"))
{
uint8_t devConnected = apsCtrl->getParameter(deCONZ::ParamDeviceConnected);
uint32_t fwVersion = apsCtrl->getParameter(deCONZ::ParamFirmwareVersion);
if (devConnected && fwVersion)
{
gwFirmwareVersion = QString("0x%1").arg(fwVersion, 8, 16, QLatin1Char('0'));
gwConfig["fwversion"] = gwFirmwareVersion;
updateEtag(gwConfigEtag);
}
}
fwUpdateState = FW_CheckDevices;
fwUpdateTimer->start(0);
}
else if (fwUpdateState == FW_CheckDevices)
{
checkFirmwareDevices();
}
else if (fwUpdateState == FW_CheckVersion)
{
queryFirmwareVersion();
}
else if (fwUpdateState == FW_DisconnectDevice)
{
updateFirmwareDisconnectDevice();
}
else if (fwUpdateState == FW_Update)
{
updateFirmware();
}
else if (fwUpdateState == FW_UpdateWaitFinished)
{
updateFirmwareWaitFinished();
}
else if (fwUpdateState == FW_WaitUserConfirm)
{
fwUpdateState = FW_Idle;
fwUpdateTimer->start(FW_IDLE_TIMEOUT);
}
else
{
fwUpdateState = FW_Idle;
fwUpdateTimer->start(FW_IDLE_TIMEOUT);
}
}
/*! Lazy query of firmware version.
Because the device might not be connected at first optaining the
firmware version must be delayed.
If the firmware is older then the min required firmware for the platform
and a proper firmware update file exists, the API will announce that a
firmware update is available.
*/
void DeRestPluginPrivate::queryFirmwareVersion()
{
if (!apsCtrl)
{
return;
}
{ // check for GCFFlasher binary
QString gcfFlasherBin = qApp->applicationDirPath() + "/GCFFlasher";
#ifdef Q_OS_WIN
gcfFlasherBin.append(".exe");
#elif defined(Q_OS_LINUX) && !defined(ARCH_ARM)
gcfFlasherBin = "/usr/bin/GCFFlasher_internal";
#elif defined(Q_OS_OSX)
// TODO
#else
gcfFlasherBin = "/usr/bin/GCFFlasher_internal";
#endif
if (!QFile::exists(gcfFlasherBin))
{
DBG_Printf(DBG_INFO, "GW update firmware failed, %s doesn't exist\n", qPrintable(gcfFlasherBin));
fwUpdateState = FW_Idle;
fwUpdateTimer->start(FW_IDLE_TIMEOUT_LONG);
return;
}
}
const quint8 devConnected = apsCtrl->getParameter(deCONZ::ParamDeviceConnected);
quint32 fwVersion = apsCtrl->getParameter(deCONZ::ParamFirmwareVersion);
if (fwUpdateFile.isEmpty() && fwVersion == 0 && idleTotalCounter > (IDLE_READ_LIMIT + 10))
{
if (fwDeviceName == QLatin1String("ConBee II"))
{
fwVersion = FW_ONLY_R21_BOOTLOADER;
}
}
// does the update file exist?
// todo if the fwVersion is 0, make a guess on which firmware file to select based on device enumerator
QString fileName;
if (fwUpdateFile.isEmpty() && fwVersion > 0)
{
if (((fwVersion & FW_PLATFORM_MASK) == FW_PLATFORM_AVR) || fwVersion == FW_ONLY_AVR_BOOTLOADER)
{
fileName = QString("deCONZ_Rpi_0x%1.bin.GCF").arg(GW_MIN_AVR_FW_VERSION, 8, 16, QLatin1Char('0'));
}
else if (((fwVersion & FW_PLATFORM_MASK) == FW_PLATFORM_R21) || fwVersion == FW_ONLY_R21_BOOTLOADER)
{
fileName = QString("deCONZ_ConBeeII_0x%1.bin.GCF").arg(GW_MIN_R21_FW_VERSION, 8, 16, QLatin1Char('0'));
}
// search in different locations
std::vector<QString> paths;
#ifdef Q_OS_LINUX
paths.push_back(QLatin1String("/usr/share/deCONZ/firmware/"));
#endif
paths.push_back(deCONZ::getStorageLocation(deCONZ::ApplicationsDataLocation) + QLatin1String("/firmware/"));
paths.push_back(deCONZ::getStorageLocation(deCONZ::HomeLocation) + QLatin1String("/raspbee_firmware/"));
#ifdef Q_OS_OSX
QDir dir(qApp->applicationDirPath());
dir.cdUp();
dir.cd("Resources");
paths.push_back(dir.path() + "/");
#endif
std::vector<QString>::const_iterator i = paths.begin();
std::vector<QString>::const_iterator end = paths.end();
for (; i != end; ++i)
{
if (QFile::exists(*i + fileName))
{
fwUpdateFile = *i + fileName;
DBG_Printf(DBG_INFO, "GW update firmware found: %s\n", qPrintable(fwUpdateFile));
break;
}
}
}
if (fwUpdateFile.isEmpty())
{
DBG_Printf(DBG_INFO_L2, "GW update firmware not found: %s\n", qPrintable(fileName));
fwUpdateState = FW_Idle;
fwUpdateTimer->start(FW_IDLE_TIMEOUT);
return;
}
Q_ASSERT(!gwFirmwareNeedUpdate);
if (devConnected == 0 || fwVersion == 0)
{
// if even after some time no firmware was detected
// ASSUME that a device is present and reachable but might not have firmware installed
if (fwDeviceName == QLatin1String("ConBee II"))
{
// ignore
fwUpdateState = FW_Idle;
fwUpdateTimer->start(FW_IDLE_TIMEOUT_LONG);
}
else if (getUptime() >= FW_WAIT_UPDATE_READY && fwDeviceName == QLatin1String("RaspBee"))
{
gwFirmwareVersion = QLatin1String("0x00000000"); // unknown
gwFirmwareVersionUpdate = QString("0x%1").arg(GW_MIN_AVR_FW_VERSION, 8, 16, QLatin1Char('0'));
gwConfig["fwversion"] = gwFirmwareVersion;
gwFirmwareNeedUpdate = true;
updateEtag(gwConfigEtag);
fwUpdateState = FW_WaitUserConfirm;
fwUpdateTimer->start(FW_WAIT_USER_TIMEOUT);
apsCtrl->setParameter(deCONZ::ParamFirmwareUpdateActive, deCONZ::FirmwareUpdateReadyToStart);
if (fwUpdateStartedByUser)
{
startUpdateFirmware();
}
}
return;
}
else if (devConnected || fwVersion == FW_ONLY_AVR_BOOTLOADER)
{
QString str = QString("0x%1").arg(fwVersion, 8, 16, QLatin1Char('0'));
if (gwFirmwareVersion != str)
{
gwFirmwareVersion = str;
gwConfig["fwversion"] = str;
updateEtag(gwConfigEtag);
}
DBG_Printf(DBG_INFO_L2, "GW firmware version: %s\n", qPrintable(gwFirmwareVersion));
// if the device is detected check that the firmware version is >= min version
// if fwVersion is FW_ONLY_AVR_BOOTLOADER, there might be no firmware at all, but update is possible
if (((fwVersion & FW_PLATFORM_MASK) == FW_PLATFORM_AVR) || fwVersion == FW_ONLY_AVR_BOOTLOADER)
{
if (fwVersion < GW_MIN_AVR_FW_VERSION)
{
gwFirmwareVersionUpdate = QString("0x%1").arg(GW_MIN_AVR_FW_VERSION, 8, 16, QLatin1Char('0'));
gwFirmwareNeedUpdate = true;
updateEtag(gwConfigEtag);
DBG_Printf(DBG_INFO, "GW firmware version shall be updated to: 0x%08x\n", GW_MIN_AVR_FW_VERSION);
fwUpdateState = FW_WaitUserConfirm;
fwUpdateTimer->start(FW_WAIT_USER_TIMEOUT);
apsCtrl->setParameter(deCONZ::ParamFirmwareUpdateActive, deCONZ::FirmwareUpdateReadyToStart);
bool autoUpdate = false;
// auto update factory fresh devices with too old or no firmware
if (fwVersion == FW_ONLY_AVR_BOOTLOADER)
{
autoUpdate = true;
}
else if (apsCtrl->getParameter(deCONZ::ParamDeviceName) == QLatin1String("RaspBee") &&
!gwSdImageVersion.isEmpty() && nodes.empty() && sensors.size() < 2)
{
autoUpdate = true;
}
if (autoUpdate && fwVersion <= GW_AUTO_UPDATE_AVR_FW_VERSION)
{
DBG_Printf(DBG_INFO, "GW firmware start auto update\n");
startUpdateFirmware();
}
return;
}
else
{
DBG_Printf(DBG_INFO, "GW firmware version is up to date: 0x%08x\n", fwVersion);
fwUpdateState = FW_Idle;
fwUpdateTimer->start(FW_IDLE_TIMEOUT_LONG);
return;
}
}
// adapted from above AVR handling
if ((fwVersion & FW_PLATFORM_MASK) == FW_PLATFORM_R21 && fwDeviceName == QLatin1String("ConBee II"))
{
if (fwVersion < GW_MIN_R21_FW_VERSION)
{
gwFirmwareVersionUpdate = QString("0x%1").arg(GW_MIN_R21_FW_VERSION, 8, 16, QLatin1Char('0'));
gwFirmwareNeedUpdate = true;
updateEtag(gwConfigEtag);
DBG_Printf(DBG_INFO, "GW firmware version shall be updated to: 0x%08x\n", GW_MIN_R21_FW_VERSION);
fwUpdateState = FW_WaitUserConfirm;
fwUpdateTimer->start(FW_WAIT_USER_TIMEOUT);
apsCtrl->setParameter(deCONZ::ParamFirmwareUpdateActive, deCONZ::FirmwareUpdateReadyToStart);
// bool autoUpdate = false; // TODO refactor when R21 bootloader v2 arrives
// auto update factory fresh devices with too old or no firmware
if (gwRunMode.startsWith(QLatin1String("docker")))
{
// TODO needs to be testet
}
else if (fwVersion > FW_ONLY_R21_BOOTLOADER && fwVersion <= GW_AUTO_UPDATE_R21_FW_VERSION)
{
// autoUpdate = true;
}
// if (autoUpdate && fwVersion <= GW_AUTO_UPDATE_R21_FW_VERSION)
// {
// DBG_Printf(DBG_INFO, "GW firmware start auto update\n");
// startUpdateFirmware();
// }
return;
}
else
{
DBG_Printf(DBG_INFO, "GW firmware version is up to date: 0x%08x\n", fwVersion);
fwUpdateState = FW_Idle;
fwUpdateTimer->start(FW_IDLE_TIMEOUT_LONG);
return;
}
}
if (!gwFirmwareVersionUpdate.isEmpty())
{
gwFirmwareVersionUpdate.clear();
updateEtag(gwConfigEtag);
}
}
fwUpdateState = FW_Idle;
fwUpdateTimer->start(FW_IDLE_TIMEOUT);
}
/*! Checks if devices for firmware update are present.
*/
void DeRestPluginPrivate::checkFirmwareDevices()
{
fwProcessArgs.clear();
const quint8 devConnected = apsCtrl->getParameter(deCONZ::ParamDeviceConnected);
deCONZ::DeviceEnumerator *devEnumerator = deCONZ::DeviceEnumerator::instance();
if (devConnected == 0)
{
devEnumerator->listSerialPorts();
}
const std::vector<deCONZ::DeviceEntry> &availPorts = devEnumerator->getList();
auto i = availPorts.cbegin();
const auto end = availPorts.cend();
int raspBeeCount = 0;
int usbDongleCount = 0;
QString ttyPath;
QString serialNumber;
ttyPath = apsCtrl->getParameter(deCONZ::ParamDevicePath);
for (; i != end; ++i)
{
if (i->friendlyName.contains(QLatin1String("ConBee")))
{
usbDongleCount++;
if (ttyPath.isEmpty())
{
ttyPath = i->path;
}
}
else if (i->friendlyName.contains(QLatin1String("RaspBee")))
{
raspBeeCount = 1;
if (ttyPath.isEmpty())
{
ttyPath = i->path;
}
}
if (ttyPath == i->path)
{
serialNumber = i->serialNumber;
fwDeviceName = i->friendlyName;
}
}
if (devConnected > 0 && !ttyPath.isEmpty())
{
if (!serialNumber.isEmpty())
{
fwProcessArgs << "-s" << serialNumber; // GCFFlasher >= 3.2
}
else
{
fwProcessArgs << "-d" << ttyPath; // GCFFlasher >= 3.x
}
}
else if (usbDongleCount > 1)
{
DBG_Printf(DBG_INFO_L2, "GW firmware update too many USB devices connected, abort\n");
}
else if (usbDongleCount == 1)
{
DBG_Printf(DBG_INFO_L2, "GW firmware update select USB device\n");
#ifndef Q_OS_WIN // windows does append characters to the serial number for some reason 'A' (TODO)
if (!serialNumber.isEmpty())
{
fwProcessArgs << "-s" << serialNumber;
}
else
#endif
{
fwProcessArgs << "-d" << "0";
}
}
else if (raspBeeCount > 0 && usbDongleCount == 0 && !ttyPath.isEmpty())
{
DBG_Printf(DBG_INFO_L2, "GW firmware update select %s device\n", qPrintable(ttyPath));
fwProcessArgs << "-d" << "RaspBee";
}
if (!fwProcessArgs.isEmpty())
{
fwUpdateState = FW_CheckVersion;
fwUpdateTimer->start(0);
return;
}
fwUpdateState = FW_Idle;
fwUpdateTimer->start(FW_IDLE_TIMEOUT);
}