From 11ce786aaa5856f4be6024911b537a5f44ee681e Mon Sep 17 00:00:00 2001 From: DRracer Date: Tue, 27 Aug 2019 13:47:58 +0200 Subject: [PATCH] Support for more special characters allowed in file names (^ + = [ ] ; ,) --- Firmware/Marlin_main.cpp | 14 +++++++++----- Firmware/SdBaseFile.cpp | 5 ++++- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 5279776d..a034f94e 100755 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -3815,10 +3815,14 @@ eeprom_update_word((uint16_t*)EEPROM_NOZZLE_DIAMETER_uM,0xFFFF); // lcd_calibration(); // } - } - else if (code_seen('^')) { - // nothing, this is a version line - } else if(code_seen('G')) + } + // This prevents reading files with "^" in their names. + // Since it is unclear, if there is some usage of this construct, + // it will be deprecated in 3.9 alpha a possibly completely removed in the future: + // else if (code_seen('^')) { + // // nothing, this is a version line + // } + else if(code_seen('G')) { gcode_in_progress = (int)code_value(); // printf_P(_N("BEGIN G-CODE=%u\n"), gcode_in_progress); @@ -5319,7 +5323,7 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) // ----------------------------------- case 23: starpos = (strchr(strchr_pointer + 4,'*')); - if(starpos!=NULL) + if(starpos!=NULL) *(starpos)='\0'; card.openFile(strchr_pointer + 4,true); break; diff --git a/Firmware/SdBaseFile.cpp b/Firmware/SdBaseFile.cpp index be04ab1a..b9e881ef 100644 --- a/Firmware/SdBaseFile.cpp +++ b/Firmware/SdBaseFile.cpp @@ -394,7 +394,10 @@ bool SdBaseFile::make83Name(const char* str, uint8_t* name, const char** ptr) { i = 8; // place for extension } else { // illegal FAT characters - PGM_P p = PSTR("|<>^+=?/[];,*\"\\"); + //PGM_P p = PSTR("|<>^+=?/[];,*\"\\"); + // 2019-08-27 really? + // Microsoft defines, that only a subset of these characters is not allowed. + PGM_P p = PSTR("|<>?/*\"\\"); uint8_t b; while ((b = pgm_read_byte(p++))) if (b == c) goto fail; // check size and only allow ASCII printable characters