Skip to content

Commit 771ac8f

Browse files
author
QuantAsylum
committed
Ensure that QA350 cannot flash a QA351
Signed-off-by: QuantAsylum <git@quantasylum.com>
1 parent 309bc69 commit 771ac8f

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

Application/QA350/QA350/Constants.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class Constants
1212
static public string CalibrationFile = DataFilePath + "CalibrationData.xml";
1313
static public string SettingsFile = DataFilePath + "QA350Settings.xml";
1414

15-
static public double Version = 1.771;
15+
static public double Version = 1.772;
1616

1717
static public Int32 RequiredFwVersion = 12;
1818
}

Application/QA350/QA350/Form1.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,8 +300,15 @@ private void TryConnect()
300300
// Attempt to connect to the device upon app startup
301301
if (Hardware.Open())
302302
{
303+
Int32 productId = Hardware.GetProductId();
304+
if (productId != 12345678)
305+
{
306+
MessageBox.Show("Unrecognized product.");
307+
Hardware.Close();
308+
return;
309+
}
310+
303311
Int32 fwVersion = Hardware.GetFirmwareVersion();
304-
305312
if (fwVersion != Constants.RequiredFwVersion)
306313
{
307314
BadFirmwareVersion = true;

Application/QA350/QA350/Hardware.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,11 @@ static public int GetFirmwareVersion()
141141
return SendRecv(0xFE);
142142
}
143143

144+
static public int GetProductId()
145+
{
146+
return SendRecv(0xFD);
147+
}
148+
144149
static public int GetMspTemp()
145150
{
146151
return SendRecv(51);

0 commit comments

Comments
 (0)