parent
67ac47f087
commit
688d293b01
@ -1,19 +1,19 @@
|
|||||||
import ubinascii
|
from ubinascii import hexlify
|
||||||
from micropython import const
|
from micropython import const
|
||||||
from trezor import msg, loop, log
|
from trezor import msg, loop, log
|
||||||
|
|
||||||
_DEFAULT_IFACE = const(0xFF00) # TODO: use proper interface
|
_DEFAULT_IFACE = const(0xFF00) # TODO: use proper interface
|
||||||
|
|
||||||
|
|
||||||
def read_report_stream(target, iface=_DEFAULT_IFACE):
|
def read_report_stream(target, iface=_DEFAULT_IFACE):
|
||||||
while True:
|
while True:
|
||||||
report, = yield loop.Select(iface)
|
report, = yield loop.Select(iface)
|
||||||
log.debug(__name__, 'read report %s', ubinascii.hexlify(report))
|
log.debug(__name__, 'read report %s', hexlify(report))
|
||||||
target.send(report)
|
target.send(memoryview(report))
|
||||||
|
|
||||||
|
|
||||||
def write_report_stream(iface=_DEFAULT_IFACE):
|
def write_report_stream(iface=_DEFAULT_IFACE):
|
||||||
while True:
|
while True:
|
||||||
report = yield
|
report = yield
|
||||||
log.debug(__name__, 'write report %s', ubinascii.hexlify(report))
|
log.debug(__name__, 'write report %s', hexlify(report))
|
||||||
msg.send(iface, report)
|
msg.send(iface, report)
|
||||||
|
Loading…
Reference in new issue