16 { 0x1b1c, 0x1b17,
"corsair k65 rgb" },
17 { 0x1b1c, 0x1b3f,
"corsair k68" },
18 { 0x1b1c, 0x1b13,
"corsair k70 rgb" },
19 { 0x1b1c, 0x1b11,
"corsair k95 rgb" },
20 { 0x1b1c, 0x1b15,
"corsair strafe monochrome" },
21 { 0x1b1c, 0x1b20,
"corsair strafe rgb" },
23 { 0x1b1c, 0x1b12,
"corsair m65 rgb" },
24 { 0x1b1c, 0x1b1e,
"corsair scimitar rgb" },
26 { 0x1b1c, 0x1b32,
"corsair sabre optical rgb" }
35 blob(fwBlob), kb(device), evLoop(0), exitSuccess(true)
39 ui->
newLabel->setText(QString::number(newV,
'f', 2));
42 connect(device, SIGNAL(destroyed()),
this, SLOT(
removeDev()));
61 QDir tmp = QDir::temp();
62 qint64 pid = QCoreApplication::applicationPid();
63 QString path = tmp.absoluteFilePath(QString(
"ckb-%1-fwblob.bin").arg(pid));
65 if(!output.open(QIODevice::WriteOnly)){
68 if(!output.write(
blob)){
86 static float verifyFw(
const QByteArray& blob,
const QString& features){
87 if(blob.length() < 0x0108)
89 const char* bData = blob.data();
92 for(uint i = 0; i <
sizeof(
ids)/
sizeof(
KbId); i++){
93 if(!memcmp(&ids[i].vendor, bData + 0x102, 2) && !memcmp(&ids[i].product, bData + 0x104, 2)
94 && features.startsWith(ids[i].feature, Qt::CaseInsensitive)){
103 memcpy(&version, bData + 0x106, 2);
105 return QString::number(version, 16).toFloat() / 100.f;
114 QMessageBox::warning(parentWidget(),
"Error",
"<center>Not a valid firmware for this device.</center>");
115 return QDialog::Rejected;
117 ui->
newLabel->setText(QString::number(newV,
'f', 2));
130 QMessageBox::warning(parentWidget(),
"Error",
"<center>There was a problem with the downloaded file.<br />Please try again later.</center>");
131 return QDialog::Rejected;
137 QMessageBox::warning(parentWidget(),
"Error",
"<center>Unable to save temporary file.</center>");
138 return QDialog::Rejected;
144 ui->
statusLabel->setText(
"Ready to install new firmware.<br /><br /><b>Disclaimer:</b> ckb-next is not endorsed by Corsair.<br />This is <i>unlikely</i> to cause any damage, however the developers of this software do not accept any responsibility in such an event.");
150 evLoop =
new QEventLoop(
this);
154 return exitSuccess ? QDialog::Accepted : QDialog::Rejected;
165 if(current > 0 && total > 0){
183 QTimer::singleShot(10000,
evLoop, SLOT(
quit()));
void fwUpdateFinished(bool succeeded)
QPushButton * cancelButton
static void quit()
quit Stop working the daemon. function is called if the daemon received a sigterm In this case...
static QByteArray dataForBoard(const QString &features)
void on_cancelButton_clicked()
static const int DIALOG_HEIGHT_MAX(240)
QPushButton * actionButton
void closeEvent(QCloseEvent *event)
void fwUpdate(const QString &path)
const QString & saveBlob()
void on_actionButton_clicked()
QProgressBar * progressBar
void fwUpdateProgress(int current, int total)
static const int DIALOG_WIDTH
static float verifyFw(const QByteArray &blob, const QString &features)
static const int DIALOG_HEIGHT_MIN
void setupUi(QDialog *FwUpgradeDialog)
FwUpgradeDialog(QWidget *parent, float newV, const QByteArray &fwBlob, Kb *device)