1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-26 09:28:13 +00:00

make event ids positive again

They are unsigned on the python side anyway.
This commit is contained in:
Jan Pochyla 2016-05-03 17:10:53 +02:00 committed by Pavol Rusnak
parent 0ba9f6b6bb
commit b5f8c2303c
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);
@ -70,7 +70,7 @@ STATIC mp_obj_t mod_TrezorMsg_Msg_select(mp_obj_t self, mp_obj_t timeout_us) {
vstr_init_len(&vstr, 64); vstr_init_len(&vstr, 64);
memcpy(vstr.buf, m, 64); memcpy(vstr.buf, m, 64);
mp_obj_tuple_t *tuple = MP_OBJ_TO_PTR(mp_obj_new_tuple(2, NULL)); 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[0] = MP_OBJ_NEW_SMALL_INT(4);
tuple->items[1] = mp_obj_new_str_from_vstr(&mp_type_bytes, &vstr); tuple->items[1] = mp_obj_new_str_from_vstr(&mp_type_bytes, &vstr);
return MP_OBJ_FROM_PTR(tuple); return MP_OBJ_FROM_PTR(tuple);
} }