Skip to content

Commit 0a3bf40

Browse files
andrewleechclaude
andcommitted
usb-device-mtp: Improve string handling and add conditional debug logging
- Add helper method _write_mtp_string for consistent UTF-16 string formatting - Add debug flag to enable/disable verbose logging (default: off) - Convert print statements to use the new _log helper method - Improve large file transfer handling with better buffer management - Add progress reporting for large file transfers - Update example to demonstrate debug flag usage 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 4ba8b1d commit 0a3bf40

File tree

2 files changed

+196
-153
lines changed

2 files changed

+196
-153
lines changed

micropython/usb/examples/device/mtp_example.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424
import time
2525

2626
# Create an MTP interface that exposes the root directory
27-
mtp = MTPInterface(storage_path="/")
27+
# Set debug=True to enable detailed logging
28+
mtp = MTPInterface(storage_path="/", debug=True)
2829

2930
# Initialize the USB device with the MTP interface
3031
# Keep builtin_driver=True to maintain the serial REPL alongside MTP

0 commit comments

Comments
 (0)