Teensyduino File System Integration, including MTP and MSC

@mjs513 - Looks like you are having too much fun :D

@Paul - All - I just pushed up the T3.x MTP+Serial USB Descriptor update to usb_desc.c (from MTP_T4)
It appears to work on Windows and Mac (Using Android...) Same issue as t4.x on Ubuntu. Sometimes does not come up, sometimes comes up with Shotwell with camera icon
guessing this maybe working as PTP?
And again if I run I believe the command is mtp-detect it shows it as valid (At least T4 one did)

Again MTP+Serial (if adopted) should have it's own PID?

On T3.x - have not put anything in to detect good time to start processing initial mtp messages. T3.x code is different than T4, where you don't have method to say on this end point do a callback...
Instead it looks like hard coded into usb.c that all special code is there under #ifdef by mtp type... There are a couple of messages processed there (which you added to t4), wonder if we receive the device status message and if
so, good place to add callback to mtp code to say start up interval timer now...

Back to playing
 
Just pushed up updated picture viewer... So far only in quick start branch...

Now options read in include center which will center jpegs or png files... Have not done that with bmp yet...
Also fixed some of the clipping rectangle code... Would be better to just have proper clipping in the Ili9341_t3 library, but...

Also allowed the ini file to set the speed of switching pictures...

Again just having some fun.
 
Nice to see there is fun to be had - and that Kurt and Mike are enjoying it. Will be a more real-world use case, or at least fun for running continuous tests.

Verify for Makefiles.ino got a correction finally when found time before Zzzz's ... Discovered verifying file content requires remembering how the file was written :(

Will hopefully post soon - want to sprint() all DIR SPEW to buffer and only show the .entry when there is an error detected so good media test is easy to read and errors when found jump out. Since it evolved from DirPrint it is noisy showing each and every file/dir.
 
Yep having fun, changed the breaking points for x and y for switching jpeg from 1/1 to half to quarter to eighth scaling and then allowed the .ini file to set any of them...

Probably enough bell and whistle for jpg...
 
Well intermittent fun here has a nearly working Verify in makefiles and just added a Menu.
Code:
Menu Options:
	t - Test Files Small
	v - Verify Files
	l - List files on disk

	R - Restart Teensy

So of course then back to moving files around - with unGood results:
poolEmpty.png
That was from copy of work files from SD using Teensy MTP onto a PC folder to compare.
It died partway through and shows 63KB of file data substituted for various other files and lots of others. Here's the top screen of code compare.
Note: the folder under "This PC\Teensy\MakeFiles 2204\TESTerr\D0.28" has expected and created known errors I made for testing, the rest shown are from copy errors MTP>PC so far.
Fail1Compare.jpg

Brought the SD card to PC to get the actual files to compare and put the faulty folder on the SD

Bringing up the SD card on MTP Teensy a verify shows this - still some presentation hitches perhaps - and not 1 to one verified it caught everything.
But have not found a way to export a printed LIST from CodeCompare and this sort of looks like one from TyComm:
Code:
D0.20 /                                                                                                                                                                    
DONE RESULTS GOOD HERE 20 Files(s)	 with 20 files of Size 81920 Bytes	#2
        
D0.40 /                                                                                                                                                                                                                                                                                                                                    
DONE RESULTS GOOD HERE 40 Files(s)	 with 40 files of Size 4997120 Bytes	#2
        
D0.60 /                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    
DONE RESULTS GOOD HERE 60 Files(s)	 with 60 files of Size 3870720 Bytes	#2
        
D0.30 /                                                                                                                                                                                                                                                    
DONE RESULTS GOOD HERE 30 Files(s)	 with 30 files of Size 952320 Bytes	#2
        
ManyD10 /no count DIR
        
D0.5 /                                                
DONE RESULTS GOOD HERE 5 Files(s)	 with 5 files of Size 7620 Bytes	#1

D1.5 /                                                
DONE RESULTS GOOD HERE 5 Files(s)	 with 5 files of Size 7620 Bytes	#1

D2.5 /                                                
DONE RESULTS GOOD HERE 5 Files(s)	 with 5 files of Size 7620 Bytes	#1

D3.5 /                                                
DONE RESULTS GOOD HERE 5 Files(s)	 with 5 files of Size 7620 Bytes	#1

D4.5 /                                                
DONE RESULTS GOOD HERE 5 Files(s)	 with 5 files of Size 7620 Bytes	#1

D5.5 /                                                
DONE RESULTS GOOD HERE 5 Files(s)	 with 5 files of Size 7620 Bytes	#1

D6.5 /                                                
DONE RESULTS GOOD HERE 5 Files(s)	 with 5 files of Size 7620 Bytes	#1

D7.5 /                                                
DONE RESULTS GOOD HERE 5 Files(s)	 with 5 files of Size 7620 Bytes	#1

D8.5 /                                                
DONE RESULTS GOOD HERE 5 Files(s)	 with 5 files of Size 7620 Bytes	#1

D9.5 /                                            
DONE RESULTS GOOD HERE 5 Files(s)	 with 5 files of Size 7620 Bytes	#2
                                                
TEST /no count DIR
        
D0.28 /                                                                                                                                                                                                                                    
DONE RESULTS GOOD HERE 28 Files(s)	 with 28 files of Size 14238 Bytes	#2
            
D0.28 /                                                                                                                                                                                                                                    
DONE RESULTS GOOD HERE 28 Files(s)	 with 28 files of Size 14238 Bytes	#2
        
D0.25 /                                                                                                                                                                                                            
DONE RESULTS GOOD HERE 25 Files(s)	 with 25 files of Size 12800 Bytes	#2
        
Huge /no count DIR
        
D0.10 /                                                                                    
DONE RESULTS GOOD HERE 10 Files(s)	 with 10 files of Size 4000000 Bytes	#2
            FILE    mtpindex.dat

°mtpindex.dat        
TESTerr /no count DIR
        
D0.28 /                
496.txt	XXXX	 File Size MISMATCH 495:                
498.txt	XXXX	 File Size MISMATCH 499:                                                                                        
Ver Fi:509.txt 509zD. 215x  9846E_zD. 215x  9846F~***********TEST/D0.28/508.txt  fid=215 bid=9846e N=508.txt| zD. 215x  9846F~***********TEST/D0.28/508.txt
XXXX2	 In file Name MISMATCH Size : 508                                                                                                    
	  DONE RESULTS BAD HERE  	XXX 'b XX	  2 EXTRA FILE(S)  
 3 File Error(s)  
	 with 30 files of Size 13716 Bytes	#2
            
System Volume Information /no count DIR
        FILE    WPSettings.dat

°WPSettings.dat        FILE    IndexerVolumeGuid

°IndexerVolumeGuid            
Jan22 /no count DIR
        
D0.20 /        
4096_1.txt	XXXX	 File Size MISMATCH 64512:        
4096_10.txt	XXXX	 File Size MISMATCH 64512:        
4096_11.txt	XXXX	 File Size MISMATCH 64512:        
4096_12.txt	XXXX	 File Size MISMATCH 64512:        
4096_13.txt	XXXX	 File Size MISMATCH 64512:        
4096_14.txt	XXXX	 File Size MISMATCH 64512:        
4096_15.txt	XXXX	 File Size MISMATCH 64512:        
4096_16.txt	XXXX	 File Size MISMATCH 64512:        
4096_17.txt	XXXX	 File Size MISMATCH 64512:        
4096_18.txt	XXXX	 File Size MISMATCH 64512:        
4096_19.txt	XXXX	 File Size MISMATCH 64512:        
4096_2.txt	XXXX	 File Size MISMATCH 64512:        
4096_20.txt	XXXX	 File Size MISMATCH 64512:        
4096_3.txt	XXXX	 File Size MISMATCH 64512:        
4096_4.txt	XXXX	 File Size MISMATCH 64512:        
4096_5.txt	XXXX	 File Size MISMATCH 64512:        
4096_6.txt	XXXX	 File Size MISMATCH 64512:        
4096_7.txt	XXXX	 File Size MISMATCH 64512:        
4096_8.txt	XXXX	 File Size MISMATCH 64512:        
4096_9.txt	XXXX	 File Size MISMATCH 64512:            
D0.25 /        
500.txt	XXXX	 File Size MISMATCH 64512:        
501.txt	XXXX	 File Size MISMATCH 64512:        
502.txt	XXXX	 File Size MISMATCH 64512:        
503.txt	XXXX	 File Size MISMATCH 64512:        
504.txt	XXXX	 File Size MISMATCH 64512:        
505.txt	XXXX	 File Size MISMATCH 64512:            
Huge /no count DIR
        
D0.10 /                                                                                    
DONE RESULTS GOOD HERE 10 Files(s)	 with 10 files of Size 4000000 Bytes	#2
            
ManyD10 /no count DIR
        
D0.5 /                                                
DONE RESULTS GOOD HERE 5 Files(s)	 with 5 files of Size 7620 Bytes	#1

D1.5 /                                                
DONE RESULTS GOOD HERE 5 Files(s)	 with 5 files of Size 7620 Bytes	#1

D2.5 /                                                
DONE RESULTS GOOD HERE 5 Files(s)	 with 5 files of Size 7620 Bytes	#1

D3.5 /                                                
DONE RESULTS GOOD HERE 5 Files(s)	 with 5 files of Size 7620 Bytes	#1

D4.5 /                                                
DONE RESULTS GOOD HERE 5 Files(s)	 with 5 files of Size 7620 Bytes	#1

D5.5 /                                                
DONE RESULTS GOOD HERE 5 Files(s)	 with 5 files of Size 7620 Bytes	#1

D6.5 /                                
2548.txt	XXXX	 File Size MISMATCH 510:                
	DONE RESULTS BAD HERE  	XXX 'a XX	 1 File Error(s)  
	 with 5 files of Size 5582 Bytes	#1

D7.5 /        
1012.txt	XXXX	 File Size MISMATCH 513:        
1524.txt	XXXX	 File Size MISMATCH 514:        
2036.txt	XXXX	 File Size MISMATCH 515:        
2548.txt	XXXX	 File Size MISMATCH 516:        
500.txt	XXXX	 File Size MISMATCH 512:        
D8.5 /        
1012.txt	XXXX	 File Size MISMATCH 519:        
1524.txt	XXXX	 File Size MISMATCH 520:        
2036.txt	XXXX	 File Size MISMATCH 521:        
2548.txt	XXXX	 File Size MISMATCH 4096:        
500.txt	XXXX	 File Size MISMATCH 518:        
D9.5 /        
1012.txt	XXXX	 File Size MISMATCH 4096:        
1524.txt	XXXX	 File Size MISMATCH 4096:        
2036.txt	XXXX	 File Size MISMATCH 4096:        
2548.txt	XXXX	 File Size MISMATCH 4096:        
500.txt	XXXX	 File Size MISMATCH 4096:                                                    
TEST /no count DIR
        
