mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-13 19:18:56 +00:00
implement hid methods in trezor.msg
This commit is contained in:
parent
a15730087c
commit
d32dc93c10
@ -1,4 +1,7 @@
|
||||
#include <usrsw.h>
|
||||
extern struct _USBD_HandleTypeDef hUSBDDevice;
|
||||
extern int switch_get(void);
|
||||
extern uint8_t USBD_HID_SendReport(struct _USBD_HandleTypeDef *pdev, uint8_t *report, uint16_t len);
|
||||
extern int USBD_HID_Rx(uint8_t *buf, uint32_t len, uint32_t timeout);
|
||||
|
||||
void msg_init(void)
|
||||
{
|
||||
@ -6,12 +9,15 @@ void msg_init(void)
|
||||
|
||||
ssize_t msg_recv(uint8_t *iface, uint8_t *buf, size_t len)
|
||||
{
|
||||
return 0;
|
||||
*iface = 0; // use always interface 0 for now
|
||||
return USBD_HID_Rx(buf, len, 1);
|
||||
}
|
||||
|
||||
ssize_t msg_send(uint8_t iface, const uint8_t *buf, size_t len)
|
||||
{
|
||||
return -1;
|
||||
(void)iface; // ignore interface for now
|
||||
USBD_HID_SendReport(&hUSBDDevice, (uint8_t *)buf, len);
|
||||
return len;
|
||||
}
|
||||
|
||||
// this should match values used in trezorui_poll_sdl_event() in modtrezorui/display-unix.h
|
||||
|
2
vendor/micropython
vendored
2
vendor/micropython
vendored
@ -1 +1 @@
|
||||
Subproject commit 543ad3d43277b81d25c6f6cbba4215e12d761856
|
||||
Subproject commit 177a7bc48bca3cd9fb8de9103fce2e26ce996c1a
|
Loading…
Reference in New Issue
Block a user