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/.
laforge gerrit-no-reply at lists.osmocom.orglaforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ccid-firmware/+/16050 )
Change subject: Add 'check_ccid_config.py' to test for USB VID/PID in libccid_Info.plist
......................................................................
Add 'check_ccid_config.py' to test for USB VID/PID in libccid_Info.plist
Change-Id: I0399f03400b49d814825ca156ddb4824ec76ce0a
---
A sysmoOCTSIM/check_libccid_config.py
1 file changed, 60 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-ccid-firmware refs/changes/50/16050/1
diff --git a/sysmoOCTSIM/check_libccid_config.py b/sysmoOCTSIM/check_libccid_config.py
new file mode 100755
index 0000000..93cd202
--- /dev/null
+++ b/sysmoOCTSIM/check_libccid_config.py
@@ -0,0 +1,60 @@
+#!/usr/bin/python3
+
+# This script checks your libccid configuration file if it contains a matching entry
+# for the sysmoOCTSIM reader. If not, it will generate a modified config file
+
+import plistlib, sys
+
+INFILE="/etc/libccid_Info.plist"
+OUTFILE="/tmp/libccid_Info.plist"
+
+VENDOR_ID=0x1d50
+PRODUCT_ID=0x6141
+NAME='sysmocom sysmoOCTSIM'
+
+def gen_reader_dictlist(prod_id, vend_id, names):
+ readers = []
+ for i in range(0,len(prod_id)):
+ reader = {'vendor_id': vend_id[i], 'product_id': prod_id[i], 'name': names[i]}
+ readers.append(reader)
+ return readers
+
+def find_reader(readers, vend_id, prod_id):
+ for r in readers:
+ if int(r['vendor_id'], 16) == vend_id and int(r['product_id'], 16) == prod_id:
+ return r
+ return None
+
+def plist_add_reader(pl, vend_id, prod_id, name):
+ pl['ifdVendorID'].append(hex(vend_id))
+ pl['ifdProductID'].append(hex(prod_id))
+ pl['ifdFriendlyName'].append(name)
+
+
+if len(sys.argv) > 1:
+ INFILE = sys.argv[1]
+if len(sys.argv) > 2:
+ OUTFILE = sys.argv[2]
+
+# read the property list
+print("Reading libccid config file at '%s'" % (INFILE))
+with open(INFILE, 'rb') as fp:
+ pl = plistlib.load(fp)
+
+# consistency check
+if len(pl['ifdProductID']) != len(pl['ifdVendorID']) or len(pl['ifdProductID']) != len(pl['ifdFriendlyName']):
+ print("input file is corrupt", file=sys.stderr)
+ sys.exit(2)
+
+# convert into a better sorted form (one list of dicts; each dict one reader)
+readers = gen_reader_dictlist(pl['ifdProductID'], pl['ifdVendorID'], pl['ifdFriendlyName'])
+
+if find_reader(readers, VENDOR_ID, PRODUCT_ID):
+ print("Matching reader already in libccid_Info.plist; no action required", file=sys.stderr)
+else:
+ print("Reader not found in config file, it needs to be updated...")
+ plist_add_reader(pl, VENDOR_ID, PRODUCT_ID, NAME)
+ with open(OUTFILE, 'wb') as fp:
+ plistlib.dump(pl, fp)
+ print("Generated new config file stored as '%s'" % (OUTFILE))
+ print("\tWARNING: The generated file doesn't preserve comments!")
--
To view, visit https://gerrit.osmocom.org/c/osmo-ccid-firmware/+/16050
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-ccid-firmware
Gerrit-Branch: master
Gerrit-Change-Id: I0399f03400b49d814825ca156ddb4824ec76ce0a
Gerrit-Change-Number: 16050
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20191112/bddfc791/attachment.htm>