|
49 | 49 | #include "shared-bindings/hashlib/Hash.h"
|
50 | 50 | #include "shared-bindings/mdns/RemoteService.h"
|
51 | 51 | #include "shared-bindings/mdns/Server.h"
|
| 52 | +#include "shared-bindings/microcontroller/Processor.h" |
52 | 53 | #include "shared-bindings/socketpool/__init__.h"
|
53 | 54 | #include "shared-bindings/socketpool/Socket.h"
|
54 | 55 | #include "shared-bindings/socketpool/SocketPool.h"
|
@@ -768,8 +769,17 @@ static void _reply_with_version_json(socketpool_socket_obj_t *socket, _request *
|
768 | 769 | "\"creator_id\": %u, "
|
769 | 770 | "\"creation_id\": %u, "
|
770 | 771 | "\"hostname\": \"%s\", "
|
771 |
| - "\"port\": %d, " |
772 |
| - "\"ip\": \"%s\"}", CIRCUITPY_CREATOR_ID, CIRCUITPY_CREATION_ID, hostname, web_api_port, _our_ip_encoded); |
| 772 | + "\"port\": %d, ", CIRCUITPY_CREATOR_ID, CIRCUITPY_CREATION_ID, hostname, web_api_port, _our_ip_encoded); |
| 773 | + #if CIRCUITPY_MICROCONTROLLER && COMMON_HAL_MCU_PROCESSOR_UID_LENGTH > 0 |
| 774 | + uint8_t raw_id[COMMON_HAL_MCU_PROCESSOR_UID_LENGTH]; |
| 775 | + common_hal_mcu_processor_get_uid(raw_id); |
| 776 | + mp_printf(&_socket_print, "\"UID\": \""); |
| 777 | + for (uint8_t i = 0; i < COMMON_HAL_MCU_PROCESSOR_UID_LENGTH; i++) { |
| 778 | + mp_printf(&_socket_print, "%02X", raw_id[i]); |
| 779 | + } |
| 780 | + mp_printf(&_socket_print, "\", "); |
| 781 | + #endif |
| 782 | + mp_printf(&_socket_print, "\"ip\": \"%s\"}", _our_ip_encoded); |
773 | 783 | // Empty chunk signals the end of the response.
|
774 | 784 | _send_chunk(socket, "");
|
775 | 785 | }
|
|
0 commit comments