Change in pysim[master]: card_handler: make reader (sl) operations optional.

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

dexter gerrit-no-reply at lists.osmocom.org
Thu Sep 23 09:38:09 UTC 2021


dexter has uploaded this change for review. ( https://gerrit.osmocom.org/c/pysim/+/25548 )


Change subject: card_handler: make reader (sl) operations optional.
......................................................................

card_handler: make reader (sl) operations optional.

The constructor gets an sl object on initalization. The card handler
will then carry out reader operations like wait_for_card or connect.
In some cases it may be useful to go without those operations. Lets
make the sl object optional. If it is not present, simply do not
carry out the reader operation.

Change-Id: I0f793aec51751b7c7b87d55b66326cce9970274e
Related: SYS#5617
---
M pySim/card_handler.py
1 file changed, 4 insertions(+), 2 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/48/25548/1

diff --git a/pySim/card_handler.py b/pySim/card_handler.py
index ef1b071..84b8f36 100644
--- a/pySim/card_handler.py
+++ b/pySim/card_handler.py
@@ -36,7 +36,8 @@
 
 	def get(self, first = False):
 		print("Ready for Programming: Insert card now (or CTRL-C to cancel)")
-		self.sl.wait_for_card(newcardonly=not first)
+		if self.sl:
+			self.sl.wait_for_card(newcardonly=not first)
 
 	def error(self):
 		print("Programming failed: Remove card from reader")
@@ -94,7 +95,8 @@
 	def get(self, first = False):
 		print("Ready for Programming: Transporting card into the reader-bay...")
 		self.__exec_cmd(self.cmds['get'])
-		self.sl.connect()
+		if self.sl:
+			self.sl.connect()
 
 	def error(self):
 		print("Programming failed: Transporting card to the error-bin...")

-- 
To view, visit https://gerrit.osmocom.org/c/pysim/+/25548
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I0f793aec51751b7c7b87d55b66326cce9970274e
Gerrit-Change-Number: 25548
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pmaier at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210923/2fcd97d0/attachment.htm>


More information about the gerrit-log mailing list