1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-05-29 04:08:46 +00:00

use mock config for stmhal, setup hid in boot

This commit is contained in:
Pavol Rusnak 2016-09-20 16:58:47 +02:00
parent 7aa8593941
commit f42b62fa40
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
3 changed files with 46 additions and 40 deletions

View File

@ -0,0 +1,6 @@
import sys
if sys.platform in ['trezor', 'pyboard']: # stmhal
import pyb
# hid=(subclass, protocol, max_packet_len, polling_interval, report_desc)
pyb.usb_mode('CDC+HID', vid=0x1209, pid=0x53C1, hid=(0, 0, 64, 1, b'\x06\x00\xff\x09\x01\xa1\x01\x09\x20\x15\x00\x26\xff\x00\x75\x08\x95\x40\x81\x02\x09\x21\x15\x00\x26\xff\x00\x75\x08\x95\x40\x91\x02\xc0'))

View File

@ -1,23 +1,13 @@
import sys
if sys.platform == 'trezor': # stmhal - use binary module (not working atm)
from TrezorConfig import Config
_config = Config()
def get(app, key, default=None):
v = _config.get(app, key)
return v if v else default
def set(app, key, value):
return _config.set(app, key, value)
else: # emulator (mock implementation using binary file)
import ustruct
# mock implementation using binary file
_mock = {}
if sys.platform in ['trezor', 'pyboard']: # stmhal
_file = '/flash/trezor.config'
else:
_file = '/var/tmp/trezor.config'
def _load():

10
src/trezor/config.py.real Normal file
View File

@ -0,0 +1,10 @@
from TrezorConfig import Config
_config = Config()
def get(app, key, default=None):
v = _config.get(app, key)
return v if v else default
def set(app, key, value):
return _config.set(app, key, value)