D0.28 /        
495.txt	XXXX	 File Size MISMATCH 4096:        
496.txt	XXXX	 File Size MISMATCH 4096:        
497.txt	XXXX	 File Size MISMATCH 4096:        
498.txt	XXXX	 File Size MISMATCH 4096:        
499.txt	XXXX	 File Size MISMATCH 4096:        
500.txt	XXXX	 File Size MISMATCH 4096:        
501.txt	XXXX	 File Size MISMATCH 4096:        
502.txt	XXXX	 File Size MISMATCH 4096:        
503.txt	XXXX	 File Size MISMATCH 4096:        
504.txt	XXXX	 File Size MISMATCH 4096:        
505.txt	XXXX	 File Size MISMATCH 4096:        
506.txt	XXXX	 File Size MISMATCH 4096:        
507.txt	XXXX	 File Size MISMATCH 500:        
508.txt	XXXX	 File Size MISMATCH 501:        
509.txt	XXXX	 File Size MISMATCH 502:        
510.txt	XXXX	 File Size MISMATCH 503:        
511.txt	XXXX	 File Size MISMATCH 504:        
512.txt	XXXX	 File Size MISMATCH 505:        
513.txt	XXXX	 File Size MISMATCH 506:        
514.txt	XXXX	 File Size MISMATCH 507:        
515.txt	XXXX	 File Size MISMATCH 508:        
516.txt	XXXX	 File Size MISMATCH 509:        
517.txt	XXXX	 File Size MISMATCH 510:        
518.txt	XXXX	 File Size MISMATCH 511:        
519.txt	XXXX	 File Size MISMATCH 512:        
520.txt	XXXX	 File Size MISMATCH 513:        
521.txt	XXXX	 File Size MISMATCH 514:        
522.txt	XXXX	 File Size MISMATCH 515:                
TESTerr /no count DIR
        
D0.28 /        
495.txt	XXXX	 File Size MISMATCH 517:        
496.txt	XXXX	 File Size MISMATCH 518:        
497.txt	XXXX	 File Size MISMATCH 519:        
498.txt	XXXX	 File Size MISMATCH 520:        
499.txt	XXXX	 File Size MISMATCH 521:        
500.txt	XXXX	 File Size MISMATCH 522:        
501.txt	XXXX	 File Size MISMATCH 523:        
502.txt	XXXX	 File Size MISMATCH 524:        
503.txt	XXXX	 File Size MISMATCH 495:        
504.txt	XXXX	 File Size MISMATCH 496:        
505.txt	XXXX	 File Size MISMATCH 497:        
506.txt	XXXX	 File Size MISMATCH 498:        
507.txt	XXXX	 File Size MISMATCH 499:        
508.txt	XXXX	 File Size MISMATCH 500:        
509.txt	XXXX	 File Size MISMATCH 501:        
510.txt	XXXX	 File Size MISMATCH 64512:        
511.txt	XXXX	 File Size MISMATCH 64512:        
512.txt	XXXX	 File Size MISMATCH 64512:        
513.txt	XXXX	 File Size MISMATCH 64512:        
514.txt	XXXX	 File Size MISMATCH 64512:        
515.txt	XXXX	 File Size MISMATCH 64512:        
516.txt	XXXX	 File Size MISMATCH 64512:        
517.txt	XXXX	 File Size MISMATCH 64512:        
518.txt	XXXX	 File Size MISMATCH 64512:        
519.txt	XXXX	 File Size MISMATCH 64512:        
520.txt	XXXX	 File Size MISMATCH 64512:        
521.txt	XXXX	 File Size MISMATCH 64512:                
Total 465 files of Size 20630264 Bytes
Bytes Used: 26099712, Bytes Total:31889817600

One other NOTE: Since switching to MTP+Serial the Teensy no longer 'AutoPlay' opens the folder? Not sure if that is due to the change or other. But AutoPlay settings has three "Teensy' entries all marked: Open folder to view

Updated github for 2204: Defragster/T4LockBeta/tree/main/MakeFiles
> the Block count is now 7 HEX chars so it won't digest prior files that allowed for only 5.
> though not sure it can count nearly that high and work ... 4GB total. Some smaller LARGE files test gave a fail it seemed.
> Check the Menu it can have entries for various file sets with edited entries to pass diff values for 'ii' here: void makeSome( int ii )

<edit> I hadn't gotten to looking at the failed CodeCompare file content - here is one example showing this file partial path ".5/D8.5/D9.5/500.txt" is number 196 in creation order.
It should be a 500 byte file but instead it was replaced by file #3 from "/D0.20/4096_3.txt" which is a 4096 byte file.
> Note when the file Size was checked and seen not to match the files name - it was not sent for further verification that would have shown the error in the file number - and the block ID HEX values, or the end string.
Fail1Comp_Not500.png

<edit2>: Turing on File Preview Pane and going to: This PC\Teensy\MakeFiles 2204\ManyD10\D0.5\D1.5\D2.5\D3.5\D4.5\D5.5\D6.5\D7.5\D8.5\D9.5
Shows this accurate single read of file above that was corrupted on copy:
NoFail1Comp_500view.png
This directory shows lower middle of image #2 above and all files in this D9.5 folder were copied at 4096 bytes instead of the sizes shown in the file name.
 
Last edited:
Been having some fun last couple of days playing with scaling for PNG images. Finally got it working this morning. Code is currently an absolute mess and needs alot of clean up but it is working.

@defragster -- glad you are having some fun and making progress :).
 
Been having some fun last couple of days playing with scaling for PNG images. Finally got it working this morning. Code is currently an absolute mess and needs alot of clean up but it is working.

@defragster -- glad you are having some fun and making progress :).
:D :D

Could not resist, so did some minor massaging of png scale code and then merged it into the MTP_ILI9341_picture_view sketch ;)
Sorry could not resist.

