diff options
Diffstat (limited to 'tmk_core/common/webusb.c')
-rw-r--r-- | tmk_core/common/webusb.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tmk_core/common/webusb.c b/tmk_core/common/webusb.c index 82e8fe1c83..63b967b7bf 100644 --- a/tmk_core/common/webusb.c +++ b/tmk_core/common/webusb.c @@ -1,3 +1,4 @@ +#include <string.h> #include "webusb.h" #include "wait.h" @@ -6,6 +7,8 @@ webusb_state_t webusb_state = { .pairing = false, }; +#define pl u8"https://plop.com" + void webusb_receive(uint8_t *data, uint8_t length) { uint8_t command = data[0]; @@ -20,6 +23,24 @@ void webusb_receive(uint8_t *data, uint8_t length) { return; } + if(command == WEBUSB_GET_LANDING_PAGE) { + uint8_t lp_size = sizeof(WEBUSB_LANDING_PAGE_URL); + uint8_t url[lp_size]; + memcpy(url, WEBUSB_LANDING_PAGE_URL, lp_size); + + uint8_t event[2]; + event[0] = WEBUSB_STATUS_OK; + event[1] = WEBUSB_EVT_LANDING_PAGE; + + uint8_t stop[1]; + stop[0] = WEBUSB_STOP_BIT; + + webusb_send(event, sizeof(event)); + webusb_send(url, lp_size); + webusb_send(stop, 1); + return; + } + if(webusb_state.paired == true) { switch(command) { //Handle commands in here |