Mi Band 4 (possibly others): Fix detected RES version being always 69 for non-whitelisted res files

Fixes #1886
This commit is contained in:
Andreas Shimokawa 2020-06-12 23:24:26 +02:00
parent cdc149338a
commit 0229d24092
2 changed files with 12 additions and 4 deletions

View File

@ -6,6 +6,7 @@
* 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)
* Mi Band 4 (possibly others): Fix detected RES version being always 69 for non-whitelisted res files
* Fossil Hybrid HR: Add last notification widget
* Try to fix vanishing incoming call information when VoIP call support is enabled
* Allow setting device aliases (useful if you manage multiple ones of the same type)

View File

@ -105,7 +105,16 @@ public abstract class HuamiFirmwareInfo {
version = "RES " + bytes[5];
break;
case RES_COMPRESSED:
version = "RES " + bytes[14];
byte versionByte;
// there are two possible locations of the version for compressed res, probe the format in a dirty way :P
if (bytes[COMPRESSED_RES_HEADER_OFFSET + 2] == 0x52 &&
bytes[COMPRESSED_RES_HEADER_OFFSET + 3] == 0x45 &&
bytes[COMPRESSED_RES_HEADER_OFFSET + 4] == 0x53) {
versionByte = bytes[14];
} else {
versionByte = bytes[18];
}
version = "RES " + (versionByte & 0xff);
break;
case FONT:
version = "FONT " + bytes[4];
@ -167,9 +176,7 @@ public abstract class HuamiFirmwareInfo {
}
/**
* Returns the size of the firmware in number of bytes.
*
* @return
* @return the size of the firmware in number of bytes.
*/
public int getSize() {
return bytes.length;