@@ -588,33 +588,19 @@ private void writeBlock() {
588
588
589
589
// Write. There are some tags which report a successful write, although
590
590
// the write was not successful. Therefore, we try to write it using both keys.
591
- if (sector == 0 && block == 0 ) {
592
- // Write the manufacturer bock. This is only possible on gen2 tags.
593
- if (keys [1 ] != null ) {
594
- resultKeyB = reader .writeBlock (sector , block ,
595
- Common .hex2Bytes (data ),
596
- keys [1 ], true );
597
- }
598
- if (keys [0 ] != null ) {
599
- resultKeyA = reader .writeBlock (sector , block ,
600
- Common .hex2Bytes (data ),
601
- keys [0 ], false );
602
- }
603
- } else {
604
- // Normal block. Try key B first.
605
- if (keys [1 ] != null ) {
606
- resultKeyB = reader .writeBlock (sector , block ,
607
- Common .hex2Bytes (data ),
608
- keys [1 ], true );
609
- }
610
- // Try to write with key A (if there is one).
611
- if (keys [0 ] != null ) {
612
- resultKeyA = reader .writeBlock (sector , block ,
613
- Common .hex2Bytes (data ),
614
- keys [0 ], false );
615
- }
616
-
591
+ // Try key B first.
592
+ if (keys [1 ] != null ) {
593
+ resultKeyB = reader .writeBlock (sector , block ,
594
+ Common .hex2Bytes (data ),
595
+ keys [1 ], true );
617
596
}
597
+ // Try to write with key A (if there is one).
598
+ if (keys [0 ] != null ) {
599
+ resultKeyA = reader .writeBlock (sector , block ,
600
+ Common .hex2Bytes (data ),
601
+ keys [0 ], false );
602
+ }
603
+
618
604
reader .close ();
619
605
if (resultKeyA == 0 || resultKeyB == 0 ) {
620
606
result = 0 ;
0 commit comments