diff options
| author | Ha Thach <[email protected]> | 2025-07-11 17:45:38 +0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-07-11 17:45:38 +0700 |
| commit | 29c2af7651f9075a63a036e94c7bbe3d0d00c31a (patch) | |
| tree | 84c5c5ebede845756175961dde7f8b725d94d228 /test | |
| parent | 5ce3e3bc0121441004227d4be3c1064231be1cbe (diff) | |
| parent | e9a78c52d00aa1cad8a9f80bbb2db5df70f1d8ad (diff) | |
Merge pull request #3172 from hathach/msc-inquiry2-cb
add tud_msc_inquiry2_cb() for full inquiry response
Diffstat (limited to '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. |
