The unified diff between revisions [6bdff5e1..] and [06b25c60..] is displayed below. It can also be downloaded as a raw diff.
#
#
# patch "mifare.py"
# from [4d58310d1c3091b838f89ff9a7373841049db579]
# to [344f6b2c9625f5d6039a4c92c35f0d5e407b6ada]
#
============================================================
--- mifare.py 4d58310d1c3091b838f89ff9a7373841049db579
+++ mifare.py 344f6b2c9625f5d6039a4c92c35f0d5e407b6ada
@@ -140,8 +140,14 @@ class MIFAREReader:
result = self.send_packet('\x08\x02' + chr(block))
return result[3:19]
- def write_block(self, blocknum, data):
- pass
+ def write_block(self, blockvect, data):
+ """Write the 16 bytes in data to the block at vector (sector, block)."""
+ block = self.get_absolute_block(blockvect)
+ if len(data) != 16:
+ raise ValueError, "invalid data length - must be 16 bytes"
+
+ result = self.send_packet('\x09\x02' + chr(block) + data)
+ return
def write_key(self, key):
pass
@@ -155,6 +161,10 @@ class MIFAREReader:
def copy_block(self, source, dest):
pass
+ def halt(self):
+ """Halt the current card - no further transactions will be performed with it."""
+ self.send_packet('\x04\x02')
+
def set_led(self, red = False, green = False):
led_state = 0
if red: