diff --git a/CHANGELOG.md b/CHANGELOG.md index 497e9fd32..ce800820d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,9 @@ ### Changelog #### Next -* Amazfit Bip: Support flashing newer GPS ALM +* Haumi: Support flashing newer GPS firmware and GPS ALM * Amazfit Bip S: Support music control -* Amazfit Bip S: Support flashing firmware, res, watchfaces, fonts and GPS CEP +* Amazfit Bip S: Support flashing firmware, res, gps firmware, watchfaces, fonts and GPS CEP * Amazfit Bip S: Allow setting high MTU (much faster firmware installation, default off since it does not work for some) * Amazfit Bip S: remove disconnect notification and button action settings (they do not work) * Fossil Hybrid HR: Add last notification widget diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/HuamiFirmwareInfo.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/HuamiFirmwareInfo.java index dfefbb82f..c3c513253 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/HuamiFirmwareInfo.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/HuamiFirmwareInfo.java @@ -56,6 +56,38 @@ public abstract class HuamiFirmwareInfo { 0x2a, 0x12, (byte) 0xa0, 0x02 }; + // gps detection is totally bogus, just the first 16 bytes + protected static final byte[][] GPS_HEADERS = { + new byte[]{ + (byte) 0xcb, 0x51, (byte) 0xc1, 0x30, 0x41, (byte) 0x9e, 0x5e, (byte) 0xd3, + 0x51, 0x35, (byte) 0xdf, 0x66, (byte) 0xed, (byte) 0xd9, 0x5f, (byte) 0xa7 + }, + new byte[]{ + 0x10, 0x50, 0x26, 0x76, (byte) 0x8f, 0x4a, (byte) 0xa1, 0x49, + (byte) 0xa7, 0x26, (byte) 0xd0, (byte) 0xe6, 0x4a, 0x21, (byte) 0x88, (byte) 0xd4 + }, + new byte[]{ + (byte) 0xeb, (byte) 0xfa, (byte) 0xc5, (byte) 0x89, (byte) 0xf0, 0x5c, 0x2e, (byte) 0xcc, + (byte) 0xfa, (byte) 0xf3, 0x62, (byte) 0xeb, (byte) 0x92, (byte) 0xc6, (byte) 0xa1, (byte) 0xbb + }, + new byte[]{ + 0x0b, 0x61, 0x53, (byte) 0xed, (byte) 0x83, (byte) 0xac, 0x07, 0x21, + (byte) 0x8c, 0x36, 0x2e, (byte) 0x8c, (byte) 0x9c, 0x08, 0x54, (byte) 0xa6 + }, + new byte[]{ + (byte) 0xec, 0x51, 0x73, 0x22, 0x60, 0x02, 0x14, (byte) 0xb7, + (byte) 0xb5, (byte) 0xea, 0x4b, 0x22, 0x5d, 0x23, (byte) 0xe5, 0x4f + }, + new byte[]{ + 0x73, 0x75, 0x68, (byte) 0xd0, 0x70, 0x73, (byte) 0xbb, 0x5a, + 0x3e, (byte) 0xc3, (byte) 0xd3, 0x09, (byte) 0x9e, 0x1d, (byte) 0xd3, (byte) 0xc9 + }, + new byte[]{ + 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x6F, (byte) 0xD0, + 0x00, 0x01, 0x00, 0x02, 0x3D, (byte) 0xE0, 0x00, 0x69 + } + }; + protected static final int FONT_TYPE_OFFSET = 0x9; protected static final int COMPRESSED_RES_HEADER_OFFSET = 0x9; protected static final int COMPRESSED_RES_HEADER_OFFSET_NEW = 0xd; diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/amazfitbip/AmazfitBipFirmwareInfo.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/amazfitbip/AmazfitBipFirmwareInfo.java index 5125cb53e..88975a071 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/amazfitbip/AmazfitBipFirmwareInfo.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/amazfitbip/AmazfitBipFirmwareInfo.java @@ -26,33 +26,6 @@ import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.HuamiFirmwareT import nodomain.freeyourgadget.gadgetbridge.util.ArrayUtils; public class AmazfitBipFirmwareInfo extends HuamiFirmwareInfo { - // gps detection is totally bogus, just the first 16 bytes - private static final byte[][] GPS_HEADERS = { - new byte[]{ - (byte) 0xcb, 0x51, (byte) 0xc1, 0x30, 0x41, (byte) 0x9e, 0x5e, (byte) 0xd3, - 0x51, 0x35, (byte) 0xdf, 0x66, (byte) 0xed, (byte) 0xd9, 0x5f, (byte) 0xa7 - }, - new byte[]{ - 0x10, 0x50, 0x26, 0x76, (byte) 0x8f, 0x4a, (byte) 0xa1, 0x49, - (byte) 0xa7, 0x26, (byte) 0xd0, (byte) 0xe6, 0x4a, 0x21, (byte) 0x88, (byte) 0xd4 - }, - new byte[]{ - (byte) 0xeb, (byte) 0xfa, (byte) 0xc5, (byte) 0x89, (byte) 0xf0, 0x5c, 0x2e, (byte) 0xcc, - (byte) 0xfa, (byte) 0xf3, 0x62, (byte) 0xeb, (byte) 0x92, (byte) 0xc6, (byte) 0xa1, (byte) 0xbb - }, - new byte[]{ - 0x0b, 0x61, 0x53, (byte) 0xed, (byte) 0x83, (byte) 0xac, 0x07, 0x21, - (byte) 0x8c, 0x36, 0x2e, (byte) 0x8c, (byte) 0x9c, 0x08, 0x54, (byte) 0xa6 - }, - new byte[]{ - (byte) 0xec, 0x51, 0x73, 0x22, 0x60, 0x02, 0x14, (byte) 0xb7, - (byte) 0xb5, (byte) 0xea, 0x4b, 0x22, 0x5d, 0x23, (byte) 0xe5, 0x4f - }, - new byte[]{ - 0x73, 0x75, 0x68, (byte) 0xd0, 0x70, 0x73, (byte) 0xbb, 0x5a, - 0x3e, (byte) 0xc3, (byte) 0xd3, 0x09, (byte) 0x9e, 0x1d, (byte) 0xd3, (byte) 0xc9 - } - }; // this is the same as Cor public static final byte[] FW_HEADER = new byte[]{ diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/amazfitbips/AmazfitBipSFirmwareInfo.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/amazfitbips/AmazfitBipSFirmwareInfo.java index 9c77f3c24..7bbd4e44a 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/amazfitbips/AmazfitBipSFirmwareInfo.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/amazfitbips/AmazfitBipSFirmwareInfo.java @@ -20,7 +20,6 @@ import java.util.HashMap; import java.util.Map; import nodomain.freeyourgadget.gadgetbridge.GBApplication; -import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst; import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice; import nodomain.freeyourgadget.gadgetbridge.model.DeviceType; import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.HuamiFirmwareInfo; @@ -28,12 +27,26 @@ import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.HuamiFirmwareT import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitbip.AmazfitBipFirmwareInfo; import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.miband4.MiBand4FirmwareInfo; import nodomain.freeyourgadget.gadgetbridge.util.ArrayUtils; -import nodomain.freeyourgadget.gadgetbridge.util.Prefs; public class AmazfitBipSFirmwareInfo extends HuamiFirmwareInfo { private static Map crcToVersion = new HashMap<>(); + static { + // fw tonlesap + crcToVersion.put(5017, "2.1.1.08"); + + // resources + crcToVersion.put(61617, "2.1.1.08"); + + // font + crcToVersion.put(62927, "3"); + + // gps + crcToVersion.put(62532, "18344,eb2f43f,126"); + crcToVersion.put(31510, "19226,f3a8ad3,135"); + } + public AmazfitBipSFirmwareInfo(byte[] bytes) { super(bytes); } @@ -83,6 +96,11 @@ public class AmazfitBipSFirmwareInfo extends HuamiFirmwareInfo { return HuamiFirmwareType.FONT_LATIN; } } + for (byte[] gpsHeader : GPS_HEADERS) { + if (ArrayUtils.startsWith(bytes, gpsHeader)) { + return HuamiFirmwareType.GPS; + } + } return HuamiFirmwareType.INVALID; }