lists.osmocom.org
Sign In Sign Up
Manage this list Sign In Sign Up

Keyboard Shortcuts

Thread View

  • j: Next unread message
  • k: Previous unread message
  • j a: Jump to all threads
  • j l: Jump to MailingList overview

gerrit-log

Thread Start a new thread
Download
Threads by month
  • ----- 2026 -----
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2025 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2024 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2023 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2022 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
gerrit-log@lists.osmocom.org

June 2023

  • 1 participants
  • 2480 discussions
[S] Change in pysim[master]: serial: return a return code in reset_card()
by laforge 07 Jun '23

07 Jun '23
Attention is currently required from: tobias, dexter. laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/pysim/+/33152 ) Change subject: serial: return a return code in reset_card() ...................................................................... Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/pysim/+/33152 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Change-Id: I658dd6857580652696b4a77e7d6cfe5778f09eff Gerrit-Change-Number: 33152 Gerrit-PatchSet: 1 Gerrit-Owner: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: tobias <t-osmocom.org(a)tobias.org> Gerrit-Attention: tobias <t-osmocom.org(a)tobias.org> Gerrit-Attention: dexter <pmaier(a)sysmocom.de> Gerrit-Comment-Date: Wed, 07 Jun 2023 10:00:50 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
[S] Change in pysim[master]: utils: Remove format_xplmn leading zeros in MNC
by laforge 07 Jun '23

