Add firmware_name to info response

This commit is contained in:
Ian Gulliver
2026-04-06 20:09:30 +09:00
parent 49bbe1b29c
commit f837937cb7
7 changed files with 16 additions and 5 deletions

View File

@@ -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

View File

@@ -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 = {

View File

@@ -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);

View File

@@ -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] = {};

View File

@@ -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));
} }

View File

@@ -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},

View File

@@ -7,9 +7,10 @@ type ResponsePICOBOOT struct{}
type RequestInfo struct{} type RequestInfo struct{}
type ResponseInfo struct { 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 {