@@ -1953,8 +1953,7 @@ static int CmdHFFelicaDumpServiceArea(const char *Cmd) {
19531953 if (!check_last_idm (data , datalen ))
19541954 return PM3_EINVARG ;
19551955
1956- PrintAndLogEx (HINT , "Area and service code are printed in big endian." );
1957- PrintAndLogEx (HINT , "Don't forget to convert to little endian when using hf felica rdbl." );
1956+ PrintAndLogEx (HINT , "Area and service codes are printed in network order." );
19581957 PrintAndLogEx (INFO , "┌───────────────────────────────────────────────" );
19591958
19601959 uint8_t flags = FELICA_APPEND_CRC | FELICA_RAW ;
@@ -1986,7 +1985,9 @@ static int CmdHFFelicaDumpServiceArea(const char *Cmd) {
19861985 }
19871986
19881987 uint8_t len = resp .frame_response .length [0 ];
1989- uint16_t node_code = resp .payload [0 ] | (resp .payload [1 ] << 8 );
1988+ uint16_t node_code = resp .payload [0 ] | (resp .payload [1 ] << 8 ); /* LE for traversal */
1989+ uint16_t node_code_net = (resp .payload [0 ] << 8 ) | resp .payload [1 ]; /* BE for display */
1990+ uint16_t node_number = node_code >> 6 ; /* upper 10 bits in host order */
19901991
19911992 if (node_code == 0xFFFF ) break ; /* end-marker */
19921993
@@ -2007,13 +2008,16 @@ static int CmdHFFelicaDumpServiceArea(const char *Cmd) {
20072008 /* ----- print --------------------------------------------------- */
20082009 if (len == 0x0E ) { /* AREA node */
20092010 uint16_t end_code = resp .payload [2 ] | (resp .payload [3 ] << 8 );
2010- PrintAndLogEx (INFO , "%sAREA_%04X" , prefix , node_code >> 6 );
2011+ uint16_t end_number = end_code >> 6 ;
2012+ PrintAndLogEx (INFO , "%sAREA_%02X%02X%02X%02X (%u-%u)" , prefix ,
2013+ resp .payload [0 ], resp .payload [1 ], resp .payload [2 ], resp .payload [3 ],
2014+ node_number , end_number );
20112015
20122016 if (depth < 7 ) {
20132017 area_end_stack [++ depth ] = end_code ;
20142018 }
20152019 } else if (len == 0x0C ) { /* SERVICE */
2016- PrintAndLogEx (INFO , "%ssvc_ %04X" , prefix , node_code );
2020+ PrintAndLogEx (INFO , "%sSVC_ %04X (%u) " , prefix , node_code_net , node_number );
20172021 } else {
20182022 PrintAndLogEx (FAILED , "Unexpected length 0x%02X @ 0x%04X" ,
20192023 len , cursor );
0 commit comments