The start of the sketch shows all of the key/values that might be in ini file
Code:
----------------------------------
Sketch uses Option file: PictureViewOptions.ini at the root of SD Card
	<All key names>=<current key value
	debug=0
	Step=1
	JPGScale=0
	PNGScale=0
	ScaleXAbove2=480
	ScaleXAbove4=960
	ScaleXAbove8=1920
	ScaleXAbove16=3840
	ScaleYAbove2=360
	ScaleYAbove4=720
	ScaleYAbove8=1440
	ScaleYAbove16=2880
	Center=1
	ImageTimeMS=2000
----------------------------------

Also added single picture step mode...
 
:D :D

Could not resist, so did some minor massaging of png scale code and then merged it into the MTP_ILI9341_picture_view sketch ;)
Sorry could not resist.

The start of the sketch shows all of the key/values that might be in ini file
...

Also added single picture step mode...

Just downloaded the updates and added a few more images and the ini file as the sketch was running. The ini was picked up as soon as it finished writing and images updated as well. :) Nice job on the changes - this is going to be a great example - probably will play more and try on a flash chip or jump drive :)
 
Been having some fun last couple of days playing with scaling for PNG images. Finally got it working this morning. Code is currently an absolute mess and needs alot of clean up but it is working.

@defragster -- glad you are having some fun and making progress :).

Progress is slow - distractions are MANY ... half a pickup of stone to unload before dark and juggling computers again for completion to return ...

Will start with testing smaller file set and confirm Verify code working. Count named dirs are cool, need to make sure recursion paths also pick up the size named files in all cases so single files in any dir are known to be tested. Then try to find unique smaller cases that might show where errors show up.

Question: Is there a way Teensy Code can get notified of changes from MTP Host? Not sure that is best though ... seeing that Kurt is checking 'index' file for change to know when it was updated. For now, best to manually run SerMon Verify after MTP changes to avoid Teensy Verify DURING ongoing changes.
 
Minor update to Defragster/T4LockBeta/tree/main/MakeFiles

Cleaned the SD drive and put into T_4.1 and ran that Makefiles.ino menu / 't'
Did a 'v'erfiy and all was well.

On PC pulled off the files to an empty folder '2204'

Put card back into T_4.1 and using Explorer MTP copied the folders off 'One at a time' to the PC into a folder 'jan24'

All of them came over except the one file in HUGE was missing a 512 byte chunk from the middle.
Code:
 Directory of D:\tmp\2204\Jan24\Huge\D0.10

01/24/2022  01:25 AM    <DIR>          .
01/24/2022  01:25 AM    <DIR>          ..
01/24/2022  01:23 AM           400,000 400000_282.txt
01/24/2022  01:23 AM           400,000 400000_283.txt
01/24/2022  01:23 AM           400,000 400000_284.txt
01/24/2022  01:23 AM           400,000 400000_285.txt
01/24/2022  01:23 AM           400,000 400000_286.txt
01/24/2022  01:23 AM           400,000 400000_287.txt
01/24/2022  01:23 AM           400,000 400000_288.txt
[B]01/24/2022  01:23 AM           [COLOR="#FF0000"]399,488[/COLOR] 400000_289.txt[/B]
01/24/2022  01:23 AM           400,000 400000_290.txt
01/24/2022  01:23 AM           400,000 400000_291.txt

This was shown with CodeCompare of folders '2204' 'jan24'

A ZIP of '2204' is now 1.86 MB with added changing data it doesn't compress like before when blocks were just repeat text.

Did not try a fresh start with that folder alone.
Did not try an all in one copy of all folders as this was the closest to a quick simpler case
 
@defagster - we will have to take a look soon. Right now just taking it easy...

@all - @mjs513 and myself have been playing some more with the image viewer ;) I renamed it and removed the name ILI9341 as we have it also working on ILI9488.
Also reworked the bitmap viewer to use the image scaling code we mentioned in code for PNG so can now scale down images, plus center and clip them.
Also allowed the .ini file to specify a background color to use...

Now off to do some other less fun stuff
 
Minor update to Defragster/T4LockBeta/tree/main/MakeFiles
> output is readably clean and seems to check all files in any folder ... if the name is 'coded' as SIZE???.???
> Files not in a dir named with expected count (i.e. D0.20) show after "°FILE"

GOOD NOTE: Two COPIES "2204 Files from PC to MTP::T_4.1:SD" NO Verify Errors!
Blank SD
> START : Copy of current 2204 folders pulled from SD to PC
-> Copy PC folder SD2204 to MTP::T_4.1 as SD2204
-> Copy PC folder SD2204 Content folders to MTP::T_4.1 to ROOT
Verify of all files GOOD
Code:
Total 574 files of Size 28035124 Bytes
Bytes Used: 34127872, Bytes Total:31889817600

Problem seems copy MTP:Teensy to PC
Repeating prior P#1105 'Copy All at once MTP::T_4.1 to PC' does not always give same set of files copied - but it does fail with same message in Windows.
>> Would be interesting perhaps to see if that process works Right, or the same, on Linux?

Below is good output - here is what shows when the file has a {Manually Created} block with wrong File ID#, and also the file name in the file suggests the wrong number of bytes, maybe not pretty (and #files breaks on errors) but if the file is corrupt it will show:
Code:
X_fid:zE. [B][COLOR="#FF0000"]293[/COLOR][/B]x  D5CC5_@399968
Ver Fi:400000_[B][COLOR="#FF0000"]291[/COLOR][/B].txt 400000
X_fid:zE. 293x  D5CC5_@399968zE. 293x  D5CC5_*******Huge/D0.10/400001_291.txt  fid=291 bid=d5cc5 N=400001_291.txt| *******Huge/D0.10/[B][COLOR="#FF0000"]400001[/COLOR][/B]_291.txt
XXXX2	 In file Name MISMATCH Size : [B][COLOR="#FF0000"]400001[/COLOR][/B]
°FILE: 400000_291.txt sz=400000    	  12 File(s) tested GOOD HERE	 with 12 files of Size 4000000 Bytes	#2
> Note: to test more of the file content in each block it checks all 8 bytes of "zE. 293x" not just the 4 bytes of FileID # " 293" against the first block content.
> Also note: when file size on Media doesn't match that in 'fileName' - it doesn't bother checking file content.

