Rockbox open source high quality audio player as a Music Player Daemon
mpris rockbox mpd libadwaita audio rust zig deno
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

[bugfix] FS#13456 - Loaded FM preset list doesn't restore after restart

the fmr file wasn't being detected on multivolume targets

the global preset list couldn't be cleared once set

empty global preset file wasn't detected properly either

Change-Id: I9c4b40ed0b6f3dbb0d38eb668fc74a512ea34062

+23 -29
+1 -18
apps/filetree.c
··· 635 635 #if CONFIG_TUNER 636 636 /* fmr preset file */ 637 637 case FILE_ATTR_FMR: 638 - splash(0, ID2P(LANG_WAIT)); 639 - 640 - /* Preset inside the default folder. */ 641 - if(!strncasecmp(FMPRESET_PATH, buf, strlen(FMPRESET_PATH))) 642 - { 643 - set_file(buf, global_settings.fmr_file, MAX_FILENAME); 644 - radio_load_presets(global_settings.fmr_file); 645 - } 646 - /* 647 - * Preset outside default folder, we can choose such only 648 - * if we are out of the radio screen, so the check for the 649 - * radio status isn't neccessary 650 - */ 651 - else 652 - { 653 - radio_load_presets(buf); 654 - } 638 + radio_load_presets(buf); 655 639 rc = GO_TO_FM; 656 - 657 640 break; 658 641 case FILE_ATTR_FMS: 659 642 ft_apply_skin_file(buf, global_settings.fms_file, MAX_FILENAME);
+21 -10
apps/radio/presets.c
··· 196 196 } 197 197 close(fd); 198 198 199 - if(!strncasecmp(FMPRESET_PATH, filepreset, strlen(FMPRESET_PATH))) 199 + if (strcasestr(filepreset, FMPRESET_PATH)) 200 200 set_file(filepreset, global_settings.fmr_file, MAX_FILENAME); 201 201 presets_changed = false; 202 202 } ··· 206 206 } 207 207 } 208 208 209 - void radio_load_presets(char *filename) 209 + void radio_load_presets(const char *filename) 210 210 { 211 211 int fd; 212 212 int rc; ··· 220 220 num_presets = 0; 221 221 222 222 /* No Preset in configuration. */ 223 - if(filename[0] == '\0') 223 + if(filename[0] == '\0' || filename[0] == '-') 224 224 { 225 225 filepreset[0] = '\0'; 226 226 return; 227 227 } 228 - /* Temporary preset, loaded until player shuts down. */ 229 - else if(filename[0] == '/') 230 - strmemccpy(filepreset, filename, sizeof(filepreset)); 231 - /* Preset from default directory. */ 232 - else 228 + 229 + splash(0, ID2P(LANG_WAIT)); 230 + 231 + if(filename[0] != '/') /* Preset within radio screen */ 232 + { 233 233 snprintf(filepreset, sizeof(filepreset), "%s/%s.fmr", 234 - FMPRESET_PATH, filename); 234 + FMPRESET_PATH, filename);; 235 + } 236 + else 237 + { 238 + strmemccpy(filepreset, filename, sizeof(filepreset)); 239 + } 240 + 241 + /* Preset inside the default folder? */ 242 + if (strcasestr(filepreset, FMPRESET_PATH)) 243 + set_file(filepreset, global_settings.fmr_file, MAX_FILENAME); 244 + /* else Temporary preset, loaded until player shuts down. */ 235 245 236 246 fd = open_utf8(filepreset, O_RDONLY); 237 247 if(fd >= 0) 238 248 { 239 249 while(!done && num_presets < MAX_PRESETS) 240 250 { 241 - rc = read_line(fd, buf, 128); 251 + rc = read_line(fd, buf, sizeof(buf)); 242 252 if(rc > 0) 243 253 { 244 254 if(settings_parseline(buf, &freq, &name)) ··· 437 447 radio_set_mode(RADIO_SCAN_MODE); 438 448 curr_preset = -1; 439 449 presets_changed = false; /* Don't ask to save when clearing the list. */ 450 + global_settings.fmr_file[0] = '-'; 440 451 441 452 return true; 442 453 }
+1 -1
apps/radio/radio.h
··· 34 34 }; 35 35 36 36 #if CONFIG_TUNER 37 - void radio_load_presets(char *filename); 37 + void radio_load_presets(const char *filename); 38 38 void radio_save_presets(void); 39 39 void radio_init(void) INIT_ATTR; 40 40 void radio_screen(void);