Skip to content

Commit f14a2e9

Browse files
committed
Fixed unit tests
1 parent f8ed369 commit f14a2e9

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

applications/debug/unit_tests/nfc/nfc_test.c

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -203,10 +203,21 @@ static void mf_ultralight_reader_test(const char* path) {
203203
NfcDevice* nfc_device = nfc_device_alloc();
204204
mu_assert(nfc_device_load(nfc_device, path), "nfc_device_load() failed\r\n");
205205

206-
NfcListener* mfu_listener = nfc_listener_alloc(
207-
listener,
208-
NfcProtocolMfUltralight,
209-
nfc_device_get_data(nfc_device, NfcProtocolMfUltralight));
206+
MfUltralightData* data =
207+
(MfUltralightData*)nfc_device_get_data(nfc_device, NfcProtocolMfUltralight);
208+
209+
uint32_t features = mf_ultralight_get_feature_support_set(data->type);
210+
bool pwd_supported =
211+
mf_ultralight_support_feature(features, MfUltralightFeatureSupportPasswordAuth);
212+
uint8_t pwd_num = mf_ultralight_get_pwd_page_num(data->type);
213+
const uint8_t zero_pwd[4] = {0, 0, 0, 0};
214+
215+
if(pwd_supported && !memcmp(data->page[pwd_num].data, zero_pwd, sizeof(zero_pwd))) {
216+
data->pages_read -= 2;
217+
}
218+
219+
NfcListener* mfu_listener = nfc_listener_alloc(listener, NfcProtocolMfUltralight, data);
220+
210221
nfc_listener_start(mfu_listener, NULL, NULL);
211222

212223
MfUltralightData* mfu_data = mf_ultralight_alloc();

0 commit comments

Comments
 (0)