1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-07 10:47:02 +01:00

try to fix cor firmware recognition for newer versions

This commit is contained in:
Andreas Shimokawa 2017-12-21 09:34:51 +01:00
parent 1c84a5b2c7
commit ad750c0047

View File

@ -33,6 +33,7 @@ public class AmazfitCorFirmwareInfo extends HuamiFirmwareInfo {
}; };
private static final int FW_HEADER_OFFSET = 0x9330; private static final int FW_HEADER_OFFSET = 0x9330;
private static final int FW_HEADER_OFFSET_2 = 0x9340;
private static final int NEW_RES_HEADER_OFFSET = 0x9; private static final int NEW_RES_HEADER_OFFSET = 0x9;
private static Map<Integer, String> crcToVersion = new HashMap<>(); private static Map<Integer, String> crcToVersion = new HashMap<>();
@ -61,7 +62,7 @@ public class AmazfitCorFirmwareInfo extends HuamiFirmwareInfo {
return HuamiFirmwareType.RES; return HuamiFirmwareType.RES;
} else if (ArrayUtils.equals(bytes, RES_HEADER, NEW_RES_HEADER_OFFSET)) { } else if (ArrayUtils.equals(bytes, RES_HEADER, NEW_RES_HEADER_OFFSET)) {
return HuamiFirmwareType.RES_NEW; return HuamiFirmwareType.RES_NEW;
} else if (ArrayUtils.equals(bytes, FW_HEADER, FW_HEADER_OFFSET)) { } else if (ArrayUtils.equals(bytes, FW_HEADER, FW_HEADER_OFFSET) || ArrayUtils.equals(bytes, FW_HEADER, FW_HEADER_OFFSET_2)) {
// TODO: this is certainly not a correct validation, but it works for now // TODO: this is certainly not a correct validation, but it works for now
return HuamiFirmwareType.FIRMWARE; return HuamiFirmwareType.FIRMWARE;
} }