07 Jun '23
laforge has submitted this change. ( https://gerrit.osmocom.org/c/pysim/+/33151 ) Change subject: utils: Remove format_xplmn leading zeros in MNC ...................................................................... utils: Remove format_xplmn leading zeros in MNC Change-Id: I803edafbd892c2b32b884d0b39fed61967a3d68b --- M pySim/utils.py M pysim-testdata/sysmoISIM-SJA2.ok M pysim-testdata/sysmoUSIM-SJS1.ok 3 files changed, 18 insertions(+), 10 deletions(-) Approvals: laforge: Looks good to me, approved Jenkins Builder: Verified diff --git a/pySim/utils.py b/pySim/utils.py index 537014f..c6362fa 100644 --- a/pySim/utils.py +++ b/pySim/utils.py @@ -594,8 +594,8 @@ plmn_chars = 6 # first three bytes (six ascii hex chars) plmn_str = threehexbytes[:plmn_chars] - res['mcc'] = dec_mcc_from_plmn(plmn_str) - res['mnc'] = dec_mnc_from_plmn(plmn_str) + res['mcc'] = dec_mcc_from_plmn_str(plmn_str) + res['mnc'] = dec_mnc_from_plmn_str(plmn_str) return res @@ -603,11 +603,10 @@ s = "" for rec_data in hexstr_to_Nbytearr(hexstr, 3): rec_info = dec_xplmn(rec_data) - if rec_info['mcc'] == 0xFFF and rec_info['mnc'] == 0xFFF: + if not rec_info['mcc'] and not rec_info['mnc']: rec_str = "unused" else: - rec_str = "MCC: %03d MNC: %03d" % ( - rec_info['mcc'], rec_info['mnc']) + rec_str = "MCC: %s MNC: %s" % (rec_info['mcc'], rec_info['mnc']) s += "\t%s # %s\n" % (rec_data, rec_str) return s diff --git a/pysim-testdata/sysmoISIM-SJA2.ok b/pysim-testdata/sysmoISIM-SJA2.ok index f9476df..45acd79 100644 --- a/pysim-testdata/sysmoISIM-SJA2.ok +++ b/pysim-testdata/sysmoISIM-SJA2.ok @@ -103,7 +103,7 @@ Service 59 - MMS User Connectivity Parameters EHPLMN: - 00f110 # MCC: 001 MNC: 001 + 00f110 # MCC: 001 MNC: 01 ffffff # unused ffffff # unused ffffff # unused diff --git a/pysim-testdata/sysmoUSIM-SJS1.ok b/pysim-testdata/sysmoUSIM-SJS1.ok index b4277f4..b793cc0 100644 --- a/pysim-testdata/sysmoUSIM-SJS1.ok +++ b/pysim-testdata/sysmoUSIM-SJS1.ok @@ -105,10 +105,10 @@ Service 59 - MMS User Connectivity Parameters FPLMN: - 62f201 # MCC: 262 MNC: 010 - 62f202 # MCC: 262 MNC: 020 - 62f203 # MCC: 262 MNC: 030 - 62f207 # MCC: 262 MNC: 070 + 62f201 # MCC: 262 MNC: 10 + 62f202 # MCC: 262 MNC: 20 + 62f203 # MCC: 262 MNC: 30 + 62f207 # MCC: 262 MNC: 70 USIM Service Table: 9e6b1dfc67f6580000 Service 2 - Fixed Dialling Numbers (FDN) -- To view, visit https://gerrit.osmocom.org/c/pysim/+/33151 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Change-Id: I803edafbd892c2b32b884d0b39fed61967a3d68b Gerrit-Change-Number: 33151 Gerrit-PatchSet: 3 Gerrit-Owner: matanp <matan1008(a)gmail.com> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-MessageType: merged
1 0
0 0
[M] Change in pysim[master]: Add FPLMN read and program
by laforge 07 Jun '23

07 Jun '23
laforge has submitted this change. ( https://gerrit.osmocom.org/c/pysim/+/32712 ) Change subject: Add FPLMN read and program ...................................................................... Add FPLMN read and program Change-Id: I9ce8c1af691c28ea9ed69e7b5f03f0c02d1f029b --- M pySim-prog.py M pySim-read.py M pySim/cards.py M pysim-testdata/Fairwaves-SIM.ok M pysim-testdata/Wavemobile-SIM.ok M pysim-testdata/sysmoISIM-SJA2.ok M pysim-testdata/sysmoUSIM-SJS1.ok 7 files changed, 69 insertions(+), 0 deletions(-) Approvals: laforge: Looks good to me, approved dexter: Looks good to me, but someone else must approve pespin: Looks good to me, but someone else must approve Jenkins Builder: Verified diff --git a/pySim-prog.py b/pySim-prog.py index 448f2a0..7c644b7 100755 --- a/pySim-prog.py +++ b/pySim-prog.py @@ -150,6 +150,9 @@ default=None, choices=['{:02X}'.format(int(m)) for m in EF_AD.OP_MODE], ) + parser.add_option("-f", "--fplmn", dest="fplmn", action="append", + help="Set Forbidden PLMN. Add multiple time for multiple FPLMNS", + ) parser.add_option("--epdgid", dest="epdgid", help="Set Home Evolved Packet Data Gateway (ePDG) Identifier. (Only FQDN format supported)", ) @@ -498,6 +501,7 @@ 'impi': opts.impi, 'impu': opts.impu, 'opmode': opts.opmode, + 'fplmn': opts.fplmn, } diff --git a/pySim-read.py b/pySim-read.py index b7fe1f2..ddc193a 100755 --- a/pySim-read.py +++ b/pySim-read.py @@ -253,6 +253,14 @@ else: print("EHPLMN: Can't read, response code = %s" % (sw,)) + # EF.FPLMN + if usim_card.file_exists(EF_USIM_ADF_map['FPLMN']): + res, sw = usim_card.read_fplmn() + if sw == '9000': + print(f'FPLMN:\n{res}') + else: + print(f'FPLMN: Can\'t read, response code = {sw}') + # EF.UST try: if usim_card.file_exists(EF_USIM_ADF_map['UST']): diff --git a/pySim/cards.py b/pySim/cards.py index 0f34f9b..d3a43f3 100644 --- a/pySim/cards.py +++ b/pySim/cards.py @@ -381,6 +381,22 @@ data, sw = self._scc.update_binary(EF_USIM_ADF_map['EHPLMN'], ehplmn) return sw + def read_fplmn(self): + res, sw = self._scc.read_binary(EF_USIM_ADF_map['FPLMN']) + if sw == '9000': + return format_xplmn(res), sw + else: + return None, sw + + def update_fplmn(self, fplmn): + self._scc.select_file('3f00') + self.select_adf_by_aid('USIM') + size = self._scc.binary_size(EF_USIM_ADF_map['FPLMN']) + encoded = ''.join([enc_plmn(plmn[:3], plmn[3:]) for plmn in fplmn]) + encoded = rpad(encoded, size) + data, sw = self._scc.update_binary(EF_USIM_ADF_map['FPLMN'], encoded) + return sw + def read_epdgid(self): (res, sw) = self._scc.read_binary(EF_USIM_ADF_map['ePDGId']) if sw == '9000': @@ -1702,6 +1718,7 @@ 'smsp': self.update_smsp, 'ki': self.update_ki, 'opc': self.update_opc, + 'fplmn': self.update_fplmn, } @classmethod @@ -1715,6 +1732,7 @@ return None def program(self, p): + self.set_apdu_parameter('00', '0004') # Authenticate self._scc.verify_chv(0xc, h2b('3834373936313533')) for handler in self._program_handlers: diff --git a/pysim-testdata/Fairwaves-SIM.ok b/pysim-testdata/Fairwaves-SIM.ok index f07c033..063fc6b 100644 --- a/pysim-testdata/Fairwaves-SIM.ok +++ b/pysim-testdata/Fairwaves-SIM.ok @@ -88,6 +88,18 @@ Service 58 - Extension 8 Service 59 - MMS User Connectivity Parameters +FPLMN: + ffffff # unused + ffffff # unused + ffffff # unused + ffffff # unused + ffffff # unused + ffffff # unused + ffffff # unused + ffffff # unused + ffffff # unused + ffffff # unused + USIM Service Table: 01ea1ffc21360480010000 Service 1 - Local Phone Book Service 10 - Short Message Storage (SMS) diff --git a/pysim-testdata/Wavemobile-SIM.ok b/pysim-testdata/Wavemobile-SIM.ok index d8f1a6f..980332f 100644 --- a/pysim-testdata/Wavemobile-SIM.ok +++ b/pysim-testdata/Wavemobile-SIM.ok @@ -93,6 +93,12 @@ Service 58 - Extension 8 Service 59 - MMS User Connectivity Parameters +FPLMN: + ffffff # unused + ffffff # unused + ffffff # unused + ffffff # unused + USIM Service Table: 9eff1b3c37fe5900000000 Service 2 - Fixed Dialling Numbers (FDN) Service 3 - Extension 2 diff --git a/pysim-testdata/sysmoISIM-SJA2.ok b/pysim-testdata/sysmoISIM-SJA2.ok index a8c98d9..f9476df 100644 --- a/pysim-testdata/sysmoISIM-SJA2.ok +++ b/pysim-testdata/sysmoISIM-SJA2.ok @@ -108,6 +108,12 @@ ffffff # unused ffffff # unused +FPLMN: + ffffff # unused + ffffff # unused + ffffff # unused + ffffff # unused + USIM Service Table: beff9f9de73e0408400170330000002e00000000 Service 2 - Fixed Dialling Numbers (FDN) Service 3 - Extension 2 diff --git a/pysim-testdata/sysmoUSIM-SJS1.ok b/pysim-testdata/sysmoUSIM-SJS1.ok index 14d7110..b4277f4 100644 --- a/pysim-testdata/sysmoUSIM-SJS1.ok +++ b/pysim-testdata/sysmoUSIM-SJS1.ok @@ -104,6 +104,12 @@ Service 58 - Extension 8 Service 59 - MMS User Connectivity Parameters +FPLMN: + 62f201 # MCC: 262 MNC: 010 + 62f202 # MCC: 262 MNC: 020 + 62f203 # MCC: 262 MNC: 030 + 62f207 # MCC: 262 MNC: 070 + USIM Service Table: 9e6b1dfc67f6580000 Service 2 - Fixed Dialling Numbers (FDN) Service 3 - Extension 2 -- To view, visit https://gerrit.osmocom.org/c/pysim/+/32712 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Change-Id: I9ce8c1af691c28ea9ed69e7b5f03f0c02d1f029b Gerrit-Change-Number: 32712 Gerrit-PatchSet: 7 Gerrit-Owner: matanp <matan1008(a)gmail.com> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-CC: lynxis lazus <lynxis(a)fe80.eu> Gerrit-MessageType: merged
1 0
0 0
[S] Change in pysim[master]: utils: Remove format_xplmn leading zeros in MNC
by laforge 07 Jun '23

07 Jun '23
Attention is currently required from: matanp. laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/pysim/+/33151 ) Change subject: utils: Remove format_xplmn leading zeros in MNC ...................................................................... Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/pysim/+/33151 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Change-Id: I803edafbd892c2b32b884d0b39fed61967a3d68b Gerrit-Change-Number: 33151 Gerrit-PatchSet: 2 Gerrit-Owner: matanp <matan1008(a)gmail.com> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Attention: matanp <matan1008(a)gmail.com> Gerrit-Comment-Date: Wed, 07 Jun 2023 10:00:04 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
[M] Change in pysim[master]: Add FPLMN read and program
by laforge 07 Jun '23

07 Jun '23
Attention is currently required from: pespin, lynxis lazus, matanp, dexter. laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/pysim/+/32712 ) Change subject: Add FPLMN read and program ...................................................................... Patch Set 6: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/pysim/+/32712 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Change-Id: I9ce8c1af691c28ea9ed69e7b5f03f0c02d1f029b Gerrit-Change-Number: 32712 Gerrit-PatchSet: 6 Gerrit-Owner: matanp <matan1008(a)gmail.com> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-CC: lynxis lazus <lynxis(a)fe80.eu> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-Attention: lynxis lazus <lynxis(a)fe80.eu> Gerrit-Attention: matanp <matan1008(a)gmail.com> Gerrit-Attention: dexter <pmaier(a)sysmocom.de> Gerrit-Comment-Date: Wed, 07 Jun 2023 09:58:53 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
[S] Change in osmo-bts[master]: paging: do not confirm PAGING COMMAND messages
by pespin 07 Jun '23

