Work-around short type-A frame notification bug
Bug: 339479509
Test: manual verification with test app
Change-Id: I65da8c3fb48475160dee050e37e3b8d13d192204
diff --git a/st21nfc/hal/hal_fwlog.cc b/st21nfc/hal/hal_fwlog.cc
index eaddb9d..8704639 100644
--- a/st21nfc/hal/hal_fwlog.cc
+++ b/st21nfc/hal/hal_fwlog.cc
@@ -26,6 +26,7 @@
#include <string.h>
#include "android_logmsg.h"
#include "halcore.h"
+#include "hal_fd.h"
extern void DispHal(const char* title, const void* data, size_t length);
@@ -69,10 +70,20 @@
case T_CERxError:
case T_CERx: {
STLOG_HAL_D("%s - T_CERx", __func__);
- int tlv_size = tlvBuffer[1]-2;
+ int tlv_size = tlvBuffer[1] - 2;
if (tlv_size < 9) {
- tlv_size = 8;
+ tlv_size = 8;
}
+
+ // work-around type-A short frame notification bug
+ if (hal_fd_getFwInfo()->chipHwVersion == HW_ST54J &&
+ (tlvBuffer[2] & 0xF) == 0x01 && // short frame
+ tlvBuffer[5] == 0x00 && // no error
+ tlvBuffer[6] == 0x0F // incorrect real size
+ ) {
+ tlv_size = 9;
+ }
+
value_len = tlv_size- 3;
*NewTlv = (uint8_t*)malloc(tlv_size * sizeof(uint8_t));
uint8_t gain;