1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-23 06:48:16 +00:00

return tuple for msg events as well

This commit is contained in:
Pavol Rusnak 2016-04-29 19:07:36 +02:00
parent e13d4ac581
commit 34e3b51ba8
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D

View File

@ -59,7 +59,7 @@ STATIC mp_obj_t mod_TrezorMsg_Msg_select(mp_obj_t self, mp_obj_t timeout_us) {
uint32_t e = msg_poll_ui_event(); uint32_t e = msg_poll_ui_event();
if (e) { if (e) {
mp_obj_tuple_t *tuple = MP_OBJ_TO_PTR(mp_obj_new_tuple(3, NULL)); mp_obj_tuple_t *tuple = MP_OBJ_TO_PTR(mp_obj_new_tuple(3, NULL));
tuple->items[0] = MP_OBJ_NEW_SMALL_INT((e & 0xFF0000) >> 16); tuple->items[0] = MP_OBJ_NEW_SMALL_INT(-((e & 0xFF0000) >> 16));
tuple->items[1] = MP_OBJ_NEW_SMALL_INT((e & 0xFF00) >> 8); tuple->items[1] = MP_OBJ_NEW_SMALL_INT((e & 0xFF00) >> 8);
tuple->items[2] = MP_OBJ_NEW_SMALL_INT((e & 0xFF)); tuple->items[2] = MP_OBJ_NEW_SMALL_INT((e & 0xFF));
return MP_OBJ_FROM_PTR(tuple); return MP_OBJ_FROM_PTR(tuple);
@ -69,7 +69,10 @@ STATIC mp_obj_t mod_TrezorMsg_Msg_select(mp_obj_t self, mp_obj_t timeout_us) {
vstr_t vstr; vstr_t vstr;
vstr_init_len(&vstr, 64); vstr_init_len(&vstr, 64);
memcpy(vstr.buf, m, 64); memcpy(vstr.buf, m, 64);
return mp_obj_new_str_from_vstr(&mp_type_bytes, &vstr); mp_obj_tuple_t *tuple = MP_OBJ_TO_PTR(mp_obj_new_tuple(2, NULL));
tuple->items[0] = MP_OBJ_NEW_SMALL_INT(-4);
tuple->items[1] = mp_obj_new_str_from_vstr(&mp_type_bytes, &vstr);
return MP_OBJ_FROM_PTR(tuple);
} }
if (to <= 0) { if (to <= 0) {
break; break;