diff options
| author | hathach <[email protected]> | 2025-07-11 15:15:14 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2025-07-11 15:24:17 +0700 |
| commit | e9a78c52d00aa1cad8a9f80bbb2db5df70f1d8ad (patch) | |
| tree | b5f3e0d191f7e7fe38bc6e803c1203bbd51ec934 /test/unit-test | |
| parent | 40dc1dd436ce96d9d3257d6de60f3c28fd38e294 (diff) | |
add tud_msc_inquiry2_cb() for full inquiry response
Diffstat (limited to 'test/unit-test')
| -rw-r--r-- | test/unit-test/test/device/msc/test_msc_device.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/test/unit-test/test/device/msc/test_msc_device.c b/test/unit-test/test/device/msc/test_msc_device.c index 3ab46b0f9..e05e9c8b0 100644 --- a/test/unit-test/test/device/msc/test_msc_device.c +++ b/test/unit-test/test/device/msc/test_msc_device.c @@ -94,19 +94,20 @@ enum uint8_t msc_disk[DISK_BLOCK_NUM][DISK_BLOCK_SIZE]; -// Invoked when received SCSI_CMD_INQUIRY -// Application fill vendor id, product id and revision with string up to 8, 16, 4 characters respectively -void tud_msc_inquiry_cb(uint8_t lun, uint8_t vendor_id[8], uint8_t product_id[16], uint8_t product_rev[4]) -{ +// Invoked when received SCSI_CMD_INQUIRY, v2 with full inquiry response +// Some inquiry_resp's fields are already filled with default values, application can update them +// Return length of inquiry response, typically sizeof(scsi_inquiry_resp_t) (36 bytes), can be longer if included vendor data. +uint32_t tud_msc_inquiry2_cb(uint8_t lun, scsi_inquiry_resp_t* inquiry_resp) { (void) lun; - const char vid[] = "TinyUSB"; const char pid[] = "Mass Storage"; const char rev[] = "1.0"; - memcpy(vendor_id , vid, strlen(vid)); - memcpy(product_id , pid, strlen(pid)); - memcpy(product_rev, rev, strlen(rev)); + memcpy(inquiry_resp->vendor_id, vid, strlen(vid)); + memcpy(inquiry_resp->product_id, pid, strlen(pid)); + memcpy(inquiry_resp->product_rev, rev, strlen(rev)); + + return sizeof(scsi_inquiry_resp_t); // 36 bytes } // Invoked when received Test Unit Ready command. |
