implement hid methods in trezor.msg

This commit is contained in:
Pavol Rusnak 2016-09-23 11:27:26 +02:00
parent a15730087c
commit d32dc93c10
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
2 changed files with 10 additions and 4 deletions

View File

@ -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

@ -1 +1 @@
Subproject commit 543ad3d43277b81d25c6f6cbba4215e12d761856
Subproject commit 177a7bc48bca3cd9fb8de9103fce2e26ce996c1a