This is a good Verify for created SD2204 files:
Code:
D0.20 /                                                                                                                                                                    
DONE RESULTS GOOD HERE 20 Files(s)	 with 20 files of Size 81920 Bytes	#2
        
D0.40 /                                                                                                                                                                                                                                                                                                                                    
DONE RESULTS GOOD HERE 40 Files(s)	 with 40 files of Size 4997120 Bytes	#2
        
D0.60 /                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    
DONE RESULTS GOOD HERE 60 Files(s)	 with 60 files of Size 3870720 Bytes	#2
        
D0.30 /                                                                                                                                                                                                                                                    
DONE RESULTS GOOD HERE 30 Files(s)	 with 30 files of Size 952320 Bytes	#2
        
ManyD10 /no count DIR
        
D0.5 /                                                
DONE RESULTS GOOD HERE 5 Files(s)	 with 5 files of Size 7620 Bytes	#1

D1.5 /                                                
DONE RESULTS GOOD HERE 5 Files(s)	 with 5 files of Size 7620 Bytes	#1

D2.5 /                                                
DONE RESULTS GOOD HERE 5 Files(s)	 with 5 files of Size 7620 Bytes	#1

D3.5 /                                                
DONE RESULTS GOOD HERE 5 Files(s)	 with 5 files of Size 7620 Bytes	#1

D4.5 /                                                
DONE RESULTS GOOD HERE 5 Files(s)	 with 5 files of Size 7620 Bytes	#1

D5.5 /                                                
DONE RESULTS GOOD HERE 5 Files(s)	 with 5 files of Size 7620 Bytes	#1

D6.5 /                                                
DONE RESULTS GOOD HERE 5 Files(s)	 with 5 files of Size 7620 Bytes	#1

D7.5 /                                                
DONE RESULTS GOOD HERE 5 Files(s)	 with 5 files of Size 7620 Bytes	#1

D8.5 /                                                
DONE RESULTS GOOD HERE 5 Files(s)	 with 5 files of Size 7620 Bytes	#1

D9.5 /                                            
DONE RESULTS GOOD HERE 5 Files(s)	 with 5 files of Size 7620 Bytes	#2
                                                
TEST /no count DIR
        
D0.28 /                                                                                                                                                                                                                                    
DONE RESULTS GOOD HERE 28 Files(s)	 with 28 files of Size 14238 Bytes	#2
            
D0.28 /                                                                                                                                                                                                                                    
DONE RESULTS GOOD HERE 28 Files(s)	 with 28 files of Size 14238 Bytes	#2
        
D0.25 /                                                                                                                                                                                                            
DONE RESULTS GOOD HERE 25 Files(s)	 with 25 files of Size 12800 Bytes	#2
        
Huge /no count DIR
        
D0.10 /                                                                                    
DONE RESULTS GOOD HERE 10 Files(s)	 with 10 files of Size 4000000 Bytes	#2
            
°FILE: mtpindex.dat sz=0        
TenHere /no count DIR
        
°FILE: 400000_282.txt sz=400000        
°FILE: 400000_283.txt sz=400000        
°FILE: 400000_284.txt sz=400000        
°FILE: 400000_285.txt sz=400000        
°FILE: 400000_286.txt sz=400000        
°FILE: 400000_287.txt sz=400000        
°FILE: 400000_288.txt sz=400000        
°FILE: 400000_289.txt sz=400000        
°FILE: 400000_290.txt sz=400000        
°FILE: 400000_291.txt sz=400000    	  10 File(s) tested GOOD HERE	 with 10 files of Size 4000000 Bytes	#2
        
System Volume Information /no count DIR
        
°FILE: WPSettings.dat sz=12        
°FILE: IndexerVolumeGuid sz=76        
Total 304 files of Size 18019644 Bytes
Bytes Used: 21331968, Bytes Total:31889817600
 
@defRagster - we will have to take a look soon. Right now just taking it easy...

@all - @mjs513 and myself have been playing some more with the image viewer ;) I renamed it and removed the name ILI9341 as we have it also working on ILI9488.
Also reworked the bitmap viewer to use the image scaling code we mentioned in code for PNG so can now scale down images, plus center and clip them.
Also allowed the .ini file to specify a background color to use...

Now off to do some other less fun stuff

CrossPost :)

Hopefully that post gives useful info to follow up.

Off here for other chores as well ... In fact other chores just interrupted ... another new computer coming to replace yet another bulging battery laptop ...
 
@mjs513 and myself - could not resist playing a little longer, so again he added support for ST7735/ST7789 displays and I added RA8875
Probably done with that for now ;)

screenshot.jpg
 
Very cool! I'll have to hook up a display and try it out.

Did you guys see koromix re-Updated TyCOmmander to 0.9.7? Indeed there was a bug in prior release that failed uploads.

Paul sent his defunct prior Rev breakout PCB for MicroMod. Came without USB Host connector that is legged SMD - I have an all through hole and a pure SMD - but not one to like that - so maybe it will work as a display test board with T_4.0 breakout headers without building it up any more with missing pieces.
 
