@@ -181,6 +181,8 @@ NfcCommand gen4_poller_request_mode_handler(Gen4Poller* instance) {
181181 instance -> state = Gen4PollerStateGetRevision ;
182182 } else if (instance -> gen4_event_data .request_mode .mode == Gen4PollerModeSetShadowMode ) {
183183 instance -> state = Gen4PollerStateSetShadowMode ;
184+ } else if (instance -> gen4_event_data .request_mode .mode == Gen4PollerModeSetDirectWriteBlock0Mode ) {
185+ instance -> state = Gen4PollerStateSetDirectWriteBlock0 ;
184186 } else {
185187 instance -> state = Gen4PollerStateFail ;
186188 }
@@ -273,13 +275,13 @@ static NfcCommand gen4_poller_write_mf_classic(Gen4Poller* instance) {
273275 break ;
274276 }
275277
276- instance -> config [6 ] = Gen4PollerShadowModeIgnore ;
278+ instance -> config [6 ] = Gen4PollerShadowModeDisabled ;
277279 instance -> config [24 ] = iso3_data -> atqa [0 ];
278280 instance -> config [25 ] = iso3_data -> atqa [1 ];
279281 instance -> config [26 ] = iso3_data -> sak ;
280282 instance -> config [27 ] = 0x00 ;
281283 instance -> config [28 ] = instance -> total_blocks ;
282- instance -> config [29 ] = 0x01 ;
284+ instance -> config [29 ] = Gen4PollerDirectWriteBlock0ModeDeactivated ;
283285
284286 Gen4PollerError error = gen4_poller_set_config (
285287 instance , instance -> password , instance -> config , sizeof (instance -> config ), false);
@@ -352,13 +354,13 @@ static NfcCommand gen4_poller_write_mf_ultralight(Gen4Poller* instance) {
352354 break ;
353355 }
354356
355- instance -> config [6 ] = Gen4PollerShadowModeHighSpeedIgnore ;
357+ instance -> config [6 ] = Gen4PollerShadowModeHighSpeedDisabled ;
356358 instance -> config [24 ] = iso3_data -> atqa [0 ];
357359 instance -> config [25 ] = iso3_data -> atqa [1 ];
358360 instance -> config [26 ] = iso3_data -> sak ;
359361 instance -> config [27 ] = 0x00 ;
360362 instance -> config [28 ] = instance -> total_blocks ;
361- instance -> config [29 ] = 0x01 ;
363+ instance -> config [29 ] = Gen4PollerDirectWriteBlock0ModeDeactivated ;
362364
363365 Gen4PollerError error = gen4_poller_set_config (
364366 instance , instance -> password , instance -> config , sizeof (instance -> config ), false);
@@ -557,6 +559,25 @@ NfcCommand gen4_poller_set_shadow_mode_handler(Gen4Poller* instance) {
557559 return command ;
558560}
559561
562+ NfcCommand gen4_poller_set_direct_write_block_0_mode_handler (Gen4Poller * instance ) {
563+ NfcCommand command = NfcCommandContinue ;
564+
565+ do {
566+ Gen4PollerError error = gen4_poller_set_direct_write_block_0_mode (
567+ instance , instance -> password , instance -> direct_write_block_0_mode );
568+
569+ if (error != Gen4PollerErrorNone ) {
570+ FURI_LOG_E (TAG , "Failed to set direct write to block 0 mode: %d" , error );
571+ instance -> state = Gen4PollerStateFail ;
572+ break ;
573+ }
574+
575+ instance -> state = Gen4PollerStateSuccess ;
576+ } while (false);
577+
578+ return command ;
579+ }
580+
560581NfcCommand gen4_poller_success_handler (Gen4Poller * instance ) {
561582 NfcCommand command = NfcCommandContinue ;
562583
@@ -592,6 +613,7 @@ static const Gen4PollerStateHandler gen4_poller_state_handlers[Gen4PollerStateNu
592613 [Gen4PollerStateGetCurrentConfig ] = gen4_poller_get_current_cfg_handler ,
593614 [Gen4PollerStateGetRevision ] = gen4_poller_get_revision_handler ,
594615 [Gen4PollerStateSetShadowMode ] = gen4_poller_set_shadow_mode_handler ,
616+ [Gen4PollerStateSetDirectWriteBlock0 ] = gen4_poller_set_direct_write_block_0_mode_handler ,
595617 [Gen4PollerStateSuccess ] = gen4_poller_success_handler ,
596618 [Gen4PollerStateFail ] = gen4_poller_fail_handler ,
597619
0 commit comments