Skip to content

Commit

Permalink
Handle SAM removal better
Browse files Browse the repository at this point in the history
  • Loading branch information
bettse committed Jun 23, 2024
1 parent 6f2d852 commit ae535f9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
11 changes: 10 additions & 1 deletion ccid.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ size_t seader_ccid_process(Seader* seader, uint8_t* cmd, size_t cmd_len) {
for(uint8_t i = 0; i < cmd_len; i++) {
snprintf(display + (i * 2), sizeof(display), "%02x", cmd[i]);
}
// FURI_LOG_D(TAG, "UART %d: %s", cmd_len, display);
FURI_LOG_D(TAG, "UART %d: %s", cmd_len, display);

if(cmd_len == 2) {
if(cmd[0] == CCID_MESSAGE_TYPE_RDR_to_PC_NotifySlotChange) {
Expand All @@ -164,6 +164,10 @@ size_t seader_ccid_process(Seader* seader, uint8_t* cmd, size_t cmd_len) {
powered[0] = false;
hasSAM = false;
retries = 3;
if(seader_worker->callback) {
seader_worker->callback(
SeaderWorkerEventSamMissing, seader_worker->context);
}
}
break;
};
Expand All @@ -187,6 +191,10 @@ size_t seader_ccid_process(Seader* seader, uint8_t* cmd, size_t cmd_len) {
powered[1] = false;
hasSAM = false;
retries = 3;
if(seader_worker->callback) {
seader_worker->callback(
SeaderWorkerEventSamMissing, seader_worker->context);
}
}
break;
};
Expand Down Expand Up @@ -276,6 +284,7 @@ size_t seader_ccid_process(Seader* seader, uint8_t* cmd, size_t cmd_len) {
//0306 80 00000000 0001 42fe 00 38
if(message.bStatus == 0x41 && message.bError == 0xfe) {
FURI_LOG_W(TAG, "card probably upside down");
hasSAM = false;
if(seader_worker->callback) {
seader_worker->callback(SeaderWorkerEventSamMissing, seader_worker->context);
}
Expand Down
3 changes: 3 additions & 0 deletions scenes/seader_scene_sam_present.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ bool seader_scene_sam_present_on_event(void* context, SceneManagerEvent event) {
consumed = true;
} else if(event.event == SubmenuIndexFwVersion) {
consumed = true;
} else if(event.event == SeaderWorkerEventSamMissing) {
scene_manager_next_scene(seader->scene_manager, SeaderSceneSamMissing);
consumed = true;
}
} else if(event.type == SceneManagerEventTypeBack) {
scene_manager_stop(seader->scene_manager);
Expand Down

0 comments on commit ae535f9

Please sign in to comment.