summaryrefslogtreecommitdiff
path: root/src/packet_interface.h
diff options
context:
space:
mode:
authorjaseg <git@jaseg.net>2018-11-12 11:59:11 +0900
committerjaseg <git@jaseg.net>2018-11-12 11:59:11 +0900
commit2f4f3e13aa6a6dbbb5a45e02b792eb935e91c766 (patch)
tree80a4520254d93523fc75f25624d53b161944013d /src/packet_interface.h
parent42d4bebde7d3cc7f536dec114ca5a54072b9e21b (diff)
downloadsecure-hid-2f4f3e13aa6a6dbbb5a45e02b792eb935e91c766.tar.gz
secure-hid-2f4f3e13aa6a6dbbb5a45e02b792eb935e91c766.tar.bz2
secure-hid-2f4f3e13aa6a6dbbb5a45e02b792eb935e91c766.zip
Handshake working with new abstractions
Diffstat (limited to 'src/packet_interface.h')
-rw-r--r--src/packet_interface.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/packet_interface.h b/src/packet_interface.h
index 546918b..9e1327d 100644
--- a/src/packet_interface.h
+++ b/src/packet_interface.h
@@ -3,8 +3,35 @@
#include "usart_helpers.h"
+
extern struct dma_usart_file *usart2_out;
+enum control_packet_types {
+ _HOST_RESERVED = 0,
+ HOST_INITIATE_HANDSHAKE = 1,
+ HOST_HANDSHAKE = 2,
+ HOST_DATA = 3,
+};
+
+enum packet_types {
+ _PACKET_RESERVED = 0,
+ HID_KEYBOARD_REPORT = 1,
+ HID_MOUSE_REPORT = 2,
+ PAIRING = 3,
+};
+
+struct hid_report_packet {
+ uint8_t type;
+ uint8_t len;
+ uint8_t report[8];
+} __attribute__((__packed__));
+
+struct control_packet {
+ uint8_t type;
+ uint8_t payload[0];
+} __attribute__((__packed__));
+
+
void send_packet(struct dma_usart_file *f, const uint8_t *data, size_t len);
#endif