MTP sketch won't compile following SDfat update.

Status
Not open for further replies.
Ok - I am able to delete files but seems like I can not copy files on the T3.6. That issue needs to be addressed by @WMXZ - it sounds like a problem with lib but I don't know where.
 
Ok - I am able to delete files but seems like I can not copy files on the T3.6. That issue needs to be addressed by @WMXZ - it sounds like a problem with lib but I don't know where.

Does the same operation work on T4? (Have not used T3.6 for a while)
what exactly do you mean by copy: PC to T3.6, T3.6 to PC, T3.6 to T3.6 same directory level, different directory level?
file size?
what are symptoms of "I can not copy"?
 
I don't have a T4.x but I have 140 customers who need this to work on their 3.6s. Comments therefore relate to 3.6
mtp-test.ino appears to let me delete the test1.txt file it creates (click on file, press Delete, confirmation message, file removed from explorer window) But with the section of code that creates this file commented out, rebooting the Teensy and the file is still there, so it hasn't really been deleted.
I can copy a file or folder from T3/6 to Windows.
I can't create a folder in the T3.6 from Windows. (Right click - New Folder gives error Error creating Folder...device has stopped responding or has been disconnected.)
I can't copy or move a file or folder from Windows to T3.6. No error - just bingbingbing sound. Then no more files can be read until rebooting Teensy. If I try to read a file I get the error 0x8007000D: The data is invalid. All folders now appear empty until reboot.
 
Sorry I know I am late to the party.

I am mostly working with T4.x with MTP, and have lots of changes going on, which may or may not make it into the system.

So again what version of things are you running?
Windows 10? Arduino version? Teensyduino version?

Test1? is this on the ram drive? Not sure where it would get any files if you removed this code. The ram should have been clear...

What are you needing to work for drives? Ram Drive? SD? LittleFS on external memory? ...

Again I will try to take a look soon, at least with my latest stuff (not up on web)... To first see if it builds or not... And some rudimentary tests.

Kurt
 
1.8.13 and 1.54-beta7 and Windows 64bit 10 Pro

Using the sketch from Post #20.

I comment out this, which I believe should stop it recreating test1.txt after I've attempted to delete it from Windows:

if(sdx[0].exists(str)) sdx[0].remove(str);
File file=sdx[0].open(str,FILE_WRITE_BEGIN);
file.println("This is a test line");
file.close();

But after re-booting, the file is still there so presumably it never got deleted.

I only need to read and write to/from onboard SD drive, no interest in RAM etc.

Thanks
 
@sw_hunt
I hooked up a T3.6 and run mtp_test, deleted test1.txt using MTP, removed uSD and checked on PC. File is still there. I will investigate.
 
I did some correction and updated https://github.com/WMXZ-EU/MTP_t4/
For @KurtE et al that have WIP forks, this is the new code
Code:
void MTPStorage_SD::removeFile(uint32_t store, char *file)
{ 
  char tname[MAX_FILENAME_LEN];
  File f1=sd_open(store,file,0);
[B]  if(f1.isDirectory())
  {
[/B]    File f2;
    while(f2=f1.openNextFile())
    { sprintf(tname,"%s/%s",file,f2.name());
      if(f2.isDirectory()) removeFile(store,tname); else sd_remove(store,tname);
    }
    sd_rmdir(store,file);
[B]  }
  else
  {
    sd_remove(store,file);
  }
[/B]}

highlighted inserted lines. not sure why this was not detected before.
tested on T3.6 and T4.1
 
Last edited:
I did some correction and updated https://github.com/WMXZ-EU/MTP_t4/
For @KurtE et al that have WIP forks, this is the new code
Code:
void MTPStorage_SD::removeFile(uint32_t store, char *file)
{ 
  char tname[MAX_FILENAME_LEN];
  File f1=sd_open(store,file,0);
[B]  if(f1.isDirectory())
  {
[/B]    File f2;
    while(f2=f1.openNextFile())
    { sprintf(tname,"%s/%s",file,f2.name());
      if(f2.isDirectory()) removeFile(store,tname); else sd_remove(store,tname);
    }
    sd_rmdir(store,file);
[B]  }
  else
  {
    sd_remove(store,file);
  }
[/B]}

highlighted inserted lines. not sure why this was not detected before.
tested on T3.6 and T4.1
@WMXZ Looks like the same code that is in my current branch... Sort of sounded familiar, looking at my current branch which is now something like:
43 changes ahead and 6 behind: looks like I fixed it two months ago, in my MSC integration branch (test_msc_parts).
https://github.com/KurtE/MTP_t4/com...697a04e2b9904ea4b042a89af59dc93ec1f5d44848a26

At some point will be good to integrate everything back to one version...
 
Status
Not open for further replies.
Back
Top