]> localhost Git - SCSI2SD-V6.git/commitdiff
Improve detection of 2021 boards and firmware updates in scsi2sd-util
authorMichael McMaster <michael@codesrc.com>
Sat, 8 May 2021 06:29:37 +0000 (16:29 +1000)
committerMichael McMaster <michael@codesrc.com>
Sat, 8 May 2021 06:29:37 +0000 (16:29 +1000)
src/firmware/hwversion.c
src/scsi2sd-util6/SCSI2SD_HID.cc
src/scsi2sd-util6/scsi2sd-util.cc

index eba4be6be1ab483309855078056bc918b224aea2..201a5314cf10ccb90bb023db681eeb3d371c0c9f 100755 (executable)
@@ -82,6 +82,13 @@ checkHwSensePins()
                while (1) {}
        }
 #endif
+#ifdef REV_2021
+    if ((DBGMCU->IDCODE & 0x00000FFF) != 0x0421)
+    {
+               // Oh dear, wrong cpu. Do not pass go.
+               while (1) {}
+    }
+#endif
 }
 
 void
index 163cbed60af2456b8ed789172088bdac3c56be82..4d5aa5d2e16ef2cd27b0a2ea0aae011d9510ce18 100644 (file)
@@ -401,11 +401,16 @@ HID::getSerialNumber()
 bool
 HID::isCorrectFirmware(const std::string& path)
 {
+    if (path.rfind(".dfu") != path.size() - 4)
+    {
+        return false;
+    }
+
        if (myFirmwareVersion < 0x0630)
        {
                // Definitely the older hardware.
-               return path.rfind("firmware.V6.revF.dfu") != std::string::npos ||
-                       path.rfind("firmware.dfu") != std::string::npos;
+               return path.rfind("firmware.V6.revF") != std::string::npos ||
+                       path.rfind("firmware") != std::string::npos;
        }
        else if (myFirmwareVersion == 0x0630)
        {
@@ -426,17 +431,17 @@ HID::isCorrectFirmware(const std::string& path)
                        if (prodStr.find(L"2020") != std::string::npos)
                        {
                                // Definitely the 2020c or newer hardware.
-                               return path.rfind("firmware.V6.2020.dfu") != std::string::npos;
+                               return path.rfind("firmware.V6.2020") != std::string::npos;
                        }
                        else if (prodStr.find(L"2021") != std::string::npos)
                        {
                                // Definitely the 2020c or newer hardware.
-                               return path.rfind("firmware.V6.2021.dfu") != std::string::npos;
+                               return path.rfind("firmware.V6.2021") != std::string::npos;
                        }
                        else
                        {
-                               return path.rfind("firmware.V6.revF.dfu") != std::string::npos ||
-                                       path.rfind("firmware.dfu") != std::string::npos;
+                               return path.rfind("firmware.V6.revF") != std::string::npos ||
+                                       path.rfind("firmware") != std::string::npos;
                        }
                }
        }
index 60102fe98c56d7fe7e4c8cee2b4590cae1f8cd14..b7d57942dcdbfbfa3691b4385cf6cda629f8a003 100644 (file)
@@ -599,6 +599,7 @@ private:
                                wxOK | wxICON_ERROR);
                        return false;
                }
+        file.Close();
                wxRemoveFile(tmpFile);
 
                uint32_t value =
@@ -612,6 +613,11 @@ private:
                        wxLogMessage("OTP Hardware version not set. Ignoring.");
                        return true;
                }
+               else if (value == 0x06002021)
+               {
+                       wxLogMessage("Found V6 2021 hardware marker");
+                       return firmware.rfind("firmware.V6.2021.dfu") != std::string::npos;
+               }
                else if (value == 0x06002020)
                {
                        wxLogMessage("Found V6 2020 hardware marker");