Merge branch 'slix_test' into dev

This commit is contained in:
MX 2024-03-15 04:08:43 +03:00
commit d7711d729f
No known key found for this signature in database
GPG key ID: 7CCC66B7DBDD1C83
9 changed files with 134 additions and 20 deletions

View file

@ -983,3 +983,41 @@ type: raw
frequency: 38000
duty_cycle: 0.330000
data: 301 132136 5036 2167 337 1766 361 689 358 692 366 684 363 1770 357 692 366 684 363 718 329 690 357 1776 361 687 360 1773 364 1767 360 689 358 1775 362 1769 357 1774 363 1768 359 1773 364 684 363 718 329 1773 364 684 363 718 329 691 356 694 364 716 331 719 328 1775 362 1769 358 1774 363 1768 359 1772 365 714 333 1770 357 1774 363 716 331 719 328 722 336 715 332 718 329 721 326 724 334 716 331 719 328 722 336 715 332 718 329 1773 364 1767 360 1772 354 1777 360 719 328 721 326 725 333 717 330 29455 5036 2139 354 1777 360 688 359 691 367 714 333 1770 356 692 366 684 363 687 360 690 357 1776 361 688 359 1773 364 1768 359 689 358 1775 362 1769 357 1774 363 1768 359 1773 364 684 363 687 360 1773 364 685 362 688 359 691 356 694 364 686 361 689 358 692 366 685 362 688 359 691 356 1777 360 1771 355 693 365 685 362 1771 355 693 365 1768 359 1773 364 1767 360 689 358 692 366 685 362 1771 355 1775 362 687 360 690 357 1775 362 687 360 690 357 693 365 716 331 689 358 1774 363 686 361 689 358 692 366 685 362 688 359 691 356 694 364 686 361 689 358 692 366 685 362 688 359 691 356 694 364 686 361 689 358 692 366 685 362 1771 355 693 365 1768 358 1773 364 684 363 687 360 690 357 693 365 1768 359 690 357 1776 361 688 359 691 356 694 364 686 361 689 358 692 366 685 362 1770 356 693 365 685 362 688 359 691 356 1777 360 1771 355 693 365 686 361 689 358 692 366 685 362 1770 356
#
# Model: Fujitsu ASYG24KMTB
#
name: Dh
type: raw
frequency: 38000
duty_cycle: 0.330000
data: 3302 1639 405 423 407 420 410 1234 405 421 409 1210 440 387 432 420 410 417 413 1231 408 1238 412 388 431 422 408 392 438 1233 406 1238 412 389 430 396 434 419 411 390 440 413 406 394 436 391 439 388 431 421 409 417 413 414 405 421 409 392 438 1233 406 421 409 417 413 414 405 395 435 418 412 388 432 421 409 1236 414 387 432 420 410 390 440 388 431 1213 437 1208 431 1239 411 1234 405 1213 437 1208 431 1214 436 1235 415 386 433 420 410 1234 405 422 408 418 412 389 431 396 434 1211 439 388 432 422 408 418 412 1233 406 1238 412 415 404 422 408 1237 413 388 432 422 408 1236 414 1205 434 1210 440 1205 434 392 438 390 440 1231 408 392 438 415 404 396 434 392 438 415 404 422 408 419 411 416 414 412 407 394 436 417 413 414 405 421 409 417 413 1232 407 419 411 390 440 1204 435 418 412 415 415 412 407 419 411 1208 431 421 409 418 412 388 432 421 409 392 438 415 404 395 435 1211 439 388 432 1213 437 416 414 386 433 1212 438 415 404 396 434 392 438 416 414 413 406 420 410 417 413 1231 409 418 412 389 430 1240 410 391 439 1205 434 420 410 390 440 387 432 420 410 417 413
#
name: Cool_hi
type: raw
frequency: 38000
duty_cycle: 0.330000
data: 3293 1649 405 396 434 419 411 1207 432 395 435 1236 414 413 406 394 436 417 413 1232 407 1212 438 415 404 396 434 419 411 1234 405 1239 411 417 413 414 405 421 409 419 411 389 430 423 407 393 437 416 414 387 432 394 436 417 413 388 431 421 409 1236 414 387 432 421 409 418 412 414 405 422 408 418 412 415 404 1240 410 391 439 414 405 421 409 419 411 1234 405 1239 411 1208 431 1239 411 1235 404 1214 436 1210 440 1205 434 419 411 416 414 1204 435 418 412 415 404 396 434 393 437 1235 404 396 434 420 410 416 414 1231 408 1210 440 387 432 421 409 1235 415 414 405 395 435 418 412 1232 407 420 410 1208 431 422 408 1237 413 415 404 396 434 419 411 416 414 413 406 420 410 417 413 414 405 421 409 418 412 415 404 422 408 419 411 416 414 413 406 1238 412 415 404 422 408 1237 413 414 405 421 409 418 412 416 414 1231 408 418 412 415 404 422 408 419 411 416 414 413 406 420 410 1235 404 423 407 420 410 1234 405 422 408 1210 440 414 405 421 409 392 438 415 404 422 408 420 410 417 413 1231 408 419 411 416 414 413 406 1237 413 415 404 1239 411 417 413 1232 407 420 410 417 413
#
name: Cool_lo
type: raw
frequency: 38000
duty_cycle: 0.330000
data: 3302 1614 440 414 405 421 409 1235 414 413 406 1238 411 415 404 422 408 419 411 1234 405 1240 409 418 412 415 404 422 408 1237 412 1232 407 420 410 417 413 414 405 422 408 419 411 416 414 413 406 420 410 417 413 414 405 421 409 418 412 415 404 1239 410 418 412 415 404 422 408 419 411 416 414 413 406 420 410 1234 405 422 408 419 411 416 414 414 405 1239 411 1207 432 1239 410 1235 414 1230 409 1236 413 1232 407 1237 412 415 415 412 407 1237 412 414 405 422 408 419 411 416 414 1231 408 419 411 416 414 413 406 1238 411 1206 433 421 409 418 412 1206 433 421 409 418 412 1206 433 1238 412 1207 432 1213 436 390 440 1232 407 420 410 417 413 414 405 421 409 418 412 415 404 422 408 419 411 416 414 413 406 421 409 418 412 415 404 422 408 419 411 1233 406 421 409 418 412 1232 407 420 410 418 412 389 430 422 408 1210 440 414 405 395 435 418 412 415 404 423 407 420 410 416 414 414 405 422 408 418 412 415 404 1240 409 1235 414 413 406 420 410 417 413 414 405 422 408 419 411 416 414 1231 408 418 412 415 404 1240 409 1209 440 387 432 1212 437 1234 405 1214 435 1209 440 1204 435
#
name: Heat_hi
type: raw
frequency: 38000
duty_cycle: 0.330000
data: 3301 1615 439 415 404 422 408 1210 439 414 405 1239 410 416 414 414 405 395 435 1209 440 1205 434 419 411 417 413 414 405 1212 437 1207 432 422 408 419 411 416 414 414 405 421 409 418 412 415 404 422 408 393 437 416 414 413 406 420 410 417 413 1205 434 420 410 417 413 414 405 421 409 418 412 415 404 422 408 1210 439 414 405 422 408 419 411 417 413 1205 434 1236 413 1206 433 1211 438 1207 432 1212 437 1209 440 1204 435 418 412 415 415 1204 435 418 412 415 404 422 408 419 411 1208 441 412 407 420 410 417 413 1205 434 1237 412 414 405 422 408 1210 439 415 404 396 434 419 411 1207 432 1213 436 417 413 1205 434 420 410 417 413 1231 408 419 411 416 414 413 406 421 409 418 412 414 405 422 408 419 411 415 404 424 406 421 409 418 412 415 404 1239 410 417 413 414 405 1239 410 416 414 413 406 422 408 419 411 1233 406 421 409 418 412 415 404 423 407 419 411 416 414 413 406 1238 411 416 414 413 406 421 409 1235 414 1230 409 418 412 415 415 412 407 420 410 417 413 414 405 422 408 1236 413 413 406 421 409 1235 414 1204 435 1210 439 1206 433 1212 437 1207 432 395 435 1236 413
#
name: Heat_lo
type: raw
frequency: 38000
duty_cycle: 0.330000
data: 3295 1646 408 420 410 390 440 1205 434 393 437 1234 405 421 409 419 411 415 415 1230 409 1210 440 414 405 421 409 418 412 1233 406 1212 437 416 414 413 406 394 436 418 412 415 404 422 408 393 437 416 414 413 406 420 410 417 413 414 405 421 409 1236 413 414 405 421 409 418 412 415 404 423 407 419 411 416 414 1231 408 418 412 415 415 412 407 421 409 1235 414 1204 435 1209 441 1205 434 1210 440 1205 434 1212 437 1207 432 395 435 419 411 1233 406 421 409 418 412 415 404 422 408 1238 411 415 404 396 434 419 411 1234 405 1239 410 417 413 414 405 1213 436 417 413 414 405 1213 436 1235 404 1214 435 1209 441 413 406 421 409 418 412 1206 433 394 436 418 412 388 431 422 408 419 411 415 415 386 433 420 410 418 412 414 405 422 408 419 411 389 430 1241 408 418 412 415 404 1240 409 417 413 414 405 395 435 419 411 1233 406 395 435 418 412 415 404 422 408 419 411 416 414 413 406 421 409 1236 413 413 406 394 436 1235 414 1230 409 418 412 415 404 422 408 420 410 417 413 414 405 421 409 1236 413 413 406 420 410 417 413 1232 407 1237 412 416 414 1230 409 1236 413 1205 434 1210 439
#
name: Off
type: raw
frequency: 38000
duty_cycle: 0.330000
data: 3302 1640 404 423 407 420 410 1212 437 390 440 1234 405 395 435 392 438 415 415 1207 432 1242 407 420 410 391 439 414 405 1243 406 1241 408 392 438 415 415 386 433 393 437 390 440 414 405 396 434 419 411 389 441 412 407 420 410 390 440 387 432 1242 407 393 437 390 440 414 405 395 435 392 438 389 430 396 434 1240 409 417 413 414 405 395 435 419 411 1237 412 389 430 396 434 393 437 416 414 387 432 394 436 1212 437 389 441 1234 405 1217 432 1241 408 1213 436 1212 437 1210 439

