AOR = [ # 202 items expected 0x0a,0xd8,0x0a,0xc8,0x0a,0xc0,0x0a,0xb0,0x0a,0xa8,0x0a,0x98,0x0a,0x90,0x0a,0x80,0x0a,0x78,0x0a,0x60,0x0a,0x48,0x0a,0x30,0x0a, 0x18,0x09,0xe0,0x09,0xd0,0x09,0xb8,0x09,0xa0,0x09,0x80,0x09,0x68,0x09,0x50,0x09,0x20,0x09,0x00,0x08,0xe8,0x08,0xd0,0x08,0x98, 0x08,0x80,0x08,0x68,0x08,0x48,0x08,0x38,0x08,0x28,0x07,0xe0,0x07,0xc0,0x07,0xa8,0x07,0x68,0x07,0x40,0x07,0x10,0x06,0xc0,0x06, 0x70,0x06,0x58,0x06,0x28,0x05,0xf0,0x05,0xb8,0x05,0x88,0x05,0x50,0x04,0xe0,0x04,0x90,0x04,0x60,0x04,0x20,0x03,0xf0,0x03,0xa0, 0x03,0x50,0x03,0x18,0x02,0xc0,0x02,0x60,0x02,0x58,0x02,0x58,0x02,0x58,0x02,0x58,0x02,0x58,0x02,0x58,0x02,0x58,0x02,0x58,0x02, 0x58,0x02,0x58,0x02,0x58,0x02,0x58,0x02,0x58,0x02,0x58,0x02,0x58,0x02,0x58,0x02,0x58,0x02,0x58,0x02,0x58,0x02,0x58,0x02,0x58, 0x02,0x58,0x02,0x58,0x02,0x58,0x02,0x58,0x02,0x58,0x02,0x58,0x02,0x58,0x02,0x58,0x02,0x70,0x02,0x30,0x01,0xe8,0x01,0xa8,0x01, 0x70,0x01,0x28,0x00,0xe0,0x00,0x98,0x00,0x70,0x00,0x70,0x00,0x70,0x00,0x70,0x00,0x70,0x00,0x70,0x00,0x70,0x00,0x70,0x00,0x70, 0x00,0x70 ] DELVSS = [ # 101 items expected 0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x84,0x85,0x86,0x86,0x87,0x87,0x87,0x88,0x89,0x89,0x8a,0x8b,0x8b,0x8c,0x8c,0x8d, 0x8d,0x8e,0x8f,0x8f,0x8f,0x8f,0x8f,0x8f,0x8f,0x8f,0x8f,0x8f,0x8f,0x8f,0x8f,0x8f,0x8f,0x8f,0x8f,0x8f,0x8f,0x8f,0x8f,0x8f,0x8f, 0x8f,0x8f,0x8f,0x8f,0x8f,0x8f,0x8f,0x8f,0x8f,0x8f,0x8f,0x8f,0x8f,0x8f,0x8f,0x8f,0x8f,0x8f,0x8f,0x8f,0x8f,0x8e,0x8d,0x8c,0x8b, 0x8a,0x8a,0x8a,0x89,0x89,0x88,0x87,0x86,0x86,0x86,0x86,0x86,0x86,0x86,0x86,0x86,0x86,0x85,0x85,0x84,0x83,0x82,0x82,0x81,0x81, 0x81 ] BrightLevelForACL = 79 ACLCutoffAndDelta = [ # at least (100 - BrightLevelForACL) * 2 items expected 0xe5,0x64,0xe5,0x64,0xe5,0x64,0xe5,0x64,0xd8,0x68,0xd8,0x68,0xd8,0x68,0xd8,0x68,0xd8,0x68,0xd8,0x68,0xd8,0x68,0xd8,0x68,0xd8, 0x68,0xd8,0x68,0xcc,0x68,0xcc,0x68,0xcc,0x68,0xcc,0x68,0xcc,0x68,0xcc,0x68,0xcc,0x68 ] IRC = [ # 909 items expected 0x03,0x03,0x03,0x00,0x01,0x00,0x01,0x01,0x01,0x03,0x03,0x03,0x01,0x01,0x00,0x00,0x01,0x01,0x03,0x04,0x03,0x01,0x00,0x01,0x01, 0x01,0x00,0x04,0x04,0x03,0x00,0x00,0x01,0x01,0x01,0x00,0x04,0x04,0x03,0x00,0x00,0x01,0x01,0x02,0x00,0x04,0x04,0x03,0x00,0x01, 0x01,0x01,0x01,0x01,0x04,0x04,0x03,0x00,0x01,0x01,0x02,0x01,0x01,0x04,0x05,0x04,0x01,0x00,0x00,0x01,0x01,0x01,0x04,0x05,0x04, 0x01,0x00,0x01,0x01,0x02,0x00,0x05,0x05,0x04,0x00,0x01,0x01,0x01,0x01,0x01,0x05,0x05,0x04,0x01,0x01,0x01,0x01,0x02,0x01,0x05, 0x06, 0x05,0x01,0x00,0x01,0x01,0x02,0x00,0x06,0x06,0x05,0x00,0x01,0x01,0x02,0x02,0x01,0x06,0x07,0x05,0x01,0x01,0x02,0x02,0x02,0x01, 0x07,0x07,0x06,0x00,0x01,0x01,0x02,0x02,0x01,0x07,0x08,0x06,0x01,0x00,0x01,0x02,0x03,0x01,0x07,0x08,0x06,0x01,0x01,0x02,0x02, 0x02,0x01,0x08,0x08,0x07,0x01,0x01,0x01,0x02,0x03,0x01,0x08,0x09,0x07,0x01,0x01,0x01,0x02,0x02,0x02,0x08,0x09,0x07,0x01,0x01, 0x02,0x03,0x03,0x01,0x09,0x0a,0x08,0x01,0x01,0x01,0x03,0x03,0x02,0x09,0x0a,0x08,0x01,0x01,0x02,0x03,0x03,0x01,0x0a,0x0a,0x08, 0x01, 0x02,0x02,0x02,0x03,0x02,0x0a,0x0b,0x09,0x01,0x01,0x02,0x03,0x03,0x01,0x0b,0x0c,0x09,0x01,0x01,0x02,0x03,0x03,0x02,0x0b,0x0c, 0x09,0x01,0x01,0x03,0x03,0x04,0x01,0x0b,0x0c,0x0a,0x02,0x02,0x02,0x03,0x03,0x02,0x0c,0x0d,0x0a,0x01,0x01,0x02,0x03,0x04,0x02, 0x0c,0x0d,0x0a,0x01,0x02,0x03,0x04,0x03,0x02,0x0c,0x0d,0x0a,0x02,0x02,0x03,0x03,0x04,0x02,0x0d,0x0e,0x0b,0x02,0x02,0x03,0x03, 0x04,0x02,0x0d,0x0e,0x0b,0x02,0x02,0x03,0x04,0x04,0x02,0x0e,0x0f,0x0c,0x01,0x02,0x02,0x04,0x04,0x03,0x0f,0x10,0x0c,0x01,0x02, 0x03, 0x04,0x04,0x03,0x0f,0x10,0x0d,0x02,0x02,0x03,0x04,0x05,0x02,0x10,0x11,0x0d,0x02,0x02,0x03,0x04,0x05,0x03,0x11,0x12,0x0e,0x02, 0x02,0x04,0x04,0x05,0x02,0x12,0x13,0x0f,0x02,0x02,0x04,0x05,0x06,0x02,0x12,0x13,0x0f,0x02,0x03,0x04,0x05,0x05,0x03,0x13,0x14, 0x10,0x02,0x03,0x04,0x05,0x05,0x03,0x13,0x15,0x10,0x03,0x02,0x04,0x05,0x06,0x03,0x14,0x16,0x11,0x02,0x02,0x04,0x06,0x06,0x03, 0x15,0x16,0x12,0x02,0x03,0x04,0x06,0x06,0x03,0x15,0x17,0x12,0x03,0x03,0x04,0x06,0x06,0x04,0x17,0x18,0x13,0x02,0x03,0x05,0x07, 0x07, 0x03,0x18,0x1a,0x14,0x03,0x03,0x05,0x06,0x07,0x04,0x19,0x1b,0x15,0x03,0x03,0x05,0x06,0x07,0x04,0x1a,0x1c,0x16,0x03,0x03,0x05, 0x07,0x08,0x04,0x1a,0x1c,0x16,0x03,0x04,0x06,0x08,0x08,0x04,0x1b,0x1e,0x17,0x04,0x03,0x06,0x07,0x08,0x04,0x1c,0x1f,0x18,0x04, 0x03,0x06,0x07,0x09,0x04,0x1d,0x1f,0x19,0x03,0x04,0x05,0x08,0x09,0x05,0x1e,0x20,0x1a,0x04,0x04,0x06,0x08,0x09,0x04,0x1f,0x21, 0x1a,0x04,0x05,0x07,0x08,0x09,0x05,0x20,0x23,0x1b,0x04,0x04,0x07,0x08,0x09,0x05,0x21,0x23,0x1c,0x04,0x05,0x06,0x08,0x09,0x06, 0x22, 0x25,0x1d,0x04,0x04,0x07,0x09,0x0a,0x05,0x23,0x26,0x1e,0x04,0x04,0x07,0x0a,0x0b,0x05,0x24,0x27,0x1f,0x04,0x05,0x07,0x0a,0x0a, 0x06,0x25,0x28,0x1f,0x04,0x05,0x08,0x0a,0x0b,0x06,0x26,0x29,0x21,0x05,0x05,0x07,0x0a,0x0c,0x06,0x28,0x2b,0x22,0x04,0x05,0x08, 0x0b,0x0c,0x06,0x29,0x2c,0x23,0x05,0x06,0x08,0x0b,0x0c,0x07,0x2a,0x2d,0x24,0x05,0x06,0x08,0x0b,0x0c,0x07,0x2b,0x2f,0x25,0x06, 0x05,0x09,0x0b,0x0d,0x06,0x2d,0x30,0x26,0x05,0x06,0x09,0x0c,0x0d,0x07,0x2e,0x32,0x27,0x06,0x06,0x09,0x0c,0x0d,0x08,0x30,0x33, 0x29, 0x05,0x07,0x09,0x0d,0x0e,0x08,0x31,0x35,0x29,0x06,0x06,0x0a,0x0d,0x0e,0x08,0x32,0x36,0x2a,0x06,0x06,0x0a,0x0d,0x0f,0x08,0x33, 0x37,0x2b,0x06,0x06,0x0a,0x0d,0x10,0x08,0x34,0x39,0x2c,0x07,0x06,0x0b,0x0e,0x10,0x08,0x36,0x3a,0x2e,0x06,0x07,0x0b,0x0f,0x11, 0x08,0x38,0x3c,0x30,0x07,0x08,0x0b,0x0f,0x11,0x09,0x39,0x3e,0x31,0x07,0x07,0x0b,0x10,0x12,0x09,0x3a,0x3f,0x32,0x07,0x08,0x0b, 0x10,0x11,0x0a,0x3c,0x40,0x33,0x07,0x08,0x0c,0x10,0x12,0x09,0x3d,0x42,0x34,0x07,0x08,0x0c,0x11,0x12,0x0a,0x3e,0x43,0x35,0x08, 0x08, 0x0c,0x11,0x13,0x0a,0x40,0x45,0x36,0x07,0x08,0x0d,0x11,0x13,0x0a,0x41,0x46,0x37,0x08,0x09,0x0d,0x11,0x13,0x0b,0x43,0x48,0x39, 0x08,0x09,0x0d,0x12,0x14,0x0b,0x45,0x4b,0x3b,0x08,0x08,0x0d,0x13,0x15,0x0b,0x46,0x4c,0x3c,0x09,0x09,0x0e,0x13,0x15,0x0b,0x48, 0x4d,0x3d,0x08,0x0a,0x0e,0x14,0x15,0x0c,0x49,0x4f,0x3e,0x09,0x0a,0x0f,0x14,0x16,0x0c,0x4b,0x51,0x3f,0x09,0x09,0x0f,0x14,0x17, 0x0c,0x4c,0x52,0x41,0x09,0x0a,0x0f,0x15,0x17,0x0c,0x4e,0x54,0x42,0x09,0x0a,0x10,0x15,0x18,0x0c,0x50,0x56,0x44,0x09,0x0a,0x10, 0x16, 0x18,0x0c,0x51,0x58,0x45,0x0a,0x0a,0x10,0x16,0x19,0x0d,0x53,0x5a,0x47,0x0a,0x0a,0x10,0x16,0x19,0x0d,0x55,0x5b,0x48,0x0a,0x0b, 0x11,0x17,0x1a,0x0d,0x56,0x5d,0x49,0x0b,0x0b,0x12,0x17,0x1a,0x0d,0x58,0x5f,0x4b,0x0b,0x0c,0x12,0x18,0x1a,0x0e,0x5a,0x61,0x4d, 0x0b,0x0c,0x12,0x18,0x1b,0x0e,0x5c,0x63,0x4e,0x0b,0x0c,0x12,0x18,0x1b,0x0f,0x5e,0x66,0x50,0x0b,0x0c,0x13,0x1a,0x1c,0x0f,0x60, 0x67,0x51,0x0b,0x0d,0x13,0x1a,0x1c,0x10,0x61,0x69,0x53,0x0c,0x0d,0x13,0x1a,0x1d,0x10,0x64,0x6c,0x55,0x0c,0x0d,0x14,0x1b,0x1e, 0x10 ] SP = [ # 101 items expected 0x0f,0x0f,0x10,0x10,0x11,0x11,0x12,0x12,0x13,0x14,0x15,0x16,0x16,0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1d,0x1f,0x1f,0x20,0x21,0x23, 0x24,0x25,0x25,0x26,0x27,0x29,0x29,0x2a,0x2d,0x2d,0x2f,0x31,0x34,0x34,0x36,0x37,0x39,0x3b,0x3c,0x3f,0x42,0x44,0x46,0x47,0x4a, 0x4c,0x4d,0x50,0x52,0x55,0x56,0x5a,0x5c,0x5f,0x62,0x65,0x69,0x6c,0x6f,0x73,0x76,0x7a,0x7e,0x81,0x84,0x86,0x8b,0x8f,0x94,0x98, 0x9a,0x9e,0xa2,0xa5,0xa9,0xac,0xb1,0xb7,0xbb,0xbd,0xc1,0xc4,0xc8,0xcb,0xcf,0xd3,0xd6,0xdb,0xdf,0xe4,0xe9,0xed,0xf3,0xf7,0xfc, 0xff ] Interpolation = [ # entry, base, delta, multiplier, bias, attenuation # entry must be 0..100 in increasing order, and the firmware generation code doesn't actually read or use it # (it's for the person typing out these numbers only) # base = 0..31 # delta = 0..30 # attenuation can't be 0 # formula used: # delta_value = gamma[delta][i] - gamma[delta + 1][i] # interpolated[entry][i] = gamma[base][i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, 55, 8, 7, 1, 1, 2, 56, 8, 7, 1, 2, 4, 57, 8, 7, 0, 0, 1, 58, 9, 8, 3, 2, 4, 59, 9, 8, 1, 1, 2, 60, 9, 8, 1, 2, 4, 61, 9, 8, 0, 0, 1, 62, 10, 9, 2, 1, 3, 63, 10, 9, 1, 1, 3, 64, 10, 9, 0, 0, 1, 65, 11, 10, 2, 1, 3, 66, 11, 10, 1, 1, 3, 67, 11, 10, 0, 0, 1, 68, 12, 11, 2, 1, 3, 69, 12, 11, 1, 1, 3, 70, 12, 11, 0, 0, 1, 71, 13, 12, 3, 2, 4, 72, 13, 12, 1, 1, 2, 73, 13, 12, 1, 2, 4, 74, 13, 12, 0, 0, 1, 75, 14, 13, 2, 1, 3, 76, 14, 13, 1, 1, 3, 77, 14, 13, 0, 0, 1, 78, 15, 14, 0, 0, 1, 79, 16, 15, 1, 1, 2, 80, 16, 15, 0, 0, 1, 81, 17, 16, 0, 0, 1, 82, 18, 17, 0, 0, 1, 83, 19, 18, 1, 1, 2, 84, 19, 18, 0, 0, 1, 85, 20, 19, 0, 0, 1, 86, 21, 20, 0, 0, 1, 87, 22, 21, 0, 0, 1, 88, 23, 22, 0, 0, 1, 89, 24, 23, 0, 0, 1, 90, 25, 24, 0, 0, 1, 91, 26, 25, 0, 0, 1, 92, 27, 26, 0, 0, 1, 93, 28, 27, 1, 1, 2, 94, 28, 27, 0, 0, 1, 95, 29, 28, 1, 1, 2, 96, 29, 28, 0, 0, 1, 97, 30, 29, 1, 1, 2, 98, 30, 29, 0, 0, 1, 99, 31, 30, 1, 1, 2, 100, 31, 30, 0, 0, 1, ] if len(AOR) != 202: print(f"Unexpected length of AOR: {len(AOR)} != 202") exit(1) if len(DELVSS) != 101: print(f"Unexpected length of DELVSS: {len(DELVSS)} != 101") exit(1) if len(ACLCutoffAndDelta) < (100 - BrightLevelForACL) * 2: print(f"Not enough items in ACLCutoffAndDelta: {len(ACLCutoffAndDelta)} < (100 - {BrightLevelForACL}) * 2") exit(1) if len(ACLCutoffAndDelta) > 200: print(f"Too many items in ACLCutoffAndDelta: {len(ACLCutoffAndDelta)}") exit(1) if len(IRC) != 909: print(f"Unexpected length of IRC: {len(IRC)} != 909") exit(1) if len(SP) != 101: print(f"Unexpected length of SP: {len(SP)} != 101") exit(1) if len(Interpolation) != 606: print(f"Invalid length for the interpolation array: {len(Interpolation)} != 606") output = bytes() output += len(AOR).to_bytes(2, "little") + bytes(AOR) output += len(DELVSS).to_bytes(2, "little") + bytes(DELVSS) output += BrightLevelForACL.to_bytes(2, "little") output += len(ACLCutoffAndDelta).to_bytes(2, "little") + bytes(ACLCutoffAndDelta) output += len(IRC).to_bytes(2, "little") + bytes(IRC) output += len(SP).to_bytes(2, "little") + bytes(SP) output += (101 * 5).to_bytes(2, "little") for i in range(0, 101): [_, b, d, mult, bias, attn] = Interpolation[i * 6:(i + 1) * 6] if b > 31 or d > 30 or b < 0 or d < 0 or attn == 0: print(f"Interpolation has invalid values in row {i}") exit(1) output += bytes([b, d, mult, bias, attn]) with open("intel_legacy_panel_data.bin", "wb") as f: f.write(output)