moved config change code to simtrace.py

This commit is contained in:
Christina Quast
2015-03-06 19:12:55 +01:00
parent 71742c770c
commit d065a4b59d

View File

@@ -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)