@@ -119,6 +119,7 @@ def get_ndef(self, memory: bytes) -> tuple[int, bytes] | None:
119119 (start, ndef_bytes),
120120 or None if it wasn't found.
121121 """
122+ # pylint: disable=too-many-return-statements
122123
123124 cc = self .decode_cc (memory )
124125 if cc is None :
@@ -137,8 +138,7 @@ def get_ndef(self, memory: bytes) -> tuple[int, bytes] | None:
137138 def read_val (memory : bytes , pos : int ) -> tuple [int , int ]:
138139 if memory [pos ] < 255 :
139140 return memory [pos ], pos + 1
140- else :
141- return (memory [pos + 1 ] << 8 ) | memory [pos + 2 ], pos + 3
141+ return (memory [pos + 1 ] << 8 ) | memory [pos + 2 ], pos + 3
142142
143143 while pos < mlen :
144144 typ , pos = read_val (memory , pos )
@@ -189,7 +189,6 @@ def read_memory(self, offset: int = 0, length: int | None = None) -> bytes:
189189 self ._reader .change_mode_to_transceiver ()
190190
191191 # TODO: If num_blocks * memory_block_size > 128, loop
192-
193192 # TODO: If start_block > 255, use EXTENDED_READ_MULTIPLE_BLOCKS
194193 memory_content = self ._reader .send_and_receive_15693 (
195194 ISO15693Command .READ_MULTIPLE_BLOCKS ,
@@ -222,6 +221,7 @@ def get_system_information(self) -> dict[str, int]:
222221 system_info = self ._reader .send_and_receive_15693 (
223222 ISO15693Command .GET_SYSTEM_INFORMATION ,
224223 b"" ,
224+ to_selected = True ,
225225 )
226226
227227 if len (system_info ) > 0 and system_info [0 ] & 1 :
@@ -232,6 +232,12 @@ def get_system_information(self) -> dict[str, int]:
232232 if len (system_info ) < 1 :
233233 raise PN5180Error ("Error getting system information, no answer" , 0 )
234234
235+ if len (system_info ) < 10 :
236+ raise PN5180Error (
237+ "Error getting system information, no complete answer" ,
238+ system_info [0 ],
239+ )
240+
235241 pos = 10
236242 result = {}
237243 if system_info [1 ] & 1 :
0 commit comments