diff --git a/src/Platform.h b/src/Platform.h
index 55a8e9cc..03233715 100644
--- a/src/Platform.h
+++ b/src/Platform.h
@@ -80,7 +80,6 @@ enum ConfigEntry
Firm_Color,
Firm_Message,
Firm_MAC,
- Firm_RandomizeMAC,
AudioBitrate,
};
diff --git a/src/SPI.cpp b/src/SPI.cpp
index 8d15656f..f586c2e5 100644
--- a/src/SPI.cpp
+++ b/src/SPI.cpp
@@ -406,6 +406,7 @@ void Reset()
if (rep)
{
+ mac[0] &= 0xFC; // ensure the MAC isn't a broadcast MAC
memcpy(&Firmware[0x36], mac, 6);
*(u16*)&Firmware[0x2A] = CRC16(&Firmware[0x2C], *(u16*)&Firmware[0x2C], 0x0000);
diff --git a/src/frontend/qt_sdl/Config.cpp b/src/frontend/qt_sdl/Config.cpp
index 7a0ec698..8072a6aa 100644
--- a/src/frontend/qt_sdl/Config.cpp
+++ b/src/frontend/qt_sdl/Config.cpp
@@ -106,7 +106,6 @@ int FirmwareBirthdayDay;
int FirmwareFavouriteColour;
std::string FirmwareMessage;
std::string FirmwareMAC;
-bool RandomizeMAC;
bool SocketBindAnyAddr;
std::string LANDevice;
@@ -272,7 +271,6 @@ ConfigEntry ConfigFile[] =
{"FirmwareFavouriteColour", 0, &FirmwareFavouriteColour, 0},
{"FirmwareMessage", 2, &FirmwareMessage, (std::string)""},
{"FirmwareMAC", 2, &FirmwareMAC, (std::string)""},
- {"RandomizeMAC", 1, &RandomizeMAC, false},
{"SockBindAnyAddr", 1, &SocketBindAnyAddr, false},
{"LANDevice", 2, &LANDevice, (std::string)""},
diff --git a/src/frontend/qt_sdl/Config.h b/src/frontend/qt_sdl/Config.h
index f2f8ddcd..dc38982a 100644
--- a/src/frontend/qt_sdl/Config.h
+++ b/src/frontend/qt_sdl/Config.h
@@ -141,7 +141,6 @@ extern int FirmwareBirthdayDay;
extern int FirmwareFavouriteColour;
extern std::string FirmwareMessage;
extern std::string FirmwareMAC;
-extern bool RandomizeMAC;
extern bool SocketBindAnyAddr;
extern std::string LANDevice;
diff --git a/src/frontend/qt_sdl/FirmwareSettingsDialog.cpp b/src/frontend/qt_sdl/FirmwareSettingsDialog.cpp
index 754cc8a5..69798d21 100644
--- a/src/frontend/qt_sdl/FirmwareSettingsDialog.cpp
+++ b/src/frontend/qt_sdl/FirmwareSettingsDialog.cpp
@@ -64,10 +64,8 @@ FirmwareSettingsDialog::FirmwareSettingsDialog(QWidget* parent) : QDialog(parent
ui->overrideFirmwareBox->setChecked(Config::FirmwareOverrideSettings);
ui->txtMAC->setText(QString::fromStdString(Config::FirmwareMAC));
- ui->cbRandomizeMAC->setChecked(Config::RandomizeMAC);
on_overrideFirmwareBox_toggled();
- on_cbRandomizeMAC_toggled();
}
FirmwareSettingsDialog::~FirmwareSettingsDialog()
@@ -135,7 +133,6 @@ void FirmwareSettingsDialog::done(int r)
std::string newMessage = ui->messageEdit->text().toStdString();
std::string newMAC = ui->txtMAC->text().toStdString();
- bool newRandomizeMAC = ui->cbRandomizeMAC->isChecked();
if ( newOverride != Config::FirmwareOverrideSettings
|| newName != Config::FirmwareUsername
@@ -144,8 +141,7 @@ void FirmwareSettingsDialog::done(int r)
|| newBirthdayDay != Config::FirmwareBirthdayDay
|| newBirthdayMonth != Config::FirmwareBirthdayMonth
|| newMessage != Config::FirmwareMessage
- || newMAC != Config::FirmwareMAC
- || newRandomizeMAC != Config::RandomizeMAC)
+ || newMAC != Config::FirmwareMAC)
{
if (RunningSomething
&& QMessageBox::warning(this, "Reset necessary to apply changes",
@@ -163,7 +159,6 @@ void FirmwareSettingsDialog::done(int r)
Config::FirmwareMessage = newMessage;
Config::FirmwareMAC = newMAC;
- Config::RandomizeMAC = newRandomizeMAC;
Config::Save();
@@ -210,9 +205,3 @@ void FirmwareSettingsDialog::on_overrideFirmwareBox_toggled()
ui->grpUserSettings->setDisabled(disable);
ui->grpWifiSettings->setDisabled(disable);
}
-
-void FirmwareSettingsDialog::on_cbRandomizeMAC_toggled()
-{
- bool disable = ui->cbRandomizeMAC->isChecked();
- ui->txtMAC->setDisabled(disable);
-}
diff --git a/src/frontend/qt_sdl/FirmwareSettingsDialog.h b/src/frontend/qt_sdl/FirmwareSettingsDialog.h
index 97bf5c07..b3695e2f 100644
--- a/src/frontend/qt_sdl/FirmwareSettingsDialog.h
+++ b/src/frontend/qt_sdl/FirmwareSettingsDialog.h
@@ -124,7 +124,6 @@ private slots:
void on_cbxBirthdayMonth_currentIndexChanged(int idx);
void on_overrideFirmwareBox_toggled();
- void on_cbRandomizeMAC_toggled();
private:
bool verifyMAC();
diff --git a/src/frontend/qt_sdl/FirmwareSettingsDialog.ui b/src/frontend/qt_sdl/FirmwareSettingsDialog.ui
index a97689cf..245e6418 100644
--- a/src/frontend/qt_sdl/FirmwareSettingsDialog.ui
+++ b/src/frontend/qt_sdl/FirmwareSettingsDialog.ui
@@ -7,7 +7,7 @@
0
0
511
- 342
+ 338
@@ -144,9 +144,9 @@
-
-
+
- Randomize
+ (leave empty to use default MAC)
diff --git a/src/frontend/qt_sdl/Platform.cpp b/src/frontend/qt_sdl/Platform.cpp
index 8f2163ec..dd2a5d7b 100644
--- a/src/frontend/qt_sdl/Platform.cpp
+++ b/src/frontend/qt_sdl/Platform.cpp
@@ -57,11 +57,11 @@ void IPCInit()
if (!IPCBuffer->attach())
{
printf("IPC sharedmem doesn't exist. creating\n");
- if (!IPCBuffer->create(4096))
+ if (!IPCBuffer->create(1024))
{
printf("IPC sharedmem create failed :(\n");
delete IPCBuffer;
- IPCBuffer= nullptr;
+ IPCBuffer = nullptr;
return;
}
@@ -89,7 +89,17 @@ void IPCInit()
void IPCDeInit()
{
- if (IPCBuffer) delete IPCBuffer;
+ if (IPCBuffer)
+ {
+ IPCBuffer->lock();
+ u8* data = (u8*)IPCBuffer->data();
+ *(u16*)&data[0] &= ~(1<unlock();
+
+ IPCBuffer->detach();
+ delete IPCBuffer;
+ }
+
IPCBuffer = nullptr;
}
@@ -195,7 +205,6 @@ bool GetConfigBool(ConfigEntry entry)
case DSiSD_ReadOnly: return Config::DSiSDReadOnly != 0;
case DSiSD_FolderSync: return Config::DSiSDFolderSync != 0;
- case Firm_RandomizeMAC: return Config::RandomizeMAC != 0;
case Firm_OverrideSettings: return Config::FirmwareOverrideSettings != 0;
}