07 Jun '23
Attention is currently required from: dexter. pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-bts/+/32734 ) Change subject: paging: do not confirm PAGING COMMAND messages ...................................................................... Patch Set 12: -Code-Review -- To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/32734 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Change-Id: I8b8264d28b1b1deb08774cdba58dd4c6dafe115d Gerrit-Change-Number: 32734 Gerrit-PatchSet: 12 Gerrit-Owner: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Attention: dexter <pmaier(a)sysmocom.de> Gerrit-Comment-Date: Wed, 07 Jun 2023 09:58:18 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
[S] Change in pysim[master]: pySim/apdu/ts_31_102.py: Add Rel17 5G NSWO context for GET IDENTITY
by laforge 07 Jun '23

07 Jun '23
laforge has submitted this change. ( https://gerrit.osmocom.org/c/pysim/+/33211 ) ( 2 is the latest approved patch-set. No files were changed between the latest approved patch-set and the submitted one. )Change subject: pySim/apdu/ts_31_102.py: Add Rel17 5G NSWO context for GET IDENTITY ...................................................................... pySim/apdu/ts_31_102.py: Add Rel17 5G NSWO context for GET IDENTITY Change-Id: I6ce5848ca4cf04430be7767e9cb2d18f4c5a5531 --- M pySim/apdu/ts_31_102.py 1 file changed, 10 insertions(+), 1 deletion(-) Approvals: fixeria: Looks good to me, approved Jenkins Builder: Verified diff --git a/pySim/apdu/ts_31_102.py b/pySim/apdu/ts_31_102.py index 7602e50..2200388 100644 --- a/pySim/apdu/ts_31_102.py +++ b/pySim/apdu/ts_31_102.py @@ -108,7 +108,7 @@ class UsimGetIdentity(ApduCommand, n='GET IDENTITY', ins=0x78, cla=['8X', 'CX', 'EX']): _apdu_case = 4 _construct_p2 = BitStruct('scope'/Enum(Flag, mf=0, df_adf_specific=1), - 'identity_context'/Enum(BitsInteger(7), suci=1)) + 'identity_context'/Enum(BitsInteger(7), suci=1, suci_5g_nswo=2)) _tlv_rsp = SUCI_TlvDataObject ApduCommands = ApduCommandSet('TS 31.102', cmds=[UsimAuthenticateEven, UsimAuthenticateOdd, -- To view, visit https://gerrit.osmocom.org/c/pysim/+/33211 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Change-Id: I6ce5848ca4cf04430be7767e9cb2d18f4c5a5531 Gerrit-Change-Number: 33211 Gerrit-PatchSet: 3 Gerrit-Owner: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-MessageType: merged
1 0
0 0
[M] Change in pysim[master]: Move "suspend_uicc" command from pySim-shell to ts_102_221.py
by laforge 07 Jun '23

07 Jun '23
laforge has submitted this change. ( https://gerrit.osmocom.org/c/pysim/+/33209 ) ( 2 is the latest approved patch-set. No files were changed between the latest approved patch-set and the submitted one. )Change subject: Move "suspend_uicc" command from pySim-shell to ts_102_221.py ...................................................................... Move "suspend_uicc" command from pySim-shell to ts_102_221.py The SUSPEND UICC command is a TS 102 221 (UICC) command, so move it to the UICC Card Profile. Also, make sure that any shell command sets specified in the CardProfile are actually installed during equip(). Change-Id: I574348951f06b749aeff986589186110580328bc --- M docs/shell.rst M pySim-shell.py M pySim/ts_102_221.py 3 files changed, 47 insertions(+), 17 deletions(-) Approvals: fixeria: Looks good to me, but someone else must approve dexter: Looks good to me, but someone else must approve laforge: Looks good to me, approved Jenkins Builder: Verified diff --git a/docs/shell.rst b/docs/shell.rst index 510f4c6..8f85246 100644 --- a/docs/shell.rst +++ b/docs/shell.rst @@ -199,6 +199,11 @@ :func: Iso7816Commands.close_chan_parser +TS 102 221 commands +------------------- + +These are commands as specified in ETSI TS 102 221, the core UICC specification. + suspend_uicc ~~~~~~~~~~~~ This command allows you to perform the SUSPEND UICC command on the card. This is a relatively @@ -209,8 +214,8 @@ including the electrical power down. .. argparse:: - :module: pySim-shell - :func: Iso7816Commands.suspend_uicc_parser + :module: pySim.ts_102_221 + :func: CardProfileUICC.AddlShellCommands.suspend_uicc_parser diff --git a/pySim-shell.py b/pySim-shell.py index d6d9a64..3f0818a 100755 --- a/pySim-shell.py +++ b/pySim-shell.py @@ -219,6 +219,9 @@ self._onchange_conserve_write( 'conserve_write', False, self.conserve_write) self._onchange_apdu_trace('apdu_trace', False, self.apdu_trace) + if self.rs.profile: + for cmd_set in self.rs.profile.shell_cmdsets: + self.register_command_set(cmd_set) self.register_command_set(Iso7816Commands()) self.register_command_set(Ts102222Commands()) self.register_command_set(PySimCommands()) @@ -283,6 +286,9 @@ @cmd2.with_category(CUSTOM_CATEGORY) def do_equip(self, opts): """Equip pySim-shell with card""" + if self.rs.profile: + for cmd_set in self.rs.profile.shell_cmdsets: + self.unregister_command_set(cmd_set) rs, card = init_card(sl) self.equip(card, rs) @@ -934,20 +940,6 @@ fcp_dec = self._cmd.lchan.status() self._cmd.poutput_json(fcp_dec) - suspend_uicc_parser = argparse.ArgumentParser() - suspend_uicc_parser.add_argument('--min-duration-secs', type=int, default=60, - help='Proposed minimum duration of suspension') - suspend_uicc_parser.add_argument('--max-duration-secs', type=int, default=24*60*60, - help='Proposed maximum duration of suspension') - - # not ISO7816-4 but TS 102 221 - @cmd2.with_argparser(suspend_uicc_parser) - def do_suspend_uicc(self, opts): - """Perform the SUSPEND UICC command. Only supported on some UICC.""" - (duration, token, sw) = self._cmd.card._scc.suspend_uicc(min_len_secs=opts.min_duration_secs, - max_len_secs=opts.max_duration_secs) - self._cmd.poutput( - 'Negotiated Duration: %u secs, Token: %s, SW: %s' % (duration, token, sw)) class Proact(ProactiveHandler): def receive_fetch(self, pcmd: ProactiveCommand): diff --git a/pySim/ts_102_221.py b/pySim/ts_102_221.py index b8db5c9..bade9cf 100644 --- a/pySim/ts_102_221.py +++ b/pySim/ts_102_221.py @@ -838,7 +838,8 @@ } super().__init__(name, desc='ETSI TS 102 221', cla="00", - sel_ctrl="0004", files_in_mf=files, sw=sw) + sel_ctrl="0004", files_in_mf=files, sw=sw, + shell_cmdsets = [self.AddlShellCommands()]) @staticmethod def decode_select_response(resp_hex: str) -> object: @@ -852,6 +853,23 @@ def match_with_card(scc: SimCardCommands) -> bool: return match_uicc(scc) + @with_default_category('TS 102 221 Specific Commands') + class AddlShellCommands(CommandSet): + suspend_uicc_parser = argparse.ArgumentParser() + suspend_uicc_parser.add_argument('--min-duration-secs', type=int, default=60, + help='Proposed minimum duration of suspension') + suspend_uicc_parser.add_argument('--max-duration-secs', type=int, default=24*60*60, + help='Proposed maximum duration of suspension') + + # not ISO7816-4 but TS 102 221 + @cmd2.with_argparser(suspend_uicc_parser) + def do_suspend_uicc(self, opts): + """Perform the SUSPEND UICC command. Only supported on some UICC.""" + (duration, token, sw) = self._cmd.card._scc.suspend_uicc(min_len_secs=opts.min_duration_secs, + max_len_secs=opts.max_duration_secs) + self._cmd.poutput( + 'Negotiated Duration: %u secs, Token: %s, SW: %s' % (duration, token, sw)) + class CardProfileUICCSIM(CardProfileUICC): """Same as above, but including 2G SIM support""" -- To view, visit https://gerrit.osmocom.org/c/pysim/+/33209 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Change-Id: I574348951f06b749aeff986589186110580328bc Gerrit-Change-Number: 33209 Gerrit-PatchSet: 3 Gerrit-Owner: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-MessageType: merged
1 0
0 0
[M] Change in pysim[master]: ts_102221: Add "resume_uicc" command
by laforge 07 Jun '23

07 Jun '23
laforge has submitted this change. ( https://gerrit.osmocom.org/c/pysim/+/33210 ) Change subject: ts_102221: Add "resume_uicc" command ...................................................................... ts_102221: Add "resume_uicc" command We've had a "suspend_uicc" command since commit ec95053249bc7f9308ca1f659d8ef6ac97a6e393 in 2021, but didn't yet have the corresponding "resume" pair. Note that you cannot really execute this in a reasonable way from within pySim, as it is required to power-cycle the card between SUSPEND and RESUME, see TS 102 221 Section 11.1.22.3.2 Change-Id: I3322fde74f680e77954e1d3e18a32ef5662759f2 --- M docs/shell.rst M pySim/commands.py M pySim/ts_102_221.py 3 files changed, 49 insertions(+), 1 deletion(-) Approvals: Jenkins Builder: Verified dexter: Looks good to me, approved diff --git a/docs/shell.rst b/docs/shell.rst index 8f85246..cce790a 100644 --- a/docs/shell.rst +++ b/docs/shell.rst @@ -217,6 +217,20 @@ :module: pySim.ts_102_221 :func: CardProfileUICC.AddlShellCommands.suspend_uicc_parser +resume_uicc +~~~~~~~~~~~ +This command allows you to perform the SUSPEND UICC command for the RESUME operation on the card. + +Suspend/Resume is a relatively recent power-saving addition to the UICC specifications, allowing for +suspend/resume while maintaining state, as opposed to a full power-off (deactivate) and power-on +(activate) of the card. + +The pySim command just sends that SUSPEND UICC (RESUME) command and doesn't perform the full related +sequence including the electrical power down. + +.. argparse:: + :module: pySim.ts_102_221 + :func: CardProfileUICC.AddlShellCommands.resume_uicc_parser pySim commands diff --git a/pySim/commands.py b/pySim/commands.py index 6acdb2e..dc0edad 100644 --- a/pySim/commands.py +++ b/pySim/commands.py @@ -631,6 +631,13 @@ resume_token = data[4:] return (negotiated_duration_secs, resume_token, sw) + # ETSI TS 102 221 11.1.22 + def resume_uicc(self, token: str): + """Send SUSPEND UICC (resume) to the card.""" + if len(h2b(token)) != 8: + raise ValueError("Token must be 8 bytes long") + data, sw = self._tp.send_apdu_checksw('8076010008' + token) + def get_data(self, tag: int, cla: int = 0x00): data, sw = self._tp.send_apdu('%02xca%04x00' % (cla, tag)) return (data, sw) diff --git a/pySim/ts_102_221.py b/pySim/ts_102_221.py index bade9cf..b6c003b 100644 --- a/pySim/ts_102_221.py +++ b/pySim/ts_102_221.py @@ -864,12 +864,22 @@ # not ISO7816-4 but TS 102 221 @cmd2.with_argparser(suspend_uicc_parser) def do_suspend_uicc(self, opts): - """Perform the SUSPEND UICC command. Only supported on some UICC.""" + """Perform the SUSPEND UICC command. Only supported on some UICC (check EF.UMPC).""" (duration, token, sw) = self._cmd.card._scc.suspend_uicc(min_len_secs=opts.min_duration_secs, max_len_secs=opts.max_duration_secs) self._cmd.poutput( 'Negotiated Duration: %u secs, Token: %s, SW: %s' % (duration, token, sw)) + resume_uicc_parser = argparse.ArgumentParser() + resume_uicc_parser.add_argument('token', type=str, help='Token provided during SUSPEND') + + @cmd2.with_argparser(resume_uicc_parser) + def do_resume_uicc(self, opts): + """Perform the REUSME UICC operation. Only supported on some UICC. Also: A power-cycle + of the card is required between SUSPEND and RESUME, and only very few non-RESUME + commands are permitted between SUSPEND and RESUME. See TS 102 221 Section 11.1.22.""" + self._cmd.card._scc.resume_uicc(opts.token) + class CardProfileUICCSIM(CardProfileUICC): """Same as above, but including 2G SIM support""" -- To view, visit https://gerrit.osmocom.org/c/pysim/+/33210 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Change-Id: I3322fde74f680e77954e1d3e18a32ef5662759f2 Gerrit-Change-Number: 33210 Gerrit-PatchSet: 3 Gerrit-Owner: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-MessageType: merged
1 0
0 0
[S] Change in osmo-hnbgw[master]: include Global RNC-ID in RESET-ACK
by laforge 07 Jun '23

07 Jun '23
Attention is currently required from: neels. laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-hnbgw/+/33180 ) Change subject: include Global RNC-ID in RESET-ACK ...................................................................... Patch Set 4: (1 comment) File src/osmo-hnbgw/cnlink.c: https://gerrit.osmocom.org/c/osmo-hnbgw/+/33180/comment/2d10f676_0ece4264 PS4, Line 187: i same comment as in previous patch about RESET -- To view, visit https://gerrit.osmocom.org/c/osmo-hnbgw/+/33180 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-hnbgw Gerrit-Branch: master Gerrit-Change-Id: I49d351e90dfe4a7c4dfdd26542565f2d9bd3d605 Gerrit-Change-Number: 33180 Gerrit-PatchSet: 4 Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-CC: laforge <laforge(a)osmocom.org> Gerrit-Attention: neels <nhofmeyr(a)sysmocom.de> Gerrit-Comment-Date: Wed, 07 Jun 2023 09:56:40 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Gerrit-MessageType: comment
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 184
  • 185
  • 186
  • 187
  • 188
  • 189
  • 190
  • ...
  • 248
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.