View file

@ -225,8 +225,8 @@ static bool mf_desfire_poller_detect(NfcGenericEvent event, void* context) {
bool protocol_detected = false;
if(iso14443_4a_event->type == Iso14443_4aPollerEventTypeReady) {
MfDesfireVersion version = {};
const MfDesfireError error = mf_desfire_poller_read_version(instance, &version);
MfDesfireKeyVersion key_version = 0;
MfDesfireError error = mf_desfire_poller_read_key_version(instance, 0, &key_version);
protocol_detected = (error == MfDesfireErrorNone);
}

View file

@ -91,6 +91,21 @@ MfDesfireError
MfDesfireError
mf_desfire_poller_read_key_settings(MfDesfirePoller* instance, MfDesfireKeySettings* data);
/**
* @brief Read key version on MfDesfire card.
*
* Must ONLY be used inside the callback function.
*
* @param[in, out] instance pointer to the instance to be used in the transaction.
* @param[out] key_num key number.
* @param[in] data pointer to the MfDesfireKeyVersion structure to be filled with key version data.
* @return MfDesfireErrorNone on success, an error code on failure.
*/
MfDesfireError mf_desfire_poller_read_key_version(
MfDesfirePoller* instance,
uint8_t key_num,
MfDesfireKeyVersion* data);
/**
* @brief Read key versions on MfDesfire card.
*

View file

@ -139,6 +139,28 @@ MfDesfireError
return error;
}
MfDesfireError mf_desfire_poller_read_key_version(
MfDesfirePoller* instance,
uint8_t key_num,
MfDesfireKeyVersion* data) {
furi_assert(instance);
furi_assert(data);
bit_buffer_set_size_bytes(instance->input_buffer, sizeof(uint8_t) * 2);
bit_buffer_set_byte(instance->input_buffer, 0, MF_DESFIRE_CMD_GET_KEY_VERSION);
bit_buffer_set_byte(instance->input_buffer, 1, key_num);
MfDesfireError error =
mf_desfire_send_chunks(instance, instance->input_buffer, instance->result_buffer);
if(error == MfDesfireErrorNone) {
if(!mf_desfire_key_version_parse(data, instance->result_buffer)) {
error = MfDesfireErrorProtocol;
}
}
return error;
}
MfDesfireError mf_desfire_poller_read_key_versions(
MfDesfirePoller* instance,
SimpleArray* data,
@ -148,22 +170,11 @@ MfDesfireError mf_desfire_poller_read_key_versions(
simple_array_init(data, count);
bit_buffer_set_size_bytes(instance->input_buffer, sizeof(uint8_t) * 2);
bit_buffer_set_byte(instance->input_buffer, 0, MF_DESFIRE_CMD_GET_KEY_VERSION);
MfDesfireError error = MfDesfireErrorNone;
for(uint32_t i = 0; i < count; ++i) {
bit_buffer_set_byte(instance->input_buffer, 1, i);
error = mf_desfire_send_chunks(instance, instance->input_buffer, instance->result_buffer);
error = mf_desfire_poller_read_key_version(instance, i, simple_array_get(data, i));
if(error != MfDesfireErrorNone) break;
if(!mf_desfire_key_version_parse(simple_array_get(data, i), instance->result_buffer)) {
error = MfDesfireErrorProtocol;
break;
}
}
return error;

View file

@ -78,8 +78,8 @@ typedef struct {
static const SlixPasswordConfig slix_password_configs[] = {
[SlixPasswordTypeRead] = {SLIX_PASSWORD_READ_KEY, SLIX_TYPE_FEATURE_READ, 0x00000000U},
[SlixPasswordTypeWrite] = {SLIX_PASSWORD_WRITE_KEY, SLIX_TYPE_FEATURE_WRITE, 0x00000000U},
[SlixPasswordTypePrivacy] = {SLIX_PASSWORD_PRIVACY_KEY, SLIX_TYPE_FEATURE_PRIVACY, 0xFFFFFFFFU},
[SlixPasswordTypeDestroy] = {SLIX_PASSWORD_DESTROY_KEY, SLIX_TYPE_FEATURE_DESTROY, 0xFFFFFFFFU},
[SlixPasswordTypePrivacy] = {SLIX_PASSWORD_PRIVACY_KEY, SLIX_TYPE_FEATURE_PRIVACY, 0x0F0F0F0FU},
[SlixPasswordTypeDestroy] = {SLIX_PASSWORD_DESTROY_KEY, SLIX_TYPE_FEATURE_DESTROY, 0x0F0F0F0FU},
[SlixPasswordTypeEasAfi] = {SLIX_PASSWORD_EAS_KEY, SLIX_TYPE_FEATURE_EAS, 0x00000000U},
};

View file

@ -73,17 +73,62 @@ static NfcCommand slix_poller_handler_read_signature(SlixPoller* instance) {
if(slix_type_has_features(instance->type, SLIX_TYPE_FEATURE_SIGNATURE)) {
instance->error = slix_poller_read_signature(instance, &instance->data->signature);
if(instance->error == SlixErrorNone) {
instance->poller_state = SlixPollerStateReady;
instance->poller_state = SlixPollerStateCheckPrivacyPassword;
} else {
instance->poller_state = SlixPollerStateError;
}
} else {
instance->poller_state = SlixPollerStateReady;
instance->poller_state = SlixPollerStateCheckPrivacyPassword;
}
return NfcCommandContinue;
}
static NfcCommand slix_poller_handler_check_privacy_password(SlixPoller* instance) {
NfcCommand command = NfcCommandContinue;
do {
if(!slix_type_has_features(instance->type, SLIX_TYPE_FEATURE_PRIVACY)) {
instance->poller_state = SlixPollerStateReady;
break;
}
if(instance->privacy_password_checked) {
instance->poller_state = SlixPollerStateReady;
break;
}
instance->slix_event.type = SlixPollerEventTypePrivacyUnlockRequest;
command = instance->callback(instance->general_event, instance->context);
if(!instance->slix_event_data.privacy_password.password_set) {
instance->poller_state = SlixPollerStateReady;
break;
}
SlixPassword pwd = instance->slix_event_data.privacy_password.password;
FURI_LOG_I(TAG, "Trying to check privacy password: %08lX", pwd);
instance->error = slix_poller_get_random_number(instance, &instance->random_number);
if(instance->error != SlixErrorNone) {
instance->poller_state = SlixPollerStateReady;
break;
}
instance->error = slix_poller_set_password(instance, SlixPasswordTypePrivacy, pwd);
if(instance->error != SlixErrorNone) {
command = NfcCommandReset;
break;
}
FURI_LOG_I(TAG, "Found privacy password");
instance->data->passwords[SlixPasswordTypePrivacy] = pwd;
instance->privacy_password_checked = true;
instance->poller_state = SlixPollerStateReady;
} while(false);
return command;
}
static NfcCommand slix_poller_handler_privacy_unlock(SlixPoller* instance) {
NfcCommand command = NfcCommandContinue;
instance->poller_state = SlixPollerStateError;
@ -108,6 +153,7 @@ static NfcCommand slix_poller_handler_privacy_unlock(SlixPoller* instance) {
FURI_LOG_I(TAG, "Privacy mode disabled");
instance->data->passwords[SlixPasswordTypePrivacy] = pwd;
instance->privacy_password_checked = true;
instance->poller_state = SlixPollerStateIdle;
slix_unlocked = true;
} while(false);
@ -140,6 +186,7 @@ static const SlixPollerStateHandler slix_poller_state_handler[SlixPollerStateNum
[SlixPollerStateError] = slix_poller_handler_error,
[SlixPollerStateGetNxpSysInfo] = slix_poller_handler_get_nfc_system_info,
[SlixPollerStateReadSignature] = slix_poller_handler_read_signature,
[SlixPollerStateCheckPrivacyPassword] = slix_poller_handler_check_privacy_password,
[SlixPollerStatePrivacyUnlock] = slix_poller_handler_privacy_unlock,
[SlixPollerStateReady] = slix_poller_handler_ready,
};

View file

@ -14,6 +14,7 @@ typedef enum {
SlixPollerStateIdle,
SlixPollerStateGetNxpSysInfo,
SlixPollerStateReadSignature,
SlixPollerStateCheckPrivacyPassword,
SlixPollerStatePrivacyUnlock,
SlixPollerStateReady,
SlixPollerStateError,
@ -27,6 +28,7 @@ struct SlixPoller {
SlixPollerState poller_state;
SlixError error;
SlixRandomNumber random_number;
bool privacy_password_checked;
BitBuffer* tx_buffer;
BitBuffer* rx_buffer;

View file

@ -1,5 +1,5 @@
entry,status,name,type,params
Version,+,58.0,,
Version,+,58.1,,
Header,+,applications/services/bt/bt_service/bt.h,,
Header,+,applications/services/cli/cli.h,,
Header,+,applications/services/cli/cli_vcp.h,,

1 entry status name type params
2 Version + 58.0 58.1
3 Header + applications/services/bt/bt_service/bt.h
4 Header + applications/services/cli/cli.h
5 Header + applications/services/cli/cli_vcp.h

View file

@ -1,5 +1,5 @@
entry,status,name,type,params
Version,+,58.0,,
Version,+,58.1,,
Header,+,applications/drivers/subghz/cc1101_ext/cc1101_ext_interconnect.h,,
Header,+,applications/services/bt/bt_service/bt.h,,
Header,+,applications/services/cli/cli.h,,
@ -2492,6 +2492,7 @@ Function,+,mf_desfire_poller_read_file_settings_multi,MfDesfireError,"MfDesfireP
Function,+,mf_desfire_poller_read_file_value,MfDesfireError,"MfDesfirePoller*, MfDesfireFileId, MfDesfireFileData*"
Function,+,mf_desfire_poller_read_free_memory,MfDesfireError,"MfDesfirePoller*, MfDesfireFreeMemory*"
Function,+,mf_desfire_poller_read_key_settings,MfDesfireError,"MfDesfirePoller*, MfDesfireKeySettings*"
Function,+,mf_desfire_poller_read_key_version,MfDesfireError,"MfDesfirePoller*, uint8_t, MfDesfireKeyVersion*"
Function,+,mf_desfire_poller_read_key_versions,MfDesfireError,"MfDesfirePoller*, SimpleArray*, uint32_t"
Function,+,mf_desfire_poller_read_version,MfDesfireError,"MfDesfirePoller*, MfDesfireVersion*"
Function,+,mf_desfire_poller_select_application,MfDesfireError,"MfDesfirePoller*, const MfDesfireApplicationId*"

1 entry status name type params
2 Version + 58.0 58.1
3 Header + applications/drivers/subghz/cc1101_ext/cc1101_ext_interconnect.h
4 Header + applications/services/bt/bt_service/bt.h
5 Header + applications/services/cli/cli.h
2492 Function + mf_desfire_poller_read_file_value MfDesfireError MfDesfirePoller*, MfDesfireFileId, MfDesfireFileData*
2493 Function + mf_desfire_poller_read_free_memory MfDesfireError MfDesfirePoller*, MfDesfireFreeMemory*
2494 Function + mf_desfire_poller_read_key_settings MfDesfireError MfDesfirePoller*, MfDesfireKeySettings*
2495 Function + mf_desfire_poller_read_key_version MfDesfireError MfDesfirePoller*, uint8_t, MfDesfireKeyVersion*
2496 Function + mf_desfire_poller_read_key_versions MfDesfireError MfDesfirePoller*, SimpleArray*, uint32_t
2497 Function + mf_desfire_poller_read_version MfDesfireError MfDesfirePoller*, MfDesfireVersion*
2498 Function + mf_desfire_poller_select_application MfDesfireError MfDesfirePoller*, const MfDesfireApplicationId*