Sorry I have been playing with an RPI4 running Ubuntu 22.04 64 bits and a Teensy4.1
Note: I have the Teensy plugged into the RPI4
And was experimenting... Started this to also test out the new Beta build from Paul to see if it worked on this setup...
Now this this setup, I am using Arduino 1.8.19 and/or Arduino 2RC9 with latest beta of Teensyduino. posted today
I am using the not yet in builds mtp_teensy library:
https://github.com/KurtE/MTP_Teensy
On the Teensy I am running the example sketch in MTP_Teensy Simplified Examples/Example_3_simple_SD
I built it using USB Type set to Serial + MTP Disk
Note: right now my RPI is not running headless, i.e. has display, mouse, keyboard.
In this state: The Teensy shows up in the Files app and you can browse to it and copy file to and from the SD card on the Teensy...
But I am assuming that you may not want to be setup with gui, so was experimenting:
If you do searches on net and find that the Teensy was mounted:
https://askubuntu.com/questions/342319/where-are-mtp-mounted-devices-located-in-the-filesystem
at /run/user/1000/gvfs/mtp:host...
If you cd to that directory it appears like you can copy files from the SD to the RPI, but not from RPI to the Teensy...
It will give you an error something like: can not create ordinary file.
So took me a bit of time to find a command line that works:
So far my best luck is with the gio command:
https://www.baeldung.com/linux/mounting-mtp-devices
So I was successful to copy a file to using the command: gio copy <source> <destination>
In my case, I tried it from command window, where I had cd down to the teensy and into sub-directory of sd card and tried:
gio copy ~/github/mtp_teensy/src/*.cpp .
And the files now are on the SD card...
There are other ways to connect up MTP drives to the RPI. which may work as well, but this gives at least one way to do it.