MPT reset

I the documentation I've read it said it needs to be run when there is a change to the file or when the file is closed? Is this wrong? And what does it do anyway?
 
I haven't used, but it sounds like it would be useful to run it when you want to be sure that the host is seeing the latest data. For example, let's say you write a file to SD on the Teensy, from what you're saying it sounds like calling MTP.reset() might somehow trigger the host to update to display the latest data. I will try it soon and let you now what I find.
 
I use MTP.reset() when informing PC to reset the MTP connection. This is useful when Teensy is writing to disk while connected to PC, as PC will not be aware of new files and will never enquire.
There are multiple ways of informing PC that Teensy files have changed.
-MTP.reset() which original is resetDeviceEvent
-restart USB
- send other events
All events( like resetDeviceEvent, addObjectEvent) require the PC (MTP initiator) to handle this event. However, there seems to be no easy way to interrogate the PC which events it handles.
 
Following up on this, I added the function call below to my T4.1 code after closing an SD file. This makes the file "visible" to Windows Explorer (after I press F5).

Code:
          MTP.send_DeviceResetEvent();    // send reset event to PC for refresh
 
Thanks Joe!
What is the MTP function to list files to my serial output? I previously used
Serial1.println(F("\nList of files on the SD."));
sd.ls(&Serial1, "/", LS_R);
Serial1.println(F(""));

But that doesn't work any longer with Paul's version I guess?
 
I asked ChatGPT and it seems that this works - SD.sdfs.ls(&Serial1, "/", LS_R);
Is there a reference to MTP somewhere that has this kind of info?
 
Back
Top