diff options
author | Florian Didron <fd@librem.one> | 2019-12-01 23:18:23 +0900 |
---|---|---|
committer | Florian Didron <fdidron@users.noreply.github.com> | 2019-12-06 08:20:51 +0900 |
commit | 3a14d8874fb53d3d705c4d4515942db3b584399c (patch) | |
tree | d759a94b3045a13e5af5e940c4929a82fce18701 /tmk_core/common/webusb.c | |
parent | 354af718940929d235ad49d4c32194f6f40c8fa0 (diff) |
chore: refactor webusb lp url command
Diffstat (limited to 'tmk_core/common/webusb.c')
-rw-r--r-- | tmk_core/common/webusb.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/tmk_core/common/webusb.c b/tmk_core/common/webusb.c index 5d8993ac78..47507bab55 100644 --- a/tmk_core/common/webusb.c +++ b/tmk_core/common/webusb.c @@ -1,7 +1,6 @@ #include <string.h> #include "webusb.h" #include "wait.h" - webusb_state_t webusb_state = { .paired = false, .pairing = false, @@ -22,9 +21,9 @@ void webusb_receive(uint8_t *data, uint8_t length) { } if(command == WEBUSB_GET_LANDING_PAGE) { - uint8_t lp_size = sizeof(WEBUSB_LANDING_PAGE_URL); + // Landing page + packet headers(2) + stop bit(1) + uint8_t lp_size = sizeof(WEBUSB_LANDING_PAGE_URL) + 3; uint8_t url[lp_size]; - memcpy(url, WEBUSB_LANDING_PAGE_URL, lp_size); uint8_t event[2]; event[0] = WEBUSB_STATUS_OK; @@ -33,9 +32,10 @@ void webusb_receive(uint8_t *data, uint8_t length) { uint8_t stop[1]; stop[0] = WEBUSB_STOP_BIT; - webusb_send(event, sizeof(event)); + 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); webusb_send(url, lp_size); - webusb_send(stop, 1); return; } |