Argh - failed build of 2nd defunct carrier - lost T_MM ... emailed ... not fun.

UPDATED: Defragster/T4LockBeta/tree/main/MakeFiles

Extended Menu:
Code:
Menu Options:
	t - Test Files write 2204
	b - Test Files write BIG
	s - Test Files write small
	[B]u - Test Files write USER edit[/B]
	n - Test ASCII and UTF8 Filenames
	v - Verify Files
	l - List files on media

	R - Restart Teensy
	W - Remove ALL media content
> added 'u' for user custom edit without changing the default "t,b,s" settings
--> anything can be copied or added - for repro just post the edited section"
Code:
  else if ( ii == 5 ) { // USER
    // EDIT HERE - for more files, Dirs, larger or alternate file sizes
    // Multiple use of same FOLDER will mess up the file count - if they have same # files
    showMediaSpace(); MakeDataFiles( szStart[0], 2, 100, 100 );
    showMediaSpace(); MakeDataFiles( szStart[10], 2, 100, 100 );
  }

Testing and editing code as this is typed. Using a 32GB SD card 'b' overfilled. I turned off Teensy. Resulted in corrupted SD card, could not remove everything. Even the PC could not open it, Had to Format.
Code:
  Fail remove DIR>	ManyF/111.1024/
  Fail remove DIR>	ManyF/222.1024/
  Fail remove DIR>	ManyF/
>> Shrunk the request file create to fit 32GB ??
-> still failing oddly - maybe another trashed old 32 GB card?
-> Added 'press any key' abort behavior to repeat MAKE...()
'b' Working fine on 64GB card:
Code:
Total 858 files of Size 391,274 Bytes
Bytes Used: 120,586,240, Bytes Total:63831015424
-> Used SDcardFormatter program on PC and it failed the same?

That's all for now - here is what empty media looks like after 's' and 'v' - File folders on root one deep so it should work with LFS:
Code:
 ================================ Media Size=63831015424	Used Size=4456448	 us=149795485   KB/sec=0.00   Bytes written=0
	Make DeepDir :
Make DD File:/D0.3/2048	File size=2048=2048	 us=309835487    end:zE. 859x   5AE5
Make DD File:/D0.3/2048	File size=2048=2048	 us=309845714    end:zE. 860x   5B63
Make DD File:/D0.3/2048	File size=2048=2048	 us=309860556    end:zE. 861x   5BE1

 ================================ Media Size=63831015424	Used Size=4980736	 us=49811   KB/sec=120.46   Bytes written=6144
	Make DeepDir :
Make DD File:/D0.4/100	File size=100=100	 us=309884441    end:zE. 862x   5BE6
Make DD File:/D0.4/500	File size=500=500	 us=309893982    end:zE. 863x   5C04
Make DD File:/D0.4/900	File size=900=900	 us=309901733    end:zE. 864x   5C3B
Make DD File:/D0.4/1300	File size=1300=1300	 us=309908761    end:zE. 865x   5C8B

 ================================ Media Size=63831015424	Used Size=5636096	 us=44102   KB/sec=62.00   Bytes written=2800
	Make DeepDir :
Make DD File:/D0.5/100	File size=100=100	 us=309934937    end:zE. 866x   5C90
Make DD File:/D0.5/500	File size=500=500	 us=309944468    end:zE. 867x   5CAE
Make DD File:/D0.5/900	File size=900=900	 us=309952085    end:zE. 868x   5CE5
Make DD File:/D0.5/1300	File size=1300=1300	 us=309978511    end:zE. 869x   5D35
Make DD File:/D0.5/1700	File size=1700=1700	 us=309985803    end:zE. 870x   5D9E

 ================================ Media Size=63831015424	Used Size=6422528	 us=73380   KB/sec=59.89   Bytes written=4500
	Make DeepDir :
Make DD File:/D0.6/4096	File size=4096=4096	 us=310011518    end:zE. 871x   5E9C
Make DD File:/D0.6/4096	File size=4096=4096	 us=310021451    end:zE. 872x   5F9A
Make DD File:/D0.6/4096	File size=4096=4096	 us=310036378    end:zE. 873x   6098
Make DD File:/D0.6/4096	File size=4096=4096	 us=310043882    end:zE. 874x   6196
Make DD File:/D0.6/4096	File size=4096=4096	 us=310051338    end:zE. 875x   6294
Make DD File:/D0.6/4096	File size=4096=4096	 us=310058838    end:zE. 876x   6392

 ================================ Media Size=63831015424	Used Size=7340032	 us=79805   KB/sec=300.73   Bytes written=24576
MakeData done.

[B]Task 's' complete![/B]
        
D0.3 /                            
DONE RESULTS GOOD HERE 3 Files(s)	 with 3 files of Size 6144 Bytes	#2
        
D0.4 /                                    
DONE RESULTS GOOD HERE 4 Files(s)	 with 4 files of Size 2800 Bytes	#2
        
D0.5 /                                            
DONE RESULTS GOOD HERE 5 Files(s)	 with 5 files of Size 4500 Bytes	#2
        
D0.6 /                                                    
DONE RESULTS GOOD HERE 6 Files(s)	 with 6 files of Size 24576 Bytes	#2
    
Total 18 files of Size 38020 Bytes
Bytes Used: 7340032, Bytes Total:63831015424

[B]Task 'v' complete![/B]

Ignore the trailing #2, sometimes it is a #1, depending on the dir walk path.

... github update complete ...Zzzz's
 
Well @KurtE and I seem to be having too much fun with the picture viewer and MTP. So while testing the SF carrier boards SD Card (which uses pin 10 as chip select) decided to update the picture_viewer sketch to use SF IO Carrier.
IMG-0587.jpg

