Merge pull request #382 from DrDoof/fix/sfp-empty-slot-json

sfp: stop the web pages printing the previous slot's bytes
This commit is contained in:
René van Dorst
2026-09-02 08:25:42 +02:00
committed by GitHub
+4 -3
View File
@@ -179,8 +179,8 @@ void send_sfp_info(uint8_t sfp)
{ {
// This loops over the Vendor-name, Vendor OUI, Vendor PN and Vendor rev ASCII fields // This loops over the Vendor-name, Vendor OUI, Vendor PN and Vendor rev ASCII fields
for (uint8_t i = 16; i < 64; i++) { for (uint8_t i = 16; i < 64; i++) {
if (!(i & 0xf)) if (!(i & 0xf) && !sfp_read_block(sfp, i, 16))
sfp_read_block(sfp, i, 16); return;
if (i < 20 || i >= 60 || (i >= 36 && i < 40)) // Skip Non-ASCII codes if (i < 20 || i >= 60 || (i >= 36 && i < 40)) // Skip Non-ASCII codes
continue; continue;
uint8_t c = sfp_buf[i & 0xf]; uint8_t c = sfp_buf[i & 0xf];
@@ -196,7 +196,8 @@ void sfp_send_data(uint8_t slot, uint8_t reg, uint8_t len)
if (len > 16) if (len > 16)
return; return;
sfp_read_block(slot, reg, len); if (!sfp_read_block(slot, reg, len))
return;
for (uint8_t i = 0; i < len; i++) for (uint8_t i = 0; i < len; i++)
byte_to_html(sfp_buf[i]); byte_to_html(sfp_buf[i]);