mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-12-28 19:45:50 +01:00
Mi Band 3: Allow flashing fonts (untested)
This commit is contained in:
parent
9303214997
commit
d1cba54425
@ -48,6 +48,8 @@ public abstract class HuamiFirmwareInfo {
|
|||||||
0x4e, 0x45, 0x5a, 0x4b
|
0x4e, 0x45, 0x5a, 0x4b
|
||||||
};
|
};
|
||||||
|
|
||||||
|
protected static final int FONT_TYPE_OFFSET = 0x9;
|
||||||
|
|
||||||
private HuamiFirmwareType firmwareType = HuamiFirmwareType.FIRMWARE;
|
private HuamiFirmwareType firmwareType = HuamiFirmwareType.FIRMWARE;
|
||||||
|
|
||||||
public String toVersion(int crc16) {
|
public String toVersion(int crc16) {
|
||||||
|
@ -78,8 +78,11 @@ public class Mi2FirmwareInfo extends HuamiFirmwareInfo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected HuamiFirmwareType determineFirmwareType(byte[] bytes) {
|
protected HuamiFirmwareType determineFirmwareType(byte[] bytes) {
|
||||||
if (ArrayUtils.startsWith(bytes, HuamiFirmwareInfo.FT_HEADER)) {
|
if (ArrayUtils.startsWith(bytes, FT_HEADER)) {
|
||||||
return HuamiFirmwareType.FONT;
|
if (bytes[FONT_TYPE_OFFSET] == 0x00 || bytes[FONT_TYPE_OFFSET] == (byte) 0xff) {
|
||||||
|
return HuamiFirmwareType.FONT;
|
||||||
|
}
|
||||||
|
return HuamiFirmwareType.INVALID;
|
||||||
}
|
}
|
||||||
if (ArrayUtils.equals(bytes, FW_HEADER, FW_HEADER_OFFSET)
|
if (ArrayUtils.equals(bytes, FW_HEADER, FW_HEADER_OFFSET)
|
||||||
&& (bytes[FW_MAGIC_OFFSET] == FW_MAGIC)) {
|
&& (bytes[FW_MAGIC_OFFSET] == FW_MAGIC)) {
|
||||||
|
@ -53,6 +53,12 @@ public class MiBand3FirmwareInfo extends HuamiFirmwareInfo {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected HuamiFirmwareType determineFirmwareType(byte[] bytes) {
|
protected HuamiFirmwareType determineFirmwareType(byte[] bytes) {
|
||||||
|
if (ArrayUtils.startsWith(bytes, FT_HEADER)) {
|
||||||
|
if (bytes[FONT_TYPE_OFFSET] == 0x03 || bytes[FONT_TYPE_OFFSET] == 0x04) {
|
||||||
|
return HuamiFirmwareType.FONT;
|
||||||
|
}
|
||||||
|
return HuamiFirmwareType.INVALID;
|
||||||
|
}
|
||||||
if (ArrayUtils.startsWith(bytes, RES_HEADER)) {
|
if (ArrayUtils.startsWith(bytes, RES_HEADER)) {
|
||||||
if (bytes.length > 100000) { // don't know how to distinguish from Bip/Cor .res
|
if (bytes.length > 100000) { // don't know how to distinguish from Bip/Cor .res
|
||||||
return HuamiFirmwareType.INVALID;
|
return HuamiFirmwareType.INVALID;
|
||||||
|
Loading…
Reference in New Issue
Block a user