laforge has submitted this change. (
https://gerrit.osmocom.org/c/pysim/+/31051 )
Change subject: gsm_r: Fix decoding of EF.FN
......................................................................
gsm_r: Fix decoding of EF.FN
This fixes the below exception when trying to decode records of EF.FN:
EXCEPTION of type 'TypeError' occurred with message: 'unsupported operand
type(s) for &: 'str' and 'int''
Change-Id: I3723a0d59f862fa818bea1622fe43a7b56c92847
Related: OS#5784
---
M pySim/gsm_r.py
1 file changed, 3 insertions(+), 3 deletions(-)
Approvals:
Jenkins Builder: Verified
pespin: Looks good to me, but someone else must approve
fixeria: Looks good to me, approved
diff --git a/pySim/gsm_r.py b/pySim/gsm_r.py
index ed85c73..5ddb04b 100644
--- a/pySim/gsm_r.py
+++ b/pySim/gsm_r.py
@@ -47,10 +47,10 @@
class FuncNTypeAdapter(Adapter):
def _decode(self, obj, context, path):
bcd = swap_nibbles(b2h(obj))
- last_digit = bcd[-1]
+ last_digit = int(bcd[-1], 16)
return {'functional_number': bcd[:-1],
- 'presentation_of_only_this_fn': last_digit & 4,
- 'permanent_fn': last_digit & 8}
+ 'presentation_of_only_this_fn': bool(last_digit & 4),
+ 'permanent_fn': bool(last_digit & 8)}
def _encode(self, obj, context, path):
return 'FIXME'
--
To view, visit
https://gerrit.osmocom.org/c/pysim/+/31051
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I3723a0d59f862fa818bea1622fe43a7b56c92847
Gerrit-Change-Number: 31051
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: merged