1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-29 05:16:51 +01:00

Amazfit Bip: Allow flashing of GPS CEP and Almanac, whitelist .96 fw

This commit is contained in:
Andreas Shimokawa 2017-09-15 11:44:24 +02:00
parent 3301194e75
commit d49db12a0d
2 changed files with 18 additions and 0 deletions

View File

@ -41,15 +41,24 @@ public class AmazfitBipFirmwareInfo extends Mi2FirmwareInfo {
0x48, 0x4d, 0x52, 0x45, 0x53
};
private static final byte[] GPS_ALMANAC_HEADER = new byte[]{ // probably wrong, we only have one file
(byte) 0xa0, (byte) 0x80, 0x08, 0x00, (byte) 0x8b, 0x07, (byte) 0x87, 0x13
};
private static final byte[] GPS_CEP_HEADER = new byte[]{ // probably wrong, we only have one file
0x2a, 0x12, (byte) 0xa0, 0x02, (byte) 0xc4, (byte) 0xe1, 0x00, 0x00
};
static {
// firmware
crcToVersion.put(25257, "0.0.8.74");
crcToVersion.put(57724, "0.0.8.88");
crcToVersion.put(27668, "0.0.8.96");
// resources
crcToVersion.put(12586, "RES 0.0.8.74");
crcToVersion.put(34068, "RES 0.0.8.88");
crcToVersion.put(59839, "RES 0.0.8.96");
// gps
crcToVersion.put(61520, "GPS 9367,8f79a91,0,0,");
@ -67,6 +76,12 @@ public class AmazfitBipFirmwareInfo extends Mi2FirmwareInfo {
if (ArrayUtils.startsWith(bytes, GPS_HEADER)) {
return FirmwareType.GPS;
}
if (ArrayUtils.startsWith(bytes, GPS_ALMANAC_HEADER)) {
return FirmwareType.GPS_ALMANAC;
}
if (ArrayUtils.startsWith(bytes, GPS_CEP_HEADER)) {
return FirmwareType.GPS_CEP;
}
if (ArrayUtils.equals(bytes, FW_HEADER, FW_HEADER_OFFSET)) {
// TODO: this is certainly not a correct validation, but it works for now
return FirmwareType.FIRMWARE;

View File

@ -19,8 +19,11 @@ package nodomain.freeyourgadget.gadgetbridge.service.devices.miband2;
public enum FirmwareType {
FIRMWARE((byte) 0),
FONT((byte) 1),
// Amazfit Bip only from here on
RES((byte) 2),
GPS((byte) 3),
GPS_CEP((byte) 4),
GPS_ALMANAC((byte)5),
INVALID(Byte.MIN_VALUE);
private final byte value;