Pebble: spoof a newer application version (3.x)

This commit is contained in:
Andreas Shimokawa 2015-07-24 01:34:50 +02:00
parent 844d929748
commit 91cc19befe
1 changed files with 30 additions and 2 deletions

View File

@ -520,8 +520,7 @@ public class PebbleProtocol extends GBDeviceProtocol {
return buf.array(); return buf.array();
} }
@Override private byte[] encodePhoneVersion2x(byte os) {
public byte[] encodePhoneVersion(byte os) {
ByteBuffer buf = ByteBuffer.allocate(LENGTH_PREFIX + LENGTH_PHONEVERSION); ByteBuffer buf = ByteBuffer.allocate(LENGTH_PREFIX + LENGTH_PHONEVERSION);
buf.order(ByteOrder.BIG_ENDIAN); buf.order(ByteOrder.BIG_ENDIAN);
buf.putShort(LENGTH_PHONEVERSION); buf.putShort(LENGTH_PHONEVERSION);
@ -544,6 +543,35 @@ public class PebbleProtocol extends GBDeviceProtocol {
return buf.array(); return buf.array();
} }
private byte[] encodePhoneVersion3x(byte os) {
ByteBuffer buf = ByteBuffer.allocate(LENGTH_PREFIX + 25);
buf.order(ByteOrder.BIG_ENDIAN);
buf.putShort((short) 25);
buf.putShort(ENDPOINT_PHONEVERSION);
buf.put((byte) 0x01);
buf.putInt(-1); //0xffffffff
buf.putInt(0);
buf.putInt(os);
buf.put(PHONEVERSION_APPVERSION_MAGIC);
buf.put((byte) 3); // major?
buf.put((byte) 0); // minor?
buf.put((byte) 1); // patch?
buf.put((byte) 3); // ???
buf.put((byte) 0); // ???
buf.put((byte) 0); // ???
buf.put((byte) 0); // ???
buf.putInt(0); // ???
return buf.array();
}
@Override
public byte[] encodePhoneVersion(byte os) {
return encodePhoneVersion3x(os);
}
@Override @Override
public byte[] encodeReboot() { public byte[] encodeReboot() {
return encodeSimpleMessage(ENDPOINT_RESET, RESET_REBOOT); return encodeSimpleMessage(ENDPOINT_RESET, RESET_REBOOT);