Change in pysim[master]: pysim-prog: add commandline option to probe cards

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
Wed Jul 4 09:10:15 UTC 2018


dexter has uploaded this change for review. ( https://gerrit.osmocom.org/9884


Change subject: pysim-prog: add commandline option to probe cards
......................................................................

pysim-prog: add commandline option to probe cards

In some situations it may be helpful to know the card name (type)
we deal with in advance. So lets ad an to probe that only detects
the card and then exists.

- Add commandline option -T --probe

Change-Id: I57422d3819d52fd215ac8f13f890729aad2af76f
Related: OS#3376
---
M pySim-prog.py
1 file changed, 13 insertions(+), 2 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/84/9884/1

diff --git a/pySim-prog.py b/pySim-prog.py
index 1685d2b..eca8b4e 100755
--- a/pySim-prog.py
+++ b/pySim-prog.py
@@ -62,6 +62,10 @@
 			help="Card type (user -t list to view) [default: %default]",
 			default="auto",
 		)
+	parser.add_option("-T", "--probe", dest="probe",
+			help="Determine card type",
+			default=False, action="store_true"
+		)
 	parser.add_option("-a", "--pin-adm", dest="pin_adm",
 			help="ADM PIN used for provisioning (overwrites default)",
 		)
@@ -156,6 +160,9 @@
 			print kls.name
 		sys.exit(0)
 
+        if options.probe:
+                return options
+
 	if options.source == 'csv':
 		if (options.imsi is None) and (options.batch_mode is False) and (options.read_imsi is False):
 			parser.error("CSV mode needs either an IMSI, --read-imsi or batch mode")
@@ -525,7 +532,7 @@
 		for kls in _cards_classes:
 			card = kls.autodetect(scc)
 			if card:
-				print "Autodetected card type %s" % card.name
+				print "Autodetected card type: %s" % card.name
 				card.reset()
 				break
 
@@ -540,7 +547,7 @@
 		card = ctypes[opts.type](scc)
 
 	else:
-		raise ValueError("Unknown card type %s" % opts.type)
+		raise ValueError("Unknown card type: %s" % opts.type)
 
 	return card
 
@@ -589,6 +596,10 @@
 				else:
 					sys.exit(-1)
 
+                        # Probe only
+                        if opts.probe:
+                                break;
+
 			# Erase if requested
 			if opts.erase:
 				print "Formatting ..."

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

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


More information about the gerrit-log mailing list