mirror of
https://gitea.osmocom.org/sim-card/simtrace2.git
synced 2026-03-16 21:28:33 +03:00
moved config change code to simtrace.py
This commit is contained in:
@@ -5,31 +5,6 @@ from pySim.utils import h2b, swap_nibbles, rpad, dec_imsi, dec_iccid
|
||||
from pySim.transport.pcsc import PcscSimLink
|
||||
|
||||
|
||||
class find_class(object):
|
||||
def __init__(self, class_):
|
||||
self._class = class_
|
||||
def __call__(self, device):
|
||||
# first, let's check the device
|
||||
if device.bDeviceClass == self._class:
|
||||
return True
|
||||
# ok, transverse all devices to find an
|
||||
# interface that matches our class
|
||||
for cfg in device:
|
||||
# find_descriptor: what's it?
|
||||
intf = usb.util.find_descriptor(
|
||||
cfg,
|
||||
bInterfaceClass=self._class
|
||||
)
|
||||
if intf is not None:
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
def set_conf(conf):
|
||||
devs = usb.core.find(find_all=1, custom_match=find_class(0xb)) # 0xb = Smartcard
|
||||
for dev in devs:
|
||||
dev.set_configuration(conf)
|
||||
|
||||
|
||||
def pySim_read():
|
||||
sl = PcscSimLink(0)
|
||||
|
||||
Reference in New Issue
Block a user