Add firmware_name to info response
This commit is contained in:
@@ -61,6 +61,7 @@ func run() error {
|
|||||||
r.info.BoardID[4], r.info.BoardID[5], r.info.BoardID[6], r.info.BoardID[7])
|
r.info.BoardID[4], r.info.BoardID[5], r.info.BoardID[6], r.info.BoardID[7])
|
||||||
fmt.Printf(" MAC: %s\n", net.HardwareAddr(r.info.MAC[:]))
|
fmt.Printf(" MAC: %s\n", net.HardwareAddr(r.info.MAC[:]))
|
||||||
fmt.Printf(" Link-Local: %s\n", net.IP(r.info.LinkLocal[:]))
|
fmt.Printf(" Link-Local: %s\n", net.IP(r.info.LinkLocal[:]))
|
||||||
|
fmt.Printf(" Firmware: %s\n", r.info.FirmwareName)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
#include "handlers.h"
|
#include "handlers.h"
|
||||||
#include "w6300.h"
|
#include "w6300.h"
|
||||||
|
|
||||||
|
std::string_view firmware_name = "picomap";
|
||||||
|
|
||||||
static constexpr uint16_t PICOMAP_DISCOVERY_PORT = 28777;
|
static constexpr uint16_t PICOMAP_DISCOVERY_PORT = 28777;
|
||||||
|
|
||||||
static constexpr std::array<uint8_t, 16> picomap_discovery_ip = {
|
static constexpr std::array<uint8_t, 16> picomap_discovery_ip = {
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
#include <string_view>
|
||||||
#include "wire.h"
|
#include "wire.h"
|
||||||
#include "usb_cdc.h"
|
#include "usb_cdc.h"
|
||||||
|
|
||||||
|
extern std::string_view firmware_name;
|
||||||
|
|
||||||
void handle_picoboot(usb_cdc& usb, uint32_t message_id);
|
void handle_picoboot(usb_cdc& usb, uint32_t message_id);
|
||||||
void handle_info(usb_cdc& usb, uint32_t message_id);
|
void handle_info(usb_cdc& usb, uint32_t message_id);
|
||||||
|
|||||||
@@ -48,8 +48,9 @@ struct ResponseInfo {
|
|||||||
std::array<uint8_t, 8> board_id;
|
std::array<uint8_t, 8> board_id;
|
||||||
std::array<uint8_t, 6> mac;
|
std::array<uint8_t, 6> mac;
|
||||||
std::array<uint8_t, 16> link_local;
|
std::array<uint8_t, 16> link_local;
|
||||||
auto as_tuple() const { return std::tie(board_id, mac, link_local); }
|
std::string firmware_name;
|
||||||
auto as_tuple() { return std::tie(board_id, mac, link_local); }
|
auto as_tuple() const { return std::tie(board_id, mac, link_local, firmware_name); }
|
||||||
|
auto as_tuple() { return std::tie(board_id, mac, link_local, firmware_name); }
|
||||||
};
|
};
|
||||||
|
|
||||||
static constexpr uint8_t hash_key[8] = {};
|
static constexpr uint8_t hash_key[8] = {};
|
||||||
|
|||||||
@@ -18,5 +18,6 @@ void handle_info(usb_cdc& usb, uint32_t message_id) {
|
|||||||
auto ninfo = w6300::get_net_info();
|
auto ninfo = w6300::get_net_info();
|
||||||
resp.mac = ninfo.mac;
|
resp.mac = ninfo.mac;
|
||||||
resp.link_local = ninfo.lla;
|
resp.link_local = ninfo.lla;
|
||||||
|
resp.firmware_name = firmware_name;
|
||||||
usb.send(encode_response(message_id, resp));
|
usb.send(encode_response(message_id, resp));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
#include "dispatch.h"
|
#include "dispatch.h"
|
||||||
#include "handlers.h"
|
#include "handlers.h"
|
||||||
|
|
||||||
|
std::string_view firmware_name = "picomap_test";
|
||||||
|
|
||||||
static constexpr handler_entry handlers[] = {
|
static constexpr handler_entry handlers[] = {
|
||||||
{RequestPICOBOOT::ext_id, handle_picoboot},
|
{RequestPICOBOOT::ext_id, handle_picoboot},
|
||||||
{RequestInfo::ext_id, handle_info},
|
{RequestInfo::ext_id, handle_info},
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ type ResponseInfo struct {
|
|||||||
BoardID [8]byte
|
BoardID [8]byte
|
||||||
MAC [6]byte
|
MAC [6]byte
|
||||||
LinkLocal [16]byte
|
LinkLocal [16]byte
|
||||||
|
FirmwareName string
|
||||||
}
|
}
|
||||||
|
|
||||||
type DeviceError struct {
|
type DeviceError struct {
|
||||||
|
|||||||
Reference in New Issue
Block a user