cards: reset uninitalized EF.AD

The contents of EF.AD me be uninitalized (all bytes set to 0xff). If
this is the case reset all bytes of the file to 0x00 and continue the
update of EF.AD with this value.

Change-Id: I57cf53e0c540469f11b6d85bd3daf3f9e14c237e
diff --git a/pySim/cards.py b/pySim/cards.py
index f469cae..1c0add0 100644
--- a/pySim/cards.py
+++ b/pySim/cards.py
@@ -148,8 +148,13 @@
 		if mnclen > 3:
 			raise RuntimeError('unable to calculate proper mnclen')
 
-		data = self._scc.read_binary(EF['AD'], length=None, offset=0)
-		content = data[0][0:6] + "%02X" % mnclen
+		data, sw = self._scc.read_binary(EF['AD'], length=None, offset=0)
+
+		# Reset contents to EF.AD in case the file is uninintalized
+		if data.lower() == "ffffffff":
+			data = "00000000"
+
+		content = data[0:6] + "%02X" % mnclen
 		data, sw = self._scc.update_binary(EF['AD'], content)
 		return sw