From 9c42daabea0d1b1b6c404e66ca1d63389801f859 Mon Sep 17 00:00:00 2001 From: kormax <3392860+kormax@users.noreply.github.com> Date: Fri, 24 Jul 2026 21:32:00 +0300 Subject: [PATCH] Add annotation for extended FeliCa commands --- client/src/cmdhflist.c | 48 ++++++++++++++++++++++++++++++++++++++++++ include/protocols.h | 23 +++++++++++++++++++- 2 files changed, 70 insertions(+), 1 deletion(-) diff --git a/client/src/cmdhflist.c b/client/src/cmdhflist.c index b5d1e8e7d..ec44bc40e 100644 --- a/client/src/cmdhflist.c +++ b/client/src/cmdhflist.c @@ -2648,6 +2648,54 @@ void annotateFelica(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize) { case FELICA_WRTSECV2_ACK: snprintf(exp, size, "WRITE v2 ACK"); break; + case FELICA_NFC_DEP_ATR_REQ: + snprintf(exp, size, "NFC-DEP ATR REQ"); + break; + case FELICA_NFC_DEP_ATR_RES: + snprintf(exp, size, "NFC-DEP ATR RES"); + break; + case FELICA_NFC_DEP_PSL_REQ: + snprintf(exp, size, "NFC-DEP PSL REQ"); + break; + case FELICA_NFC_DEP_PSL_RES: + snprintf(exp, size, "NFC-DEP PSL RES"); + break; + case FELICA_NFC_DEP_DEP_REQ: + snprintf(exp, size, "NFC-DEP DEP REQ"); + break; + case FELICA_NFC_DEP_DEP_RES: + snprintf(exp, size, "NFC-DEP DEP RES"); + break; + case FELICA_NFC_DEP_DSL_REQ: + snprintf(exp, size, "NFC-DEP DSL REQ"); + break; + case FELICA_NFC_DEP_DSL_RES: + snprintf(exp, size, "NFC-DEP DSL RES"); + break; + case FELICA_NFC_DEP_RLS_REQ: + snprintf(exp, size, "NFC-DEP RLS REQ"); + break; + case FELICA_NFC_DEP_RLS_RES: + snprintf(exp, size, "NFC-DEP RLS RES"); + break; + case FELICA_ATTR_REQ: + snprintf(exp, size, "ATTR"); + break; + case FELICA_ATTR_RES: + snprintf(exp, size, "ATTR RES"); + break; + case FELICA_HLT_REQ: + snprintf(exp, size, "HLT"); + break; + case FELICA_HLT_RES: + snprintf(exp, size, "HLT RES"); + break; + case FELICA_WUP_REQ: + snprintf(exp, size, "WUP"); + break; + case FELICA_WUP_RES: + snprintf(exp, size, "WUP RES"); + break; case FELICA_UPDATE_RNDID_REQ: snprintf(exp, size, "UPDATE RANDOM ID"); break; diff --git a/include/protocols.h b/include/protocols.h index 9651f1f51..b61274419 100644 --- a/include/protocols.h +++ b/include/protocols.h @@ -1058,7 +1058,7 @@ ISO 7816-4 Basic interindustry commands. For command APDU's. #define FELICA_FALP_TRANSMIT_DATA 0xBC // Command codes >= 0xC0 consist of two bytes; the second byte is the function code. -// Payload data, including the IDM, if present, is hence shifted by one byte to the right +// Payload data, including the IDM, if present, is hence shifted by one byte to the right. // DCK encapsulation commands mentioned in the CCC specification #define FELICA_DCK_ENCAPSULATION_CAPDU_DATA 0xC200 @@ -1087,6 +1087,27 @@ ISO 7816-4 Basic interindustry commands. For command APDU's. #define FELICA_SET_BAUD_RATE_CMD 0xCC13 #define FELICA_SET_BAUD_RATE_RES 0xCD13 +// NFC-DEP PDUs over NFC-F: the first byte specifies the direction and the second the PDU type. +// Unlike other extended commands, both the command code and function code is incremented on response. +#define FELICA_NFC_DEP_ATR_REQ 0xD400 +#define FELICA_NFC_DEP_ATR_RES 0xD501 +#define FELICA_NFC_DEP_PSL_REQ 0xD404 +#define FELICA_NFC_DEP_PSL_RES 0xD505 +#define FELICA_NFC_DEP_DEP_REQ 0xD406 +#define FELICA_NFC_DEP_DEP_RES 0xD507 +#define FELICA_NFC_DEP_DSL_REQ 0xD408 +#define FELICA_NFC_DEP_DSL_RES 0xD509 +#define FELICA_NFC_DEP_RLS_REQ 0xD40A +#define FELICA_NFC_DEP_RLS_RES 0xD50B + +// These commands are defined by JIS X 6319-4 but have not been observed on any real targets. +#define FELICA_ATTR_REQ 0xD600 +#define FELICA_ATTR_RES 0xD701 +#define FELICA_HLT_REQ 0xD602 +#define FELICA_HLT_RES 0xD703 +#define FELICA_WUP_REQ 0xD604 +#define FELICA_WUP_RES 0xD705 + // Unlike most two-byte commands, works on all FeliCa targets; response code matches the command code #define FELICA_ECHO_REQ 0xF000