Skip to content

Commit 2226e73

Browse files
committed
panel: name the drive being imaged in the initiator summary
"Imaging SCSI ID 5 at 1337 kB/s" does not answer what it is imaging. The identity is in the per-target table behind GET_INITIATOR_STATUS, which is async and so is exactly the thing an imaging board cannot deliver - the panel and the web UI were left with a rate and nothing else. Carry the current target's type, vendor, product and size in the summary, which the ISR answers. It is a few more bytes on a command that already reads the same target's sector counts for the progress figure.
1 parent 49da728 commit 2226e73

2 files changed

Lines changed: 19 additions & 2 deletions

File tree

lib/BlueSCSI_platform_RP2MCU/panel_protocol.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -802,8 +802,16 @@ static size_t handle_get_initiator_summary(uint8_t* response, size_t max_size) {
802802
if (tstatus == PANEL_INITIATOR_TARGET_DONE) {
803803
sum->targets_imaged++;
804804
}
805-
if (id == current_target && sectorcount > 0) {
806-
sum->progress = (uint8_t)(100ULL * sectors_done / sectorcount);
805+
if (id == current_target) {
806+
if (sectorcount > 0) {
807+
sum->progress = (uint8_t)(100ULL * sectors_done / sectorcount);
808+
}
809+
scsiInitiatorGetTargetInfo(id, NULL, &sum->device_type, NULL,
810+
&sum->sectorcount, &sum->sectorsize, NULL,
811+
NULL, sum->vendor, sum->product,
812+
NULL, NULL, NULL, NULL);
813+
sum->vendor[sizeof(sum->vendor) - 1] = '\0';
814+
sum->product[sizeof(sum->product) - 1] = '\0';
807815
}
808816
}
809817

lib/BlueSCSI_platform_RP2MCU/panel_protocol_defs_initiator.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,15 @@ typedef struct __attribute__((packed)) {
5656
uint8_t targets_found;
5757
uint8_t targets_imaged;
5858
uint16_t speed_kbps;
59+
// Identity and size of the target being worked on. Static once scanned, but
60+
// carried here because the async per-target table is the thing an imaging
61+
// board cannot deliver - and "Imaging SCSI ID 5" with nothing else is not
62+
// much of an answer to "what is it doing".
63+
uint8_t device_type; // SCSI peripheral type of the current target
64+
uint32_t sectorcount;
65+
uint32_t sectorsize;
66+
char vendor[9]; // null-terminated
67+
char product[17]; // null-terminated
5968
} panel_initiator_summary_t;
6069

6170
static_assert(offsetof(device_list_response_t, reserved) == 2,

0 commit comments

Comments
 (0)