Forum Rule: Always post complete source code & details to reproduce any issue!
Page 14 of 14 FirstFirst ... 4 12 13 14
Results 326 to 333 of 333

Thread: Teensyduino File System Integration, including MTP and MSC

  1. #326
    Senior Member wwatson's Avatar
    Join Date
    Aug 2017
    Posts
    533
    Quote Originally Posted by mjs513 View Post
    Looks like it working - have 3 drives attached - 1 has 2 partitions and all are accessible and writable:
    Attachment 26193

    Also by accident I attached a SSD by itself and it worked as well

    Only one issue I see that I guess at some point we need to talk about that came to mind. Since I couldn't tell which drive was which, is that the drive name should be updated, like before, the volume name or a way to show the partition number for the drive.

    But it does work. Had to try format out of curiousity
    Ditto with Linux except I tried QPINAND which also works:

    Click image for larger version. 

Name:	Screenshot at 2021-10-16 16-24-47.png 
Views:	7 
Size:	59.2 KB 
ID:	26198

    Good progress...

  2. #327
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    7,548
    Quote Originally Posted by wwatson View Post
    Ditto with Linux except I tried QPINAND which also works:

    Click image for larger version. 

Name:	Screenshot at 2021-10-16 16-24-47.png 
Views:	7 
Size:	59.2 KB 
ID:	26198

    Good progress...
    Since I am a glutton for punishment I modified the mtp_test sketch to add in @KurtE's code for adding USB Drives. So with the T4.1 setup that would make 12 jumps including the 3 jump drives on a hub:
    Click image for larger version. 

Name:	Capture.PNG 
Views:	6 
Size:	52.1 KB 
ID:	26199

    So yeah great progress !!!

  3. #328
    Senior Member wwatson's Avatar
    Join Date
    Aug 2017
    Posts
    533
    Quote Originally Posted by mjs513 View Post
    Since I am a glutton for punishment I modified the mtp_test sketch to add in @KurtE's code for adding USB Drives. So with the T4.1 setup that would make 12 jumps including the 3 jump drives on a hub:
    Click image for larger version. 

