How to send files to the printer storage


I'm almost sure this is a non issue but after searching for it a bit and checking the docs I'm not sure I've got this right.

My workflow is the following:

  1. Slice on a computer
  2. Get the Gcode to the printer storage
  3. Print from octoprint (that's installed in an octopi usb connected to the computer)

Right now I have 2 ways to do (2): plug the SD card into the computer or upload it to octopi using the "upload to sd card".

If I chose the later what I understand is happening is that octoprint is reading the gcode instructions and sending them to the printer and then the printer is the one writing the instructions one by one to a SD file.

That does work but it takes a long time.

I guess that is something dependent on the printer and can not be avoided but am I doing that correctly? I guess octoprint does not have any way to write the sd card on the printer so I guess the answer is no, but, is there any way to transfer the files quicker with my current setup?

I know I could use a wifi connected SD card and that is an option for me but I wanted to make sure I wasn't missing some other way to do all that.

Maybe the speed of the process is printer dependent so I'm using a Prusa MK3.

Both the firmware of Octoprint and the printer are up to date.

Thanks a lot


Yes, that upload speed is sadly something that can't be helped. See also

There have been some experiments with xonxoff flow control recently which would greatly improve on the speed, see this PR, but things aren't looking reliable enough sadly.

I think the Prusa firmware in principle does support FlashAir cards, so getting one of those, transferring the file through the air and then triggering a refresh in OctoPrint might already solve your problem. All this could also be enhanced by a plugin but as far as I know none exists yet.



Thanks for your answer and sorry I missed that FAQ. I did really look for it but did it poorly it seems :stuck_out_tongue:

I'll go the wifi SD card way. Thanks.


What am I missing here? Doesn't the Prusa MK3 allow printing from USB (i.e GCode sent via USB)?


Yes, sure, but it has some drawbacks as discussed here:


I've been using a FlashAir W-04 successfully for a while now on my QIDI Tech 1, and I've finally set up OctoPrint (OctoPi .15) for that machine as well. I see the directories listed in the terminal, but the file structure doesn't show up in OctoPrint, even if I have it set to only show SD card files. Ideally, I'd be able to see the files on the SD card and tell the printer to print them from OctoPrint (which seems to be a standard feature) so I don't have to walk to the printer, scroll through menus, and then launch the print; this is the primary reason I hooked up an OctoPrint server to it.

Yes, I ultimately plan to have my Printrbot hooked up to OctoPrint as well, but the first step is getting this one working, since I slice everything with S3D and push x3gs to the QIDI over WiFi and want to free S3D up from being in the loop with the printer, as locking the screen slows the printer (S3D on MacOS quirk). Once this is working, the Printrbot will be freed up for it's own OctoPrint setup.

Any advice on what I may be doing wrong? The only thing I haven't tried is remotely mounting the card on the RPi and pointing the local storage to it, but that shouldn't be needed. Here's the terminal output that I get (and still see a blank files list):

Changing monitoring state from "Offline" to "Opening serial port"
Connected to: <GPX.gpxprinter.GpxPrinter instance at 0x6f4d2c60>, starting monitor
Starting baud rate detection
Changing monitoring state from "Opening serial port" to "Detecting baudrate"
Recv: start
Changing monitoring state from "Detecting baudrate" to "Operational"
Recv:  Sailfish v7.8
Recv: echo: gcode to x3g translation by GPX
Recv: SD card ok
Send: N0 M110 N0*125
Recv: ok
Send: N1 M115*39
Send: M21
Recv: ok
Recv: SD card ok
Send: M20
Recv: ok
Recv: Begin file list
Recv: DCIM
Recv: 3D
Recv: End file list


Do I understand this correctly? Are the files name.x3gs on the SD card? Perhaps you need to show us a directory listing of the SD card with at least one file showing that you would launch to print.


S3D actually saves both .gcode and .x3g files. The layout of a FlashAir has a root directory with a DCIM directory and then you can either dump files in the root or another directory, etc. I don't even see the directories in the root (DCIM, where configuration info is stored and 3D, where gcode and x3g files are stored). Below are a listing of the root, followed by one of the 3D directory; since the machine with S3D runs OS X, you'll see a bunch of dotfiles that are associated with the actual output files for OS X file metadata, which I would hope would have no impact.

FlashAir SD card root:

total 37
drwx------  1 taz   staff  2048 May  6 14:04 .
drwxrwxrwt@ 4 root  admin   136 May  6 09:08 ..
-rwx------@ 1 taz   staff  8196 May  6 14:04 .DS_Store
-rwx------  1 taz   staff  4096 May  6 14:04 ._.DS_Store
drwx------  1 taz   staff  2048 Oct 28  2017 3D
drwx------  1 taz   staff  2048 Oct 28  2017 DCIM

3D directory (where S3D output is saved):

total 144710
drwx------  1 taz  staff      2048 Oct 28  2017 .
drwx------  1 taz  staff      2048 May  6 14:09 ..
-rwx------  1 taz  staff      4096 May  6 14:09 ._10 sq mm 30h tower @ 20.gcode
-rwx------  1 taz  staff      4096 May  6 14:09 ._10 sq mm 30h tower @ 20.x3g
-rwx------  1 taz  staff      4096 May  6 14:09 ._2017 Anniversary Heart.gcode
-rwx------  1 taz  staff      4096 May  6 14:09 ._2017 Anniversary Heart.x3g
-rwx------  1 taz  staff      4096 May  6 14:09 ._RPi open top case.gcode
-rwx------  1 taz  staff      4096 May  6 14:09 ._RPi open top case.x3g
-rwx------  1 taz  staff      4096 May  6 14:09 ._cable retainer.gcode
-rwx------  1 taz  staff      4096 May  6 14:09 ._cable retainer.x3g
-rwx------  1 taz  staff      4096 May  6 14:09 ._maghold fixtures.gcode
-rwx------  1 taz  staff      4096 May  6 14:09 ._maghold fixtures.x3g
-rwx------  1 taz  staff      4096 May  6 14:09 ._overhang_test_half.gcode
-rwx------  1 taz  staff      4096 May  6 14:09 ._overhang_test_half.x3g
-rwx------  1 taz  staff      4096 May  6 14:09 ._single spool roller.gcode
-rwx------  1 taz  staff      4096 May  6 14:09 ._single spool roller.x3g
-rwx------  1 taz  staff      4096 May  6 14:09 ._spool holder 65mm complete.gcode
-rwx------  1 taz  staff      4096 May  6 14:09 ._spool holder 65mm complete.x3g
-rwx------  1 taz  staff    238378 May  6 14:09 10 sq mm 30h tower @ 20.gcode
-rwx------  1 taz  staff    258495 May  6 14:09 10 sq mm 30h tower @ 20.x3g
-rwx------  1 taz  staff   9184297 May  6 14:09 2017 Anniversary Heart.gcode
-rwx------  1 taz  staff  10268224 May  6 14:09 2017 Anniversary Heart.x3g
-rwx------  1 taz  staff   5449522 May  6 14:09 RPi open top case.gcode
-rwx------  1 taz  staff   6300878 May  6 14:09 RPi open top case.x3g
-rwx------  1 taz  staff   2501147 May  6 14:09 cable retainer.gcode
-rwx------  1 taz  staff   2873919 May  6 14:09 cable retainer.x3g
-rwx------  1 taz  staff   4370930 May  6 14:09 maghold fixtures.gcode
-rwx------  1 taz  staff   4986580 May  6 14:09 maghold fixtures.x3g
-rwx------  1 taz  staff   1593876 May  6 14:09 overhang_test_half.gcode
-rwx------  1 taz  staff   1854945 May  6 14:09 overhang_test_half.x3g
-rwx------  1 taz  staff   2966400 May  6 14:09 single spool roller.gcode
-rwx------  1 taz  staff   3372050 May  6 14:09 single spool roller.x3g
-rwx------  1 taz  staff   8376975 May  6 14:09 spool holder 65mm complete.gcode
-rwx------  1 taz  staff   9420472 May  6 14:09 spool holder 65mm complete.x3g


I just tried this on my system and it works. What username do you use on OctoPrint? The permissions on my files are -rw-r--r-- where yours don't allow group or world access at all.


I see them on your listing...

The files list on OctoPrint doesn't do hierarchy but lists the files in the directories as folder/filename
but since I think you have a permission problem, that would explain why no files are shown.


EDIT (missed the first reply): The SD card should be FAT32, so it doesn't really have permissions, per se. The permissions shown are just what OS X assigns to any WebDAV FS mounted by the current user. There are no files in the root, just the 3D and DCIM directories, and those don't show up in the files listing at all, even as a "folder", just in the terminal (so I know the printer is telling OctoPrint about them, it just isn't doing anything with the information).

Does OctoPrint not traverse the directory structure at all? I know I see options on how to handle the display of "folders" and I've perhaps made a bad assumption that that applies to the SD card structure as well as the local storage. I'm wondering if this is something that @foosel could clarify if it's not well-known and should become a FAQ article if directory listing and traversal is a local storage only feature (as it'd change how people have to configure and use FlashAir cards, though this is easy, just kind of messy since nothing would organized anymore).


I believe OctoPrint does traverse the folder structure but unless there is a file that meets the criteria for display, it won't show an empty folder (i.e. it flattens the directory structure into directory/directory/filename.


Interesting...if that's the case, there may be a bug (or a missing feature?), because there's no output in the terminal listing the files in the directories on the SD card at all, which either means it wasn't requested, or the firmware didn't offer up the info and OctoPrint assumes the firmware will provide a full volume traversal. Now I need to look up whether M20 can take arguments and whether it is meant to supply a listing of all contents of the SD card or just the root/current directory. We may need a plugin or configuration option that allows OctoPrint to look inside a specific SD card directory, or I may need to reconfigure my card and write up a FAQ on how to use FlashAir cards with OctoPrint and get @foosel to file it appropriately.


I don't know the answer but all I can say is it worked for me. I put 3 directories on my SD card with files in each and all the .gcode files show up in the files section of OctoPrint. Kinda messy because of the filename length limitation but they are all there.

I was just trying to point out where my success differed from your failure.

Send: M20
Recv: Begin file list
Recv: CURATA~1.GCO 2178
Recv: /3DBENCHY/FILES/3DBENC~1.GCO 5478281
Recv: /3DBENCHY/FILES/3DBENC~2.GCO 2438437
Recv: /3DBENCHY/FILES/3DBENC~3.GCO 5760601
Recv: /3DBENCHY/FILES/3DBENC~4.GCO 2978506
Recv: /3DBENCHY/FILES/3DBBFC~1.GCO 3286587
Recv: /3DBENCHY/FILES/3D3CB7~1.GCO 5184575
Recv: /SQUIRC~1/SQUIRC~1.GCO 5950294
Recv: /VASE/MONOCH~1.GCO 11195931
Recv: /VASE/MONOCH~2.GCO 8307082
Recv: End file list



It looks like it's a Sailfish firmware issue, actually. I looked up the M20 info and did some experimentation and Sailfish only returns the root of the SD card, without traversal. I suppose I should write a FlashAir guide for the wiki.

Moving files to the root gives me a file listing, as you'd expect under those circumstances...thanks for helping and letting me bounce stuff off of you :smile:


Responses to M20 are expected to contain the full (recursive) file list. OctoPrint will not do any kind of traversal (it also wouldn't be able to know if some entry in the M20 response is a directory of file, no designator to determine that). So this is the firmware not responding in the expected format.

I also remember that @markwal said that there were issues with SD prints on Sailfish via the GPX plugin, but I might be mixing things up here or misremembering something.


I haven't had any issues with SD prints on Sailfish via the GPX plugin thus far, other than the particular version of Sailfish not reporting any useful data for progress indication. One oddity, though, is that cancelling a print from the printer reports a successfully completed print to OctoPrint, with text that indicates it was manually cancelled, which OctoPrint doesn't pick up. It's something that could be detected with a single regexp to mark it as a failed print, but I haven't looked at the OctoPrint architecture at all and have no idea where that would need to be done. I'm happy to create a terminal dump if fixing this is something someone is interested in.

I'm increasingly leaning towards new firmware and possibly even a new controller for my QIDI Tech I printers, but if fixing this quirk would be fairly easy, I'd be willing to go code spelunking, given some pointers as to where to look.


There used to be a toggle for display-empty-directories there on the Wrench menu under Folders, but it looks like it's been removed as of 1.3.3.

You can always visit the Pi via SSH and copy in the first file if you're stuck with a chicken-and-egg problem with a new folder.