diff options
| author | hathach <[email protected]> | 2019-03-04 11:51:36 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2019-03-04 11:51:36 +0700 |
| commit | a19455d1ff2581b07b1ace00f5a2820165bd8e98 (patch) | |
| tree | 0f6290b229522065243b868e2ef0eadd6be3d544 /src/class | |
| parent | f23affbb0a85d2dff8f5c0da80dd21ce2ac491af (diff) | |
follow up to PR #39
Diffstat (limited to 'src/class')
| -rw-r--r-- | src/class/msc/msc_device.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/class/msc/msc_device.c b/src/class/msc/msc_device.c index abc051252..b9eaa4933 100644 --- a/src/class/msc/msc_device.c +++ b/src/class/msc/msc_device.c @@ -265,20 +265,20 @@ int32_t proc_builtin_scsi(msc_cbw_t const * p_cbw, uint8_t* buffer, uint32_t buf .is_removable = 1,
.version = 2,
.response_data_format = 2,
- .vendor_id = " ",
- .product_id = " ",
- .product_rev = " ",
+ // vendor_id, product_id, product_rev is space padded string
+ .vendor_id = "",
+ .product_id = "",
+ .product_rev = "",
};
- size_t len;
- #define _min(a,b) ((a) < (b) ? (a) : (b))
- len = strlen(CFG_TUD_MSC_VENDOR);
- memcpy(inquiry_rsp.vendor_id , CFG_TUD_MSC_VENDOR , _min(len, sizeof(inquiry_rsp.vendor_id)));
- len = strlen(CFG_TUD_MSC_PRODUCT);
- memcpy(inquiry_rsp.product_id , CFG_TUD_MSC_PRODUCT , _min(len, sizeof(inquiry_rsp.product_id)));
- len = strlen(CFG_TUD_MSC_PRODUCT_REV);
- memcpy(inquiry_rsp.product_rev, CFG_TUD_MSC_PRODUCT_REV, _min(len, sizeof(inquiry_rsp.product_rev)));
- #undef _min
+ memset(inquiry_rsp.vendor_id, ' ', sizeof(inquiry_rsp.vendor_id));
+ memcpy(inquiry_rsp.vendor_id, CFG_TUD_MSC_VENDOR, tu_min32(strlen(CFG_TUD_MSC_VENDOR), sizeof(inquiry_rsp.vendor_id)));
+
+ memset(inquiry_rsp.product_id, ' ', sizeof(inquiry_rsp.product_id));
+ memcpy(inquiry_rsp.product_id, CFG_TUD_MSC_PRODUCT, tu_min32(strlen(CFG_TUD_MSC_PRODUCT), sizeof(inquiry_rsp.product_id)));
+
+ memset(inquiry_rsp.product_rev, ' ', sizeof(inquiry_rsp.product_rev));
+ memcpy(inquiry_rsp.product_rev, CFG_TUD_MSC_PRODUCT_REV, tu_min32(strlen(CFG_TUD_MSC_PRODUCT_REV), sizeof(inquiry_rsp.product_rev)));
ret = sizeof(inquiry_rsp);
memcpy(buffer, &inquiry_rsp, ret);
|