Name:	Capture.PNG 
Views:	6 
Size:	52.1 KB 
ID:	26199

    So yeah great progress !!!
    That's Awesome

  4. #329
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    9,560
    I just pushed up some fixes/enhancements to the MSC integration stuff.

    This includes updating the USB_MTP-logger sketch that the names of the MSC objects displayed on MTP are based off of volume label if the volume returns a label.

    Also format was implemented. I added the code from the earlier wrapper class we have to the format method (from FS). So this runs through the PFSLib formatter code.

    I tried this on one 32gb Flash drive and it appeared to work

  5. #330
    Senior Member wwatson's Avatar
    Join Date
    Aug 2017
    Posts
    533
    @KurtE - Spent the day going through all of the changes and additions to MSC. I think I am starting to understand what you are doing with it. Only needed three changes to diskIO and it still works although still using the original PFsVolume way. I see how you are using "myusb.Task();" to claim the msController devices partitions. If I understand it correctly.

    Also tested USB_MTP-logger. Worked with the volume names. In Linux I used gMTP to test formatting and that also worked. Great stuff

  6. #331
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    9,560
    Quote Originally Posted by wwatson View Post
    @KurtE - Spent the day going through all of the changes and additions to MSC. I think I am starting to understand what you are doing with it. Only needed three changes to diskIO and it still works although still using the original PFsVolume way. I see how you are using "myusb.Task();" to claim the msController devices partitions. If I understand it correctly.

    Also tested USB_MTP-logger. Worked with the volume names. In Linux I used gMTP to test formatting and that also worked. Great stuff
    Warning: As I mentioned: So far an experiment. Will see what Paul thinks and still a WIP. But I think it is coming along. Fixed a few issues running with UBUNTU today, still a few more things I was looking at.

    Looks like the Ubuntu library does not provide the Create/Modify dates on the sendObjectInfo data, so not preserving dates and times yet.
    I was also seeing that we were not showing dates and times of existing files properly. Turns out we did not fill in the ObjectInfo data with the dates, but worked on windows as windows they did a query for them. Ubuntu did not. So fixed the code to fill in the date/time strings.

    Today I also updated code to have the MSC volume object code handle the FS format code.

    Other things trying to test include things like:

    On Windows (and probably Ubuntu) when you issue a Format request, There appears to be some undescribed timeout time, That is if we do a real short format, the format comlpletes, we return everything is OK and Windows is happy and sends out a request to use for a new session... But if we go longer than the unknown timeout, we properly send back the success, but Windows does not process it. Several seconds later the progress dialog is dismissed ant it brings up an error saying format did not complete...

    Copy of files to our storage units, Can timeout and error... Not sure exactly what their formula is for timeout. Part of it is pacing I think. Sometimes the T3.x version maybe is less likely to to timeout, in that for each USB packet of 64 bytes we do a write to the storage... With the T4.x, we stuff into a buffer and try to write out in multiples of 512 bytes.. Need to figure out the sweet spot.

    MAC? Not sure how best to get any MTP to work. Is anyone trying out some of the different Add ons to allow a MAC to see an MTP drive?

    Yes using the task() one to enumerate the partitions. Could not do it on the claim call as system was not happy for me to do this until it completed the processing of message associated with the claim...

    Probably all for tonight

  7. #332
    Senior Member wwatson's Avatar
    Join Date
    Aug 2017
    Posts
    533
    Quote Originally Posted by KurtE View Post
    Warning: As I mentioned: So far an experiment. Will see what Paul thinks and still a WIP. But I think it is coming along. Fixed a few issues running with UBUNTU today, still a few more things I was looking at.

    Looks like the Ubuntu library does not provide the Create/Modify dates on the sendObjectInfo data, so not preserving dates and times yet.
    I was also seeing that we were not showing dates and times of existing files properly. Turns out we did not fill in the ObjectInfo data with the dates, but worked on windows as windows they did a query for them. Ubuntu did not. So fixed the code to fill in the date/time strings.

    Today I also updated code to have the MSC volume object code handle the FS format code.

    Other things trying to test include things like:

    On Windows (and probably Ubuntu) when you issue a Format request, There appears to be some undescribed timeout time, That is if we do a real short format, the format comlpletes, we return everything is OK and Windows is happy and sends out a request to use for a new session... But if we go longer than the unknown timeout, we properly send back the success, but Windows does not process it. Several seconds later the progress dialog is dismissed ant it brings up an error saying format did not complete...

    Copy of files to our storage units, Can timeout and error... Not sure exactly what their formula is for timeout. Part of it is pacing I think. Sometimes the T3.x version maybe is less likely to to timeout, in that for each USB packet of 64 bytes we do a write to the storage... With the T4.x, we stuff into a buffer and try to write out in multiples of 512 bytes.. Need to figure out the sweet spot.

    MAC? Not sure how best to get any MTP to work. Is anyone trying out some of the different Add ons to allow a MAC to see an MTP drive?

    Yes using the task() one to enumerate the partitions. Could not do it on the claim call as system was not happy for me to do this until it completed the processing of message associated with the claim...

    Probably all for tonight
    Me to. Work tomorrow. I have seen the same thing with:
    Code:
    Looks like the Ubuntu library does not provide the Create/Modify dates on the sendObjectInfo data, so not preserving dates and times yet. 
    I was also seeing that we were not showing dates and times of existing files properly.  Turns out we did not fill in the ObjectInfo data with the dates, but worked on windows as windows they did a query for them.  Ubuntu did not.  So fixed the code to fill in the date/time strings.
    Linux seems a little feeble with MTP but it is getting closer. I can copy files from a Ubuntu drive to an MTP drive and the reverse but copying a file from between two MTP drives always fails. I think the transfer rates might have something to do with it. Not sure why but I can never get past maybe one 1MBps with MTP. But I know regular transfers can be between 9 to 10 MBps with without MTP and it depends greatly on the two devices used. Usually SDIO cards are so much faster. It's progress

  8. #333
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    9,560
    Quote Originally Posted by wwatson View Post
    Me to. Work tomorrow. I have seen the same thing with:
    Code:
    Looks like the Ubuntu library does not provide the Create/Modify dates on the sendObjectInfo data, so not preserving dates and times yet. 
    I was also seeing that we were not showing dates and times of existing files properly.  Turns out we did not fill in the ObjectInfo data with the dates, but worked on windows as windows they did a query for them.  Ubuntu did not.  So fixed the code to fill in the date/time strings.
    Linux seems a little feeble with MTP but it is getting closer. I can copy files from a Ubuntu drive to an MTP drive and the reverse but copying a file from between two MTP drives always fails. I think the transfer rates might have something to do with it. Not sure why but I can never get past maybe one 1MBps with MTP. But I know regular transfers can be between 9 to 10 MBps with without MTP and it depends greatly on the two devices used. Usually SDIO cards are so much faster. It's progress
    Yes the Linux side is getting better, especially after Paul pointed the USB Interface data to the string MTP...

    Pushed up another change, to the date time stuff for Ubuntu. Not ideal, but not sure what else to do.
    That is when MTP sends us the object. On windows the Created and Modified string areas are filled in with the dates for the file being sent to you... On Ubuntu this value is empty. so added code to detect dates of 0 and not update the file object being created. So it should have the current time. This appeared to work for LittleFS, not sure yet of SD. It worked for Create Directory but not sure for sending a file... Will investigate more.

    Right now Debugging and probably coding around how long do we have to respond back to windows when we receive an Format request, before windows gives up and gives us a Format did not complete and leaves the whole interface non-functional.

    So did a quick and dirty sketch with real simple FS:
    Code:
    class FormatFS : public FS
      {
      public:
        FormatFS(uint32_t to) : format_to_(to) {}
        File open(const char *filename, uint8_t mode = FILE_READ) { return f;}
        bool exists(const char *filepath) {return false;}
        bool mkdir(const char *filepath) { return false;}
        bool rename(const char *oldfilepath, const char *newfilepath) { return false;}
        bool remove(const char *filepath) { return false; }
        bool rmdir(const char *filepath) { return false; }
        uint64_t usedSize() { return 0; }
        uint64_t totalSize() { return 1000000l; }
        bool format(int type = 0, char progressChar = 0, Print& pr = Serial) {
          delay(format_to_);
          return true;
        }
      private:
        uint32_t format_to_;
        File f;
      };
    So I added Several of these FS's
    Code:
    FormatFS ffs10(1000);
    FormatFS ffs20(2000);
    FormatFS ffs25(2500);
    FormatFS ffs30(3000);
    FormatFS ffs31(3100);
    FormatFS ffs35(3500);
    FormatFS ffs50(5000);
    Appears to work for 3 seconds but times out by 3.1 seconds. On Mine (and @mjs513) Windows 10 machines.
    So will put in a code to try to avoid this.

    Then need to work on the file transfer. I have had better luck with T3.6 which simply writes each buffer as it receives it (First 54 bytes, followed by full 64 byte writes, then however many left at end...)
    The T4.x code tries to buffer all of these into something like an 8KB buffer, and do full writes.... The problem with LittleFS (if it has to erase a cluster) and some others is sometimes these writes can take a long time, And then we get the timeout. I played around earlier with having interval timer try to slowly read ahead until the previous write completes. But it also was finacky.

    Paul and others:
    Also at times wonder if the FS Object should have some method to return something like: Preferred Read/Write sizes... Not sure if this would be two parts, like sector size, and cluster size?

    Also side question to self and others. Wonder if MTP code knows what is on the other side... Am I talking to windows, or ubuntu...
    So far the host side is in control, and first message, is an Open Session message, which only thing provided to us is a session id...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •