Forum Rule: Always post complete source code & details to reproduce any issue!
Page 20 of 20 FirstFirst ... 10 18 19 20
Results 476 to 477 of 477

Thread: Many TLAs: MTP MSC FS SD SDFat LittleFS UsbMSCFat to work with each other 8)

  1. #476
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    6,958
    Morning all. Downloaded your updated version and ran it on the TMM.

    1. No problem recognizing the hub with the SSD and thumb drive attached.
    Code:
    MTP_test
    SDIO Storage 0 254 sdio failed or missing
    SD Storage 1 10 sd1 failed or missing
    sd_addFilesystem: 0 20009140 PROGM 200032bc 20009140
    Program Storage 0 PROGM 983040 8192
    
    Initializing USB MSC drives...
    USB Drive Inserted
    UsbBase::mscBegin called 20007640 1 1
        After usbDriveBegin
    
    msc # Partition Table
    	part,boot,bgnCHS[3],type,endCHS[3],start,length
    exFAT:	1,0,0x20,0x21,0x0,0x7,0xFE,0xFF,0xFF,2048,204800000
    FAT32:	2,0,0xFE,0xFF,0xFF,0xC,0xFE,0xFF,0xFF,204802048,29634560
    pt_#0:	3,0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0,0
    pt_#0:	4,0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0,0
      Try Partiton:1 on MSC Index:0
    UsbBase::mscBegin called 20007640 0 1
        After usbDriveBegin
        ** SUCCEEDED **
    >> USB partition 1 volume ID: New Volume
    sd_addFilesystem: 1 20009208 MSC0-New Volume 200032b4 0
      Try Partiton:2 on MSC Index:1
    UsbBase::mscBegin called 20007640 0 2
        After usbDriveBegin
        ** SUCCEEDED **
    >> USB partition 2 volume ID: NEW VOLUME
    sd_addFilesystem: 2 200096c0 MSC0-NEW VOLUME 200032b4 1
      Try Partiton:3 on MSC Index:2
    UsbBase::mscBegin called 20007640 0 3
        After usbDriveBegin
      Try Partiton:4 on MSC Index:2
    UsbBase::mscBegin called 20007640 0 4
        After usbDriveBegin
    USB Drive Inserted
    UsbBase::mscBegin called 20007f40 1 1
        After usbDriveBegin
    
    msc # Partition Table
    	part,boot,bgnCHS[3],type,endCHS[3],start,length
    exFAT:	1,0,0x20,0x21,0x0,0x7,0xFE,0xFF,0xFF,2048,121145343
    pt_#0:	2,0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0,0
    pt_#0:	3,0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0,0
    pt_#0:	4,0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0,0
      Try Partiton:1 on MSC Index:2
    UsbBase::mscBegin called 20007f40 0 1
        After usbDriveBegin
        ** SUCCEEDED **
    sd_addFilesystem: 3 20009b78 MSC1-1 200032b4 2
      Try Partiton:2 on MSC Index:3
    UsbBase::mscBegin called 20007f40 0 2
        After usbDriveBegin
      Try Partiton:3 on MSC Index:3
    UsbBase::mscBegin called 20007f40 0 3
        After usbDriveBegin
      Try Partiton:4 on MSC Index:3
    UsbBase::mscBegin called 20007f40 0 4
        After usbDriveBegin
    sd_addFilesystem: 4 20004758 sdio 200032c8 0
    
    **** dir of sd[0] ****
    
    Setup done
    2. Copied the T4_1 directory to the SSD 2nd volume successfully. Output shows that it read the datetime string but modified dates don't show in WinExp for the SSD:
    Code:
    }}}}}}}}} MSCMTPCB::usedSizeCB called 200045b0 2 1
    MSCMTPCB::usedSizeCB called for Fat32
    RESP:2001(RSP:OK)l: 24 T:1a : 30001 ffffffff 6
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:1b : 6 dc02 (FORMAT)
    RESP:2001(RSP:OK)l: 20 T:1b : 6 dc02
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:1c : 6 dc01 (STORAGE_ID)
    RESP:2001(RSP:OK)l: 20 T:1c : 6 dc01
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:1d : 6 dc07 (OBJECT NAME)
    RESP:2001(RSP:OK)l: 20 T:1d : 6 dc07
    CMD: 9802(GET_OBJECT_PROP_DESC)l: 20 T:1e : dc0b 3001 (PARENT)
    RESP:2001(RSP:OK)l: 20 T:1e : dc0b 3001
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:1f : 6 dc0b (PARENT)
    RESP:2001(RSP:OK)l: 20 T:1f : 6 dc0b
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:20 : 6 dc41 (PERSISTENT_UID)
    RESP:2001(RSP:OK)l: 20 T:20 : 6 dc41
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:21 : 6 dc44 (NAME)
    RESP:2001(RSP:OK)l: 20 T:21 : 6 dc44
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:22 : 6 dc03 (PROTECTION)
    RESP:2001(RSP:OK)l: 20 T:22 : 6 dc03
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:23 : 6 dc04 (SIZE)
    RESP:2001(RSP:OK)l: 20 T:23 : 6 dc04
    CMD: 1008(GET_OBJECT_INFO)l: 16 T:24 : 6
    RESP:2001(RSP:OK)l: 16 T:24 : 6
    CMD: 1007(GET_OBJECT_HANDLES)l: 24 T:25 : 30001 0 6
    RESP:2001(RSP:OK)l: 24 T:25 : 30001 0 6
    CMD: 100c(SEND_OBJECT_INFO)l: 20 T:26 : 30001 6
    DATA:100c(SEND_OBJECT_INFO)l: 164 T:26 : 0 3000 e2e75 3000 0
    SendObjectInfo: 196609 6 20005400: 0 3000 0 e2e75 3000 0 0 0 0 0 0 0 0 0 0 : AN12253.pdf
    Read DateTime string: 20210407T081045.0
    >> date: 5287 2021 4 7
    >> time: 4156 8 10 45
    Created: 5287 4156
    Read DateTime string: 20210209T232116.0
    >> date: 5249 2021 2 9
    >> time: baa8 23 21 16
    Modified: 5249 baa8
    
    
    }}}}}}}}} MSCMTPCB::usedSizeCB called 200045b0 2 1
    MSCMTPCB::usedSizeCB called for Fat32
    RESP:2001(RSP:OK)l: 24 T:26 : 30001 6 7
    CMD: 100d(SEND_OBJECT)l: 12 T:27
    MTPD::SendObject: len:929397
     # USB Packets: 1815 total: 11 avg ms: 0 max: 1
     # Write: 114 total:76 avg ms: 0 max: 1
    >>>Total Time: 106699
    RESP:2001(RSP:OK)l: 12 T:27
    CMD: 9802(GET_OBJECT_PROP_DESC)l: 20 T:28 : dc44 3000 (NAME)
    RESP:2001(RSP:OK)l: 20 T:28 : dc44 3000
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:29 : 7 dc02 (FORMAT)
    RESP:2001(RSP:OK)l: 20 T:29 : 7 dc02
    CMD: 9802(GET_OBJECT_PROP_DESC)l: 20 T:2a : dc01 3000 (STORAGE_ID)
    RESP:2001(RSP:OK)l: 20 T:2a : dc01 3000
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:2b : 7 dc01 (STORAGE_ID)
    RESP:2001(RSP:OK)l: 20 T:2b : 7 dc01
    CMD: 9802(GET_OBJECT_PROP_DESC)l: 20 T:2c : dc07 3000 (OBJECT NAME)
    RESP:2001(RSP:OK)l: 20 T:2c : dc07 3000
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:2d : 7 dc07 (OBJECT NAME)
    RESP:2001(RSP:OK)l: 20 T:2d : 7 dc07
    CMD: 9802(GET_OBJECT_PROP_DESC)l: 20 T:2e : dc0b 3000 (PARENT)
    RESP:2001(RSP:OK)l: 20 T:2e : dc0b 3000
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:2f : 7 dc0b (PARENT)
    RESP:2001(RSP:OK)l: 20 T:2f : 7 dc0b
    CMD: 9802(GET_OBJECT_PROP_DESC)l: 20 T:30 : dc41 3000 (PERSISTENT_UID)
    RESP:2001(RSP:OK)l: 20 T:30 : dc41 3000
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:31 : 7 dc41 (PERSISTENT_UID)
    RESP:2001(RSP:OK)l: 20 T:31 : 7 dc41
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:32 : 7 dc44 (NAME)
    RESP:2001(RSP:OK)l: 20 T:32 : 7 dc44
    CMD: 9802(GET_OBJECT_PROP_DESC)l: 20 T:33 : dc03 3000 (PROTECTION)
    RESP:2001(RSP:OK)l: 20 T:33 : dc03 3000
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:34 : 7 dc03 (PROTECTION)
    RESP:2001(RSP:OK)l: 20 T:34 : 7 dc03
    CMD: 9802(GET_OBJECT_PROP_DESC)l: 20 T:35 : dc04 3000 (SIZE)
    RESP:2001(RSP:OK)l: 20 T:35 : dc04 3000
    CMD: 9803(GET_OBJECT_PROP_VALUE)l: 20 T:36 : 7 dc04 (SIZE)
    RESP:2001(RSP:OK)l: 20 T:36 : 7 dc04
    CMD: 1008(GET_OBJECT_INFO)l: 16 T:37 : 7
    RESP:2001(RSP:OK)l: 16 T:37 : 7
    CMD: 100c(SEND_OBJECT_INFO)l: 20 T:38 : 30001 6
    DATA:100c(SEND_OBJECT_INFO)l: 172 T:38 : 0 3000 11a470 3000 0
    SendObjectInfo: 196609 6 20005400: 0 3000 0 11a470 3000 0 0 0 0 0 0 0 0 0 0 : aoyue-8032a.pdf
    Read DateTime string: 20210407T081046.0
    >> date: 5287 2021 4 7
    >> time: 4157 8 10 46
    Created: 5287 4157
    Read DateTime string: 20181103T091507.0
    >> date: 4d63 2018 11 3
    >> time: 49e3 9 15 7
    Modified: 4d63 49e3
    3. Deleted the directory that was just created - turned TMM off and the back on and the directory was gone.

    Unfortunately didn't have the SD Card attached have to do that next.

  2. #477
    Senior Member wwatson's Avatar
    Join Date
    Aug 2017
    Posts
    426
    @All - I have been working on an upper level IF to @Kurte's and @mjs513's hard work on UsbMscFat.

    I wanted to:
    1) Find and initialize all available Mass Storage devices connected to the Teensy.
    2) Create an index to those devices using a logical device number and use a static index variable as the current default device which can be changed with a change drive method.
    3) Store information about the current device in a struct array to be used with other methods:
    Code:
    typedef struct {
    	char		name[32];        // Volume name as a logical drive name.
    	uint8_t		driveNumber = 0; // Physical drive number.
    	uint8_t		ldNumber = 0;    // Logical drive number.
    	bool		valid = false;   // If true device is connected and mounted.
    	uint8_t		driveType;       // USB, SDHC or SDHX
    	uint8_t		fatType = 0;     // FAT32 or ExFat
    	char            currentPath[256];    // Current default path spec.
    } deviceDecriptorEntry_t;
    4) Process relative path specs such as '../' to create an absolute path spec.
    5) Process wildcards.
    6) Process mounting and un-mounting of devices.

    So far I have change drive and change directory functions that are working with 1,2,3,4 and 5. I spent a lot of time on the Internet hunting down examples of processing wildcards and converting relative path spec to absolute path specs. There were a couple of them that I am modeling after:

    https://stackoverflow.com/questions/...lute-path-in-c
    and:
    https://github.com/sparkfun/OpenLog
    This last link has a function called 'lsPrint()' that calls 'lsPrintNext() that calls a function that processes wildcards.

    I guess what I am saying is I don't want to put a whole lot of useless effort into this if it is not something that would be useful at this time

    Here is a sample output for what I have so far:
    Code:
    mscFSTesting
    
    Waiting up to 5 seconds for a USB drives
    
    Initialize USB drive 0...
    Initialize USB drive 1...
    Initialize USB drive 2...
    Initialize SDIO SD card...
    Initialize SPI SD card...
    
    Logical Drive Information For Attached Drives
    Physical Drive #: 0 | Logical Drive #: 0 | Volume Label:  16GEXFATP1 | valid: 1 | Drive Type: USB
    Physical Drive #: 0 | Logical Drive #: 1 | Volume Label:  16GEXFATP2 | valid: 1 | Drive Type: USB
    Physical Drive #: 1 | Logical Drive #: 2 | Volume Label:   128GFAT32 | valid: 1 | Drive Type: USB
    Physical Drive #: 2 | Logical Drive #: 3 | Volume Label:    32GEXFAT | valid: 1 | Drive Type: USB
    Physical Drive #:10 | Logical Drive #: 4 | Volume Label:  32GSDEXFAT | valid: 1 | Drive Type: SDHC/SDXC
    Physical Drive #:11 | Logical Drive #: 5 | Volume Label:  TEENSY8GSD | valid: 1 | Drive Type: SDHC/SDXC
    
    Changed To Logical Drive: 2 (128GFAT32)
    parsePathSpec(const char *pathSpec) returns:
    depth = 1
    pathSpec = /
    pathOut = /
    
    Changed Logial Drive/Directory To: 128GFAT32/
    
    Directory Listing for Logical Drive 2: 128GFAT32/
    Arduino/
    A_00001.dat                                                                      32768000
    parsePathSpec(const char *pathSpec) returns:
    depth = 3
    pathSpec = /ChRt/src/teensy4/../arm
    pathOut = /ChRt/src/arm
    
    Changed Logial Drive/Directory To: 32GSDEXFAT/ChRt/src/arm
    
    Directory Listing for Logical Drive 4: 32GSDEXFAT/ChRt/src/arm/
    chcore.h                                                                         6993
    chcore_timer.h                                                                   3737
    chcore_v6m.c                                                                     5349
    chcore_v6m.h                                                                     14491
    chcore_v7m.c                                                                     6448
    chcore_v7m.h                                                                     22460
    chcoreasm_v6m.S                                                                  4908
    chcoreasm_v7m.S                                                                  5453
    chtypes.h                                                                        3208
    cmparams.h                                                                       504
    mpu.h                                                                            9587
    
    Directory Listing for Logical Drive 4: 32GSDEXFAT/ChRt/src/arm/*.h
    chcore.h                                                                         6993
    chcore_timer.h                                                                   3737
    chcore_v6m.h                                                                     14491
    chcore_v7m.h                                                                     22460
    chtypes.h                                                                        3208
    cmparams.h                                                                       504
    mpu.h                                                                            9587
    
    Directory Listing for Logical Drive 4: 32GSDEXFAT/ChRt/src/arm/*_???.*
    chcore_v6m.c                                                                     5349
    chcore_v6m.h                                                                     14491
    chcore_v7m.c                                                                     6448
    chcore_v7m.h                                                                     22460
    chcoreasm_v6m.S                                                                  4908
    chcoreasm_v7m.S                                                                  5453
    
    done...
    It's still a lot of fun playing with this stuff

Posting Permissions

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