1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-12-01 06:22:55 +01:00

Amazfit Cor: whitelist latest .res and .fw

Add a note about this being totally untested, especially scary since the new res format is different.
This commit is contained in:
Andreas Shimokawa 2017-10-25 22:26:38 +02:00
parent 3ea2ac6dd2
commit 94cfaadc41
2 changed files with 8 additions and 2 deletions

View File

@ -33,15 +33,19 @@ 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 NEW_RES_HEADER_OFFSET = 0x9;
private static Map<Integer, String> crcToVersion = new HashMap<>(); private static Map<Integer, String> crcToVersion = new HashMap<>();
static { static {
// firmware // firmware
crcToVersion.put(39948, "1.0.5.60"); crcToVersion.put(39948, "1.0.5.60");
crcToVersion.put(62147, "1.0.5.78");
// resources // resources
crcToVersion.put(46341, "RES 1.0.5.60"); crcToVersion.put(46341, "RES 1.0.5.60");
crcToVersion.put(21770, "RES 1.0.5.78");
} }
public AmazfitCorFirmwareInfo(byte[] bytes) { public AmazfitCorFirmwareInfo(byte[] bytes) {
@ -55,6 +59,8 @@ public class AmazfitCorFirmwareInfo extends HuamiFirmwareInfo {
return HuamiFirmwareType.INVALID; return HuamiFirmwareType.INVALID;
} }
return HuamiFirmwareType.RES; return HuamiFirmwareType.RES;
} else if (ArrayUtils.equals(bytes, RES_HEADER, NEW_RES_HEADER_OFFSET)) {
return HuamiFirmwareType.RES;
} else if (ArrayUtils.equals(bytes, FW_HEADER, FW_HEADER_OFFSET)) { } else if (ArrayUtils.equals(bytes, FW_HEADER, FW_HEADER_OFFSET)) {
// 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;

View File

@ -54,8 +54,8 @@
<!-- Strings related to FwAppInstaller --> <!-- Strings related to FwAppInstaller -->
<string name="title_activity_fw_app_insaller">FW/App installer</string> <string name="title_activity_fw_app_insaller">FW/App installer</string>
<string name="fw_upgrade_notice">You are about to install firmware %s instead of the one currently on your Mi Band.</string> <string name="fw_upgrade_notice">You are about to install firmware %s instead of the one currently on your Mi Band.</string>
<string name="fw_upgrade_notice_amazfitbip">You are about to install firmware %s instead of the one currently on your Amazfit Bip.\n\nPlease make sure to install the .gps firmware, then the .res file, and finally the .fw file. Your watch will reboot after installing the .fw file.\n\nNote: You do not have to install .res and .gps if these files are exactly the same as the ones previously installed.\n\nEXPERIMENTAL, PROCEED AT YOUR OWN RISK</string> <string name="fw_upgrade_notice_amazfitbip">You are about to install firmware %s on your Amazfit Bip.\n\nPlease make sure to install the .gps firmware, then the .res file, and finally the .fw file. Your watch will reboot after installing the .fw file.\n\nNote: You do not have to install .res and .gps if these files are exactly the same as the ones previously installed.\n\nPROCEED AT YOUR OWN RISK!</string>
<string name="fw_upgrade_notice_amazfitcor">You are about to install firmware %s instead of the one currently on your Amazfit Cor.\n\nPlease make sure to install the .res file, and after that the .fw file. Your watch will reboot after installing the .fw file.\n\nNote: You do not have to install .res if it is exactly the same as the one previously installed.\n\nEXPERIMENTAL, PROCEED AT YOUR OWN RISK</string> <string name="fw_upgrade_notice_amazfitcor">You are about to install firmware %s on your Amazfit Cor.\n\nPlease make sure to install the .res file, and after that the .fw file. Your watch will reboot after installing the .fw file.\n\nNote: You do not have to install .res if it is exactly the same as the one previously installed.\n\nUNTESTED, MAY BRICK YOUR DEVICE, PROCEED AT YOUR OWN RISK!</string>
<string name="fw_multi_upgrade_notice">You are about to install firmwares %1$s and %2$s instead of the ones currently on your Mi Band.</string> <string name="fw_multi_upgrade_notice">You are about to install firmwares %1$s and %2$s instead of the ones currently on your Mi Band.</string>
<string name="miband_firmware_known">This firmware has been tested and is known to be compatible with Gadgetbridge.</string> <string name="miband_firmware_known">This firmware has been tested and is known to be compatible with Gadgetbridge.</string>
<string name="miband_firmware_unknown_warning">"This firmware is untested and may not be compatible with Gadgetbridge.\n\nYou are NOT encouraged to flash it to your Mi Band!"</string> <string name="miband_firmware_unknown_warning">"This firmware is untested and may not be compatible with Gadgetbridge.\n\nYou are NOT encouraged to flash it to your Mi Band!"</string>