mirror of https://gerrit.osmocom.org/pysim
Reimplement ust_service_activate and ust_service_deactivate for USIM/EF.UST
Fixes: f8d2e2ba08
("split pySim/legacy/{cards,utils} from pySim/{cards,utils}")
Change-Id: I7a6a77b872a6f5d8c478ca75dcff8ea067b8203e
This commit is contained in:
parent
8dc2ca2d37
commit
6c5c3f8b2b
|
@ -466,11 +466,13 @@ class EF_UST(EF_UServiceTable):
|
||||||
|
|
||||||
def do_ust_service_activate(self, arg):
|
def do_ust_service_activate(self, arg):
|
||||||
"""Activate a service within EF.UST"""
|
"""Activate a service within EF.UST"""
|
||||||
self._cmd.card.update_ust(int(arg), 1)
|
selected_file = self._cmd.lchan.selected_file
|
||||||
|
selected_file.ust_update(self._cmd, [int(arg)], [])
|
||||||
|
|
||||||
def do_ust_service_deactivate(self, arg):
|
def do_ust_service_deactivate(self, arg):
|
||||||
"""Deactivate a service within EF.UST"""
|
"""Deactivate a service within EF.UST"""
|
||||||
self._cmd.card.update_ust(int(arg), 0)
|
selected_file = self._cmd.lchan.selected_file
|
||||||
|
selected_file.ust_update(self._cmd, [], [int(arg)])
|
||||||
|
|
||||||
def do_ust_service_check(self, arg):
|
def do_ust_service_check(self, arg):
|
||||||
"""Check consistency between services of this file and files present/activated.
|
"""Check consistency between services of this file and files present/activated.
|
||||||
|
|
|
@ -120,7 +120,26 @@ class EF_UServiceTable(TransparentEF):
|
||||||
cmd.lchan.select_file(self)
|
cmd.lchan.select_file(self)
|
||||||
return num_problems
|
return num_problems
|
||||||
|
|
||||||
|
def ust_update(self, cmd, activate=[], deactivate=[]):
|
||||||
|
service_data, sw = cmd.lchan.read_binary()
|
||||||
|
service_data = h2b(service_data)
|
||||||
|
|
||||||
|
for service in activate:
|
||||||
|
nbyte, nbit = EF_UServiceTable._bit_byte_offset_for_service(service)
|
||||||
|
if nbyte > len(service_data):
|
||||||
|
missing = nbyte - service_data
|
||||||
|
service_data.extend(missing * "00")
|
||||||
|
service_data[nbyte] |= (1 << nbit)
|
||||||
|
|
||||||
|
for service in deactivate:
|
||||||
|
nbyte, nbit = EF_UServiceTable._bit_byte_offset_for_service(service)
|
||||||
|
if nbyte > len(service_data):
|
||||||
|
missing = nbyte - service_data
|
||||||
|
service_data.extend(missing * "00")
|
||||||
|
service_data[nbyte] &= ~(1 << nbit)
|
||||||
|
|
||||||
|
service_data = b2h(service_data)
|
||||||
|
cmd.lchan.update_binary(service_data)
|
||||||
|
|
||||||
# TS 31.102 Section 4.4.2.1
|
# TS 31.102 Section 4.4.2.1
|
||||||
class EF_PBR(LinFixedEF):
|
class EF_PBR(LinFixedEF):
|
||||||
|
|
Loading…
Reference in New Issue