Skip to content

Commit 4a88af1

Browse files
committed
add command to retrieve version info
1 parent c40415c commit 4a88af1

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

main/usb_uart_bridge_main.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include "freertos/ringbuf.h"
1111
#include "driver/gpio.h"
1212
#include "driver/uart.h"
13+
#include "esp_app_desc.h"
1314
#include "esp_event.h"
1415
#include "esp_mac.h"
1516
#include "esp_log.h"
@@ -170,6 +171,16 @@ static void tinyusb_cdc_rx_callback(int itf, cdcacm_event_t *event)
170171
if (ret == ESP_OK && rx_size > 0) {
171172
if (s_cmd_mode_enabled) {
172173
switch (rx_buf[0]) {
174+
case 'I':
175+
case 'i':
176+
// Respond with version info
177+
const esp_app_desc_t *app_desc = esp_app_get_description();
178+
char info_buf[64]; // 31 static + 32 max version length + 1 byte null terminator
179+
int len = snprintf(info_buf, sizeof(info_buf), "USB2UART bridge\r\nversion %s\r\n", app_desc->version);
180+
xRingbufferSend(s_usb_tx_ringbuf, info_buf, len, 0);
181+
xTaskNotifyGive(s_usb_tx_handle);
182+
// Do not exit command mode
183+
return;
173184
case 'B':
174185
case 'b':
175186
if (rx_buf[1] == 'e' || rx_buf[1] == 'E') {

0 commit comments

Comments
 (0)