summaryrefslogtreecommitdiff
path: root/examples/device/dynamic_configuration/src/msc_disk.c
diff options
context:
space:
mode:
authorhathach <[email protected]>2025-07-11 15:15:14 +0700
committerhathach <[email protected]>2025-07-11 15:24:17 +0700
commite9a78c52d00aa1cad8a9f80bbb2db5df70f1d8ad (patch)
treeb5f3e0d191f7e7fe38bc6e803c1203bbd51ec934 /examples/device/dynamic_configuration/src/msc_disk.c
parent40dc1dd436ce96d9d3257d6de60f3c28fd38e294 (diff)
add tud_msc_inquiry2_cb() for full inquiry response
Diffstat (limited to 'examples/device/dynamic_configuration/src/msc_disk.c')
-rw-r--r--examples/device/dynamic_configuration/src/msc_disk.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/examples/device/dynamic_configuration/src/msc_disk.c b/examples/device/dynamic_configuration/src/msc_disk.c
index 10c3ac6fe..8987c06be 100644
--- a/examples/device/dynamic_configuration/src/msc_disk.c
+++ b/examples/device/dynamic_configuration/src/msc_disk.c
@@ -116,19 +116,20 @@ uint8_t msc_disk[DISK_BLOCK_NUM][DISK_BLOCK_SIZE] =
README_CONTENTS
};
-// 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.