diff options
| author | hathach <[email protected]> | 2025-09-30 22:44:58 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2025-09-30 22:44:58 +0700 |
| commit | 732d4a8c97a667dd3784f3b8a664850fa0d767d8 (patch) | |
| tree | 5aaffe2edfbd2b22d1aaa0818a0ba3215b27f1c1 /examples/device | |
| parent | ff492dc2b6c9da4fc6ab7f080435a5cb3e7be1c4 (diff) | |
fix serial, try to test mtp with hil
Diffstat (limited to 'examples/device')
| -rw-r--r-- | examples/device/mtp/src/mtp_fs_example.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/examples/device/mtp/src/mtp_fs_example.c b/examples/device/mtp/src/mtp_fs_example.c index d47ec41b8..4914661bb 100644 --- a/examples/device/mtp/src/mtp_fs_example.c +++ b/examples/device/mtp/src/mtp_fs_example.c @@ -354,8 +354,8 @@ static int32_t fs_get_device_info(tud_mtp_cb_data_t* cb_data) { mtp_container_add_cstring(io_container, DEV_INFO_VERSION); uint16_t serial_utf16[32]; - board_usb_get_serial(serial_utf16, 32); - serial_utf16[31] = 0; // ensure null termination + size_t nchars = board_usb_get_serial(serial_utf16, 32); + serial_utf16[tu_min32(nchars, 31u)] = 0; // ensure null termination mtp_container_add_string(io_container, serial_utf16); tud_mtp_data_send(io_container); |
