mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-09-03 04:56:27 +02:00
Mi1/Mi2: fix firmware file probing for the different devices
This commit is contained in:
parent
bb5791485c
commit
bcfc8bc110
@ -56,6 +56,9 @@ public class MiBand2FWHelper extends AbstractMiBandFWHelper {
|
||||
@Override
|
||||
protected void determineFirmwareInfo(byte[] wholeFirmwareBytes) {
|
||||
firmwareInfo = new Mi2FirmwareInfo(wholeFirmwareBytes);
|
||||
if (!firmwareInfo.isHeaderValid()) {
|
||||
throw new IllegalArgumentException("Not a Mi Band 2 firmware");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -57,8 +57,8 @@ public class Mi2FirmwareInfo {
|
||||
return isHeaderValid() && device.getType() == DeviceType.MIBAND2;
|
||||
}
|
||||
|
||||
protected boolean isHeaderValid() {
|
||||
// TODO: not sure if this is a correct check!
|
||||
public boolean isHeaderValid() {
|
||||
// TODO: this is certainly not a correct validation, but it works for now
|
||||
return ArrayUtils.equals(FW_HEADER, bytes, FW_HEADER_OFFSET, FW_HEADER_OFFSET + FW_HEADER.length);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user