Changes were pushed to the Kurt's fast-start branch of MTP
 
Well @KurtE and I seem to be having too much fun with the picture viewer and MTP. So while testing the SF carrier boards SD Card (which uses pin 10 as chip select) decided to update the picture_viewer sketch to use SF IO Carrier.

Changes were pushed to the Kurt's fast-start branch of MTP
Also played with RA8876, and ran into some interesting problems...

One being when you call writeRect on this display, it uses async Serial output: _spi.transfer(buffer, nullptr, length, event);
and returns. But for example the JPG decoder then reused this same memory and was overwriting it while the SPI code was transferring it...

screenshot.jpg

Also mentioned on another thread, I still have not been able to get the Touch screen to work on my 7" display.

Edit: forgot to mention that sort of slow pictures as for example some of the formats output 1 line at a time, while others output parts of multiple rows.
May play with buffering more and doing fewer writeRects, but probably not yet.
Code:
Loading JPG image 'P3090005.JPG'
Image size: 1712x1368Scale: 1/1 Image Offsets (84, -42)
!!File:P3090005.JPG Time:3490 writeRect calls:306
Step Mode: enter anything to continue

Back to ???
 
Pushed up minor cleanup of: Defragster/T4LockBeta/tree/main/MakeFiles

Good for making files on SD - or small single deep on FLASH with LFS with #define edit.

Those files then Verify in place with 'v'
'W' will wipe all files and dirs

Files can be MTP copied to Host to check ( write to SD and use those as true compare source on Host )

And files from Host can be copied with MTP and the 'v'erified to be present and correct.
 
After posted here to give sample code written LFS>SD or SD>LFS folder and file copy.

Seemed that code might be useful in MakeFiles to get an image of an LFS drive to the SD card to test/verify.

Update to: T4LockBeta/tree/main/MakeFiles

Now has a "C"opy option when the media in use is LFS instead of SD [ // #define USE_SDIO_SD ]. The active LFS Media Files and Folders will be copied to SD card folder "LFS_CPY0/" - if 'folder' exists it will try digit chars [0 to 8] to make a new folder on the SD Root.

:Also some minor edits - including printing filenames, like dir, not checked in a missed case.
 
Aargh

MTP+Serial on Ubuntu not working..

Worked on Windows, Worked on MAC, but on Ubuntu sometimes it might show up as a PTP(Showell) window...

Tried throwing several darts at it: like:

changing the interface numbers.... Did not help
Change the order the interfaces were output in the USB descriptor, did not help...

Pulled the remaining few hairs out ;) And randomly I looked at the current udev rules for Teensy.
Which minus the comment lines is:
Code:
ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04*", ENV{ID_MM_DEVICE_IGNORE}="1", ENV{ID_MM_PORT_IGNORE}="1"
ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789a]*", ENV{MTP_NO_PROBE}="1"
KERNEL=="ttyACM*", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04*", MODE:="0666", RUN:="/bin/stty -F /dev/%k raw -echo"
KERNEL=="hidraw*", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04*", MODE:="0666"
SUBSYSTEMS=="usb", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04*", MODE:="0666"
KERNEL=="hidraw*", ATTRS{idVendor}=="1fc9", ATTRS{idProduct}=="013*", MODE:="0666"
SUBSYSTEMS=="usb", ATTRS{idVendor}=="1fc9", ATTRS{idProduct}=="013*", MODE:="0666"

Now if you look at the usb_desc.h file we have:
Code:
#elif defined(USB_MTPDISK)
  #define VENDOR_ID		0x16C0
  #define PRODUCT_ID		0x04D1

And for adding MTP + Serial we have:
Code:
#elif defined(USB_MTPDISK_SERIAL)
  #define VENDOR_ID             0x16C0
  #define PRODUCT_ID            0x0476 //fake an include everything device

So the line in the udev rule: ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789a]*", ENV{MTP_NO_PROBE}="1"
Will exclude it from MTP :mad:

I edited the file removed the 7 as a test, rebooted and it showed up as an MTP device....
Just to make sure I undid many of the things I tried as dart board, rebuilt and still worked.

So if we are going to support (MTP + Serial) and allow the generation of other combinations like (Keyboard + MTP), we need to change something:
Options include

different PID for MTP+Serial (Probably good thing)

Update the udev rules to change that line or remove it... Not sure why needed

Reuse the same PID for either Serial or SEREMU - I do see that for example MIDI does reuse the same PID for MIDI, MIDI4, MIDI16, but not for MIDI+Serial...

But at least for now I know what is going on, so I can stop chasing my non-existent tail :)
 
different PID for MTP+Serial (Probably good thing)
This is what I asked Paul to decide for long time, but he does not hear on this side.

He only has to decide on a number, and when convenient to add it it the teensy loader environment, so uploading with Type MTP+Serial does not need button press.
(If it is not as simple as I state, not a problem, but it is a call for Paul's action)
Once a PID is chosen, we can make a pull request to usb_desc.h, and clear up our MTP dev environment
 
@KurtE - @mjs513 - Have a small problem with MTP. I have updated to what is the latest from Kurt's repo. I updated cores-mtp_serial, MTP_Teensy-fast_start, LittleFS-main.

I am getting this error compiling:
Code:
/home/wwatson/arduino-1.8.19/hardware/teensy/../tools/arm/bin/arm-none-eabi-g++ -c -O2 -g -Wall -ffunction-sections -fdata-sections -nostdlib -MMD -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=156 -DARDUINO=10819 -DARDUINO_TEENSY41 -DF_CPU=600000000 -DUSB_MTPDISK -DLAYOUT_US_ENGLISH -I/tmp/arduino_build_17728/pch -I/home/wwatson/arduino-1.8.19/hardware/teensy/avr/cores/teensy4 -I/home/wwatson/Arduino/libraries/MTP_Teensy-cache_storage_records/src -I/home/wwatson/arduino-1.8.19/hardware/teensy/avr/libraries/SD/src -I/home/wwatson/arduino-1.8.19/hardware/teensy/avr/libraries/SdFat/src -I/home/wwatson/arduino-1.8.19/hardware/teensy/avr/libraries/SPI -I/home/wwatson/arduino-1.8.19/hardware/teensy/avr/libraries/USBHost_t36-FS_Integration_MSC/src -I/home/wwatson/arduino-1.8.19/hardware/teensy/avr/libraries/LittleFS/src -I/home/wwatson/Arduino/libraries/MemoryHexDump/src /tmp/arduino_build_17728/sketch/mtp-test.ino.cpp -o /tmp/arduino_build_17728/sketch/mtp-test.ino.cpp.o
/home/wwatson/Arduino/libraries/MTP_Teensy-cache_storage_records/examples/mtp-test/mtp-test.ino:44:1: error: 'MTPD' does not name a type
 MTPD    mtpd(&storage);
 ^
/home/wwatson/Arduino/libraries/MTP_Teensy-cache_storage_records/examples/mtp-test/mtp-test.ino: In function 'void setup()':
/home/wwatson/Arduino/libraries/MTP_Teensy-cache_storage_records/examples/mtp-test/mtp-test.ino:339:3: error: 'mtpd' was not declared in this scope
   mtpd.begin();
   ^
/home/wwatson/Arduino/libraries/MTP_Teensy-cache_storage_records/examples/mtp-test/mtp-test.ino: In function 'void loop()':
/home/wwatson/Arduino/libraries/MTP_Teensy-cache_storage_records/examples/mtp-test/mtp-test.ino:376:69: error: 'mtpd' was not declared in this scope
         DBGSerial.printf("store:%u storage:%x name:%s fs:%x\n", ii, mtpd.Store2Storage(ii),
                                                                     ^
/home/wwatson/Arduino/libraries/MTP_Teensy-cache_storage_records/examples/mtp-test/mtp-test.ino:406:7: error: 'mtpd' was not declared in this scope
       mtpd.send_DeviceResetEvent();
       ^
/home/wwatson/Arduino/libraries/MTP_Teensy-cache_storage_records/examples/mtp-test/mtp-test.ino:418:5: error: 'mtpd' was not declared in this scope
     mtpd.loop();
     ^
/home/wwatson/Arduino/libraries/MTP_Teensy-cache_storage_records/examples/mtp-test/mtp-test.ino: In function 'void checkMSCChanges()':
/home/wwatson/Arduino/libraries/MTP_Teensy-cache_storage_records/examples/mtp-test/mtp-test.ino:458:11: error: 'mtpd' was not declared in this scope
       if (mtpd.send_StoreAddedEvent(pmsfs_store_ids[i]) < 0) send_device_reset = true;
           ^
/home/wwatson/Arduino/libraries/MTP_Teensy-cache_storage_records/examples/mtp-test/mtp-test.ino:462:11: error: 'mtpd' was not declared in this scope
       if (mtpd.send_StoreRemovedEvent(pmsfs_store_ids[i]) < 0) send_device_reset = true;
           ^
/home/wwatson/Arduino/libraries/MTP_Teensy-cache_storage_records/examples/mtp-test/mtp-test.ino:468:26: error: 'mtpd' was not declared in this scope
   if (send_device_reset) mtpd.send_DeviceResetEvent();
                          ^
/home/wwatson/Arduino/libraries/MTP_Teensy-cache_storage_records/examples/mtp-test/mtp-test.ino: In function 'void stopLogging()':
/home/wwatson/Arduino/libraries/MTP_Teensy-cache_storage_records/examples/mtp-test/mtp-test.ino:506:3: error: 'mtpd' was not declared in this scope
   mtpd.send_DeviceResetEvent();
   ^
Multiple libraries were found for "SD.h"
 Used: /home/wwatson/arduino-1.8.19/hardware/teensy/avr/libraries/SD
 Not used: /home/wwatson/arduino-1.8.19/libraries/SD
Using library MTP_Teensy-cache_storage_records at version 1.0.0 in folder: /home/wwatson/Arduino/libraries/MTP_Teensy-cache_storage_records 
Using library SD at version 2.0.0 in folder: /home/wwatson/arduino-1.8.19/hardware/teensy/avr/libraries/SD 
Using library SdFat at version 2.1.0 in folder: /home/wwatson/arduino-1.8.19/hardware/teensy/avr/libraries/SdFat 
Using library SPI at version 1.0 in folder: /home/wwatson/arduino-1.8.19/hardware/teensy/avr/libraries/SPI 
Using library USBHost_t36-FS_Integration_MSC at version 0.1 in folder: /home/wwatson/arduino-1.8.19/hardware/teensy/avr/libraries/USBHost_t36-FS_Integration_MSC 
Using library LittleFS at version 1.0.0 in folder: /home/wwatson/arduino-1.8.19/hardware/teensy/avr/libraries/LittleFS 
Using library MemoryHexDump at version 1.0.1 in folder: /home/wwatson/Arduino/libraries/MemoryHexDump 
Error compiling for board Teensy 4.1.

When I look through the sources I can't seem to find "MTPD" declared anywhere. What am I missing...
 
Maybe that test case is not updated yet...

We changed the MTPD to be MTP object..

Will check it and update the sketch
 
Back
Top