summaryrefslogtreecommitdiff
path: root/tmk_core/common
diff options
context:
space:
mode:
authorFlorian Didron <fd@librem.one>2019-12-02 18:58:07 +0900
committerFlorian Didron <fdidron@users.noreply.github.com>2019-12-06 08:20:51 +0900
commit54d6f5d4c50af2ea09a103825040e739d7acd58b (patch)
tree6c534c04dad4452c8833d4b5df7d0dea5fe90d0e /tmk_core/common
parent3a14d8874fb53d3d705c4d4515942db3b584399c (diff)
feat: add fw version webusb cmd
Diffstat (limited to 'tmk_core/common')
-rw-r--r--tmk_core/common/webusb.c8
-rw-r--r--tmk_core/common/webusb.h5
2 files changed, 8 insertions, 5 deletions
diff --git a/tmk_core/common/webusb.c b/tmk_core/common/webusb.c
index 47507bab55..f269ed58be 100644
--- a/tmk_core/common/webusb.c
+++ b/tmk_core/common/webusb.c
@@ -20,9 +20,9 @@ void webusb_receive(uint8_t *data, uint8_t length) {
return;
}
- if(command == WEBUSB_GET_LANDING_PAGE) {
+ if(command == WEBUSB_GET_FW_VERSION) {
// Landing page + packet headers(2) + stop bit(1)
- uint8_t lp_size = sizeof(WEBUSB_LANDING_PAGE_URL) + 3;
+ uint8_t lp_size = sizeof(FIRMWARE_VERSION) + 3;
uint8_t url[lp_size];
uint8_t event[2];
@@ -33,8 +33,8 @@ void webusb_receive(uint8_t *data, uint8_t length) {
stop[0] = WEBUSB_STOP_BIT;
memcpy(url, event, 2);
- memcpy(url + 2, WEBUSB_LANDING_PAGE_URL, sizeof(WEBUSB_LANDING_PAGE_URL));
- memcpy(url + 2 + sizeof(WEBUSB_LANDING_PAGE_URL), stop, 1);
+ memcpy(url + 2, FIRMWARE_VERSION, sizeof(FIRMWARE_VERSION));
+ memcpy(url + 2 + sizeof(FIRMWARE_VERSION), stop, 1);
webusb_send(url, lp_size);
return;
}
diff --git a/tmk_core/common/webusb.h b/tmk_core/common/webusb.h
index 873ecb7ce2..7696db677d 100644
--- a/tmk_core/common/webusb.h
+++ b/tmk_core/common/webusb.h
@@ -3,6 +3,9 @@
#include <stdint.h>
#include <stdbool.h>
+#ifndef FIRMWARE_VERSION
+#define FIRMWARE_VERSION u8"default"
+#endif
#define WEBUSB_STOP_BIT -2
#define WEBUSB_BLINK_STEPS 512
#define WEBUSB_BLINK_END WEBUSB_BLINK_STEPS * 60
@@ -27,7 +30,7 @@ enum Webusb_Status_Code {
enum Webusb_Command_Code {
WEBUSB_CMD_PAIR,
- WEBUSB_GET_LANDING_PAGE
+ WEBUSB_GET_FW_VERSION
};
enum Webusb_Event_Code {