Dphi1 writting and login now works properly

This commit is contained in:
2026-04-10 18:42:01 +02:00
parent 02787c3e34
commit 6bc3309200

View File

@@ -61,6 +61,8 @@ static const KL_FaultCode s_default_dtcs[] = {
static const uint8_t kPwdBody_DFI[] = { 0x00, 0x03, 0xFF, 0xFF };
static const uint8_t kLoginBody_DFI[] = { 0x00, 0x00, 0x00, 0xBF, 0x30, 0x35, 0x30, 0x30, 0x30, 0x31, 0x1C, 0x09, 0x04 };
static const uint8_t kPwdBody_DFI_WRITE[] = { 0x00, 0x03, 0x2F, 0xFF, 'K','H','T','C','A','8','G','0','E' };
static const uint8_t kPwdBody_DFI_WRITE_815[] = { 0x00, 0x03, 0x2F, 0xFF, '0','5','0','0','0','1',0x1C,0x09,0x04 };
static const uint8_t kPwdBody_CUST[] = { 0x00, 0x00, 0x82, 0x33 };
static const uint8_t kLoginBody_CUST[] = { 0x00, 0x00, 0x9F, 0xFF, 0x30, 0x35, 0x30, 0x30, 0x30, 0x31, 0x1C, 0x09, 0x04 };
static const uint8_t kPwdBody_OEM_1[] = { 0x00, 0x02, 0x2E, 0x10 };
@@ -275,6 +277,10 @@ static void handle_login_eeprom(const KL_Packet *cmd)
app.eeprom_unlocked_dfi_write = 1;
login_body = kLoginBody_DFI;
login_len = sizeof(kLoginBody_DFI);
}else if (body_len == sizeof(kPwdBody_DFI_WRITE_815) && memcmp(body, kPwdBody_DFI_WRITE_815, sizeof(kPwdBody_DFI_WRITE_815)) == 0) {
app.eeprom_unlocked_dfi_write = 1;
login_body = kLoginBody_DFI;
login_len = sizeof(kLoginBody_DFI);
} else {
/* Wrong password -- clear all locks */
app.eeprom_unlocked_dfi = 0;
@@ -321,8 +327,13 @@ static void handle_write_eeprom(const KL_Packet *cmd)
s_dfi_code = (int8_t)value;
memWrite = 1;
uint8_t payload[1] = { (uint8_t)KL_CMD_WriteEepromResponse };
start_response(payload, 1);
uint8_t payload[5];
payload[0] = (uint8_t)KL_CMD_WriteEepromResponse;
payload[1] = (uint8_t)len_req;
payload[2] = (uint8_t)((addr >> 8) & 0xFF);
payload[3] = (uint8_t)(addr & 0xFF);
payload[4] = 0xFF;
start_response(payload, 5);
}
uint8_t SYNC_PULSE_OUT;