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


Change subject: Enable parsing of USIM Service table (UST)
......................................................................

Enable parsing of USIM Service table (UST)

As per TS.31.102, This EF indicates which USIM services are available.
If a service is not indicated as available in the USIM, the ME shall not select 
this service.

Parsing of UST is achieved by first selecting the USIM application using its 
AID.
This is followed by selecting EF.UST with File ID - 6f38 in ADF.USIM

Change-Id: I54dbbd40bd3d22cee81f7c32e58cd946f8564257
---
M pySim-read.py
1 file changed, 16 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/79/17879/1

diff --git a/pySim-read.py b/pySim-read.py
index 3e25c76..5f5bea2 100755
--- a/pySim-read.py
+++ b/pySim-read.py
@@ -29,10 +29,11 @@
 import re
 import sys
 from pySim.ts_51_011 import EF, DF, EF_SST_map
+from pySim.ts_31_102 import EF_UST_map

 from pySim.commands import SimCardCommands
 from pySim.cards import card_detect, Card
-from pySim.utils import h2b, swap_nibbles, rpad, dec_imsi, dec_iccid, 
dec_msisdn, format_xplmn_w_act, dec_spn
+from pySim.utils import h2b, swap_nibbles, rpad, dec_imsi, dec_iccid, 
dec_msisdn, format_xplmn_w_act, dec_spn, parse_st


 def parse_options():
@@ -236,6 +237,20 @@
        else:
                print("SIM Service Table: Can't read, response code = %s" % 
(sw,))

+       # Check whether we have th AID of USIM, if so select it by its AID
+       # EF.UST - File Id in ADF USIM : 6f38
+       if '9000' == card.select_adf_by_aid():
+               # EF.UST
+               (res, sw) = card.read_binary('6f38')
+               if sw == '9000':
+                       avail_srvs = parse_st(res)
+                       print("USIM Service Table: %s" % res)
+                       # Print those which are available
+                       for s in avail_srvs:
+                               if s in EF_UST_map:
+                                       print('\tService %d - %s: %s' % (s, 
EF_UST_map[s], s in avail_srvs))
+               else:
+                       print("USIM Service Table: Can't read, response code = 
%s" % (sw,))

        # Done for this card and maybe for everything ?
        print("Done !\n")

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

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I54dbbd40bd3d22cee81f7c32e58cd946f8564257
Gerrit-Change-Number: 17879
Gerrit-PatchSet: 1
Gerrit-Owner: herlesupreeth <[email protected]>
Gerrit-MessageType: newchange

Reply via email to