Skip to content

Commit

Permalink
ZuluSCSI_initiator: Print disk parameters in log
Browse files Browse the repository at this point in the history
  • Loading branch information
reinauer committed Oct 22, 2023
1 parent 162426c commit 7300eb4
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/ZuluSCSI_initiator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,8 @@ void scsiInitiatorMainLoop()
delay_with_poll(1000);

uint8_t inquiry_data[36];
char vendor[9], product[17], revision[5];
int type;

LED_ON();
bool startstopok =
Expand All @@ -185,6 +187,15 @@ void scsiInitiatorMainLoop()

bool inquiryok = startstopok &&
scsiInquiry(g_initiator_state.target_id, inquiry_data);

memcpy(vendor, &inquiry_data[8], 8);
vendor[8]=0;
memcpy(product, &inquiry_data[16], 16);
product[16]=0;
memcpy(revision, &inquiry_data[32], 4);
revision[4]=0;
type=inquiry_data[0]&0x1f;

LED_OFF();

uint64_t total_bytes = 0;
Expand All @@ -194,6 +205,12 @@ void scsiInitiatorMainLoop()
" capacity ", (int)g_initiator_state.sectorcount,
" sectors x ", (int)g_initiator_state.sectorsize, " bytes");

logmsg("[SCSI", g_initiator_state.target_id,"]");
logmsg(" Vendor = \"", vendor,"\"");
logmsg(" Product = \"", product,"\"");
logmsg(" Version = \"", revision,"\"");
logmsg(" Type = ", type);

g_initiator_state.sectorcount_all = g_initiator_state.sectorcount;

total_bytes = (uint64_t)g_initiator_state.sectorcount * g_initiator_state.sectorsize;
Expand Down

0 comments on commit 7300eb4

Please sign in to comment.