Retrode Forum

General Category => General Discussion => Topic started by: Neelix on 31/Jan/2012 02:54:42 PM

Title: Editors that can save config files directly to the Retrode
Post by: Neelix on 31/Jan/2012 02:54:42 PM
Hi all

Just wondering if anyone has compiled a list of editors that can or can't save directly to the Retrode.   

I've noticed for example that gedit can't but nano can. (under Ubuntu Lucid)

For now I'll maintain a list in the first post.

- Neelix

Command line solution

We have found this to work under any unixoid operating system. It may well be the most convenient way if you just want to change a single config setting:

echo "[HIDMode] 3" >> /path/to/RETRODE/RETRODE.CFG

(Obviously, /path/to/ is the mounting point in your respective file system, e.g., /Volumes/ under Mac OS X. Replace "[HIDMode] 3" with any other config setting that you may want to modify (though there may be a maximum number of characters for which this works).)

List of editors (work in progress)

Editors that can save to the Retrode:

Editors that can't save directly to the Retrode:

Title: Re: Editors that can save config files directly to the retrode
Post by: Matthias_H on 31/Jan/2012 03:34:52 PM
Brilliant idea! We can try to gather some information here, than put up a list in the documentation section over on retrode.org.
Title: Re: Editors that can save config files directly to the retrode
Post by: gadgetoid on 31/Jan/2012 03:42:30 PM
On linux and OSX it'll suffice top drop to terminal and just do:

cp /Volumes/RETRODE/RETRODE.CFG ~/RETRODE.CFG
vi ~/RETRODE.CFG
cp ~/RETRODE.CFG /Volumes/RETRODE/RETRODE.CFG

Your paths may vary.

This also means you've always got a backup of your CFG handy for firmware updates.


UPDATE: looks like this doesn't work in Linux for some reason or another, tried it on my Ubuntu netbook this morning and couldn't get the config to write... it failed silently, though, so it was pretty frustrating. The same procedure repeated on a Mac worked fine, though. Weird!
Title: Re: Editors that can save config files directly to the retrode
Post by: Muzer on 01/Feb/2012 09:19:46 AM
Are you cleanly unmounting the retrode before you remove it? Many distros are set up by default to keep a cache of things to write to the disk, and don't actually write it for a while or until you unmount it.
Title: Re: Editors that can save config files directly to the retrode
Post by: gadgetoid on 01/Feb/2012 10:07:00 AM
That's a good point. I'll have to give it a punt. The short answer is: no.

The long answer is: no, because I'm lazy :)

Thanks for the protip, I'll try it tonight.
Title: Re: Editors that can save config files directly to the retrode
Post by: Neelix on 01/Feb/2012 10:14:06 AM
Quote from: gadgetoid on 31/Jan/2012 03:42:30 PM
On linux and OSX it'll suffice top drop to terminal and just do:

cp /Volumes/RETRODE/RETRODE.CFG ~/RETRODE.CFG
vi ~/RETRODE.CFG
cp ~/RETRODE.CFG /Volumes/RETRODE/RETRODE.CFG

Your paths may vary.

This also means you've always got a backup of your CFG handy for firmware updates.


UPDATE: looks like this doesn't work in Linux for some reason or another, tried it on my Ubuntu netbook this morning and couldn't get the config to write... it failed silently, though, so it was pretty frustrating. The same procedure repeated on a Mac worked fine, though. Weird!


While I can see the wisdom of keeping a backup,   working around the issue really wasn't the point of the thread.   
What would be more interesting to me in this context is whether vi can write the config file directly to the retrode or not.  Have you actually tried that? (and if so,  have you tried it on both systems?)

- Neelix
Title: Re: Editors that can save config files directly to the retrode
Post by: gadgetoid on 01/Feb/2012 11:28:02 AM
Fair point! I don't believe VI can successfully write directly to RETRODE.CFG, I have attempted it on both systems but not with any particular determination.

On my Mac, VIM (not VI, I've long since "alias vi = vim") gets: ""RETRODE.CFG" E514: write error (file system full?)"

Emacs also gets: "IO error writing /Volumes/RETRODE/RETRODE.CFG: No space left on device"

The free, GUI App TextWrangler, however, seems to manage a write under OSX. I wrote a test comment, and verified it by opening again in VIM.

So there's one for your list :D
Title: Re: Editors that can save config files directly to the retrode
Post by: Neelix on 01/Feb/2012 12:54:50 PM
Cheers! :-) 

I've started a list in the first post.   Not sure I'll keep it in the current format,  might need to re-evaluate the format as i get more entries.

- Neelix
Title: Re: Editors that can save config files directly to the retrode
Post by: Matthias_H on 01/Feb/2012 03:43:31 PM
Thanks guys! I appreciate your taking care of this.
Title: Re: Editors that can save config files directly to the retrode
Post by: Muzer on 01/Feb/2012 10:10:53 PM
I think kate should support it - I haven't actually tested it though, so don't add it to the list. Because I believe kate moves the old file to RETRODE.CFG~ (and will report a warning if this fails), then writes the new file with the normal filename. But again, don't add it yet as I haven't actually tested it. I'll do so next time I'm at my desktop, if I remember!
Title: Re: Editors that can save config files directly to the retrode
Post by: Matthias_H on 01/Feb/2012 10:49:12 PM
Quote from: Muzer on 01/Feb/2012 10:10:53 PM
Because I believe kate moves the old file to RETRODE.CFG~ (and will report a warning if this fails)

If that's the case, the Retrode won't recognize it. The new file has to be written to the very same sector on the device. Whenever most programs rename a file, they only change the directory entry but the renamed file still points to the old storage location. Writing a new file, even with the original name, then redirects the new data to somewhere else.
Title: Re: Editors that can save config files directly to the retrode
Post by: Neelix on 01/Feb/2012 11:16:14 PM
Yes  but what Muzer is saying is that it makes a backup copy but then writes the changes to the original, not the copy, in which case the copy would be lost but the RETRODE.CFG file would successfully be written.  So theoretically, yes, it should work.

- Neelix
Title: Re: Editors that can save config files directly to the retrode
Post by: Matthias_H on 01/Feb/2012 11:21:11 PM
Tested it: kate complains a lot and doesn't save the file. As I predicted, it is the backup copy that causes the trouble (because it is not a deep copy but just a renamed link to the old data).

Told you so :)
Title: Re: Editors that can save config files directly to the retrode
Post by: Neelix on 01/Feb/2012 11:35:34 PM
In that case I'll add it to the list.  Could you advise what platform you tested it on?  As I see it, Its not guaranteed that the write method will be static across all ports of a program,  so I want to keep a record of what's been tested on what platform.

- Neelix
Title: Re: Editors that can save config files directly to the retrode
Post by: Muzer on 01/Feb/2012 11:59:43 PM
Quote from: Matthias_H on 01/Feb/2012 10:49:12 PM
Quote from: Muzer on 01/Feb/2012 10:10:53 PM
Because I believe kate moves the old file to RETRODE.CFG~ (and will report a warning if this fails)

If that's the case, the Retrode won't recognize it. The new file has to be written to the very same sector on the device. Whenever most programs rename a file, they only change the directory entry but the renamed file still points to the old storage location. Writing a new file, even with the original name, then redirects the new data to somewhere else.

OH, I see - I thought the problem was with an inability to detect when things were renamed, rather than an inability to detect when things were saved with the correct name to a different block.

Would it in any way be possible to set aside a small "temporary storage" location in whatever memory is left over, that is cleared every time the retrode is plugged in; save any file written to the filesystem, regardless of the name, in that (obviously reporting disk full if it exceeds the available space), but constantly check the directory listing to see if any files are named RETRODE.CFG, and if so read them and replace the config? Or am I ridiculously overthinking things, and that would be really hard?
Title: Re: Editors that can save config files directly to the retrode
Post by: Neelix on 02/Feb/2012 12:12:32 AM
Quote from: Muzer on 01/Feb/2012 11:59:43 PM
Would it in any way be possible to set aside a small "temporary storage" location in whatever memory is left over, that is cleared every time the retrode is plugged in; save any file written to the filesystem, regardless of the name, in that (obviously reporting disk full if it exceeds the available space), but constantly check the directory listing to see if any files are named RETRODE.CFG, and if so read them and replace the config? Or am I ridiculously overthinking things, and that would be really hard?

On that note, Would it perhaps be possible to tune the virtual file system to let the OS think its writing to a new file, but direct it to the same memory space if the name matches?

- Neelix
Title: Re: Editors that can save config files directly to the retrode
Post by: Matthias_H on 02/Feb/2012 01:18:22 AM
@Muzer: Good idea but there's simply not enough memory for that. Mind you, the Retrode is already hallucinating a 128MB file system using only 3500 bytes of RAM. Right now, there are about 600 bytes left; not  enough to even hold a single config file, let alone a whole chunk of SRAM data. The next major firmware revision will likely involve a desperate attempt at data compression, but I doubt it will free enough space to allow for such things.

@Neelix: Won't work because typically, first the data is written - then the file system entry (i.e., the name) is created. So we'd have to deal with the data before we even know what it's good for.
Title: Re: Editors that can save config files directly to the Retrode
Post by: Matthias_H on 02/Feb/2012 01:44:05 AM
Actually, I just got kate and nano to work under SuSE 11.4. Both required deactivation of backups (instructions added to list)
Title: Re: Editors that can save config files directly to the Retrode
Post by: Muzer on 02/Feb/2012 09:49:08 AM
Nano works already for me - must be the defaults in SuSE being rubbish. Never liked that distro ;)
Title: Re: Editors that can save config files directly to the Retrode
Post by: Neelix on 04/Feb/2012 04:52:44 PM
I added nedit (failed) and leafpad (successful) to the list.

@Matthias: good call on the formatting :-)

- Neelix
Title: Re: Editors that can save config files directly to the Retrode
Post by: Matthias_H on 04/Feb/2012 07:04:02 PM
Just found out that vim under Mac OS X does in fact work! Backups need to be disabled first:
echo "set nobackup" >> ~/_vimrc
echo "set nowritebackup" >> ~/_vimrc
echo "set noswapfile" >> ~/_vimrc

Title: Re: Editors that can save config files directly to the Retrode
Post by: matt on 02/Mar/2012 12:00:08 PM
TextMate on Mac OS X can save the file but it disappears from Finder afterwards and you need to reset the Retrode to get it to reappear. But the change is saved.

Personally, I prefer to use pico from the command line.
Title: Re: Editors that can save config files directly to the Retrode
Post by: Neelix on 03/Mar/2012 03:45:00 PM
Cheers!   :)
I've added TextMate and pico to the list for Mac OS X.

- Neelix
Title: Re: Editors that can save config files directly to the Retrode
Post by: matt on 03/Mar/2012 05:48:34 PM
pico is an ancestor of nano
Title: Re: Editors that can save config files directly to the Retrode
Post by: Neelix on 04/Mar/2012 07:54:31 AM
So to clarify, are you actually using  the earlier version pico, or are you using nano, and calling it pico out of force of habit? 

(on my system,  I can type nano or pico, and I get nano 2.2.2 either way. )

Keep in mind I'm not really familiar enough with MacOS X to know what versions of what tools are included.

- Neelix
Title: Re: Editors that can save config files directly to the Retrode
Post by: matt on 04/Mar/2012 01:46:13 PM
Good point, I never realised.

I type pico and get nano (2.0.6)
Title: Re: Editors that can save config files directly to the Retrode
Post by: sheepeeh on 28/Aug/2012 06:11:30 PM
What, no Windows editors?!

I've successfully saved the CFG file using Cream/vim in Win7.

http://cream.sourceforge.net/ (http://cream.sourceforge.net/)
Title: Re: Editors that can save config files directly to the Retrode
Post by: Matthias_H on 28/Aug/2012 08:21:43 PM
Windows tends to be slightly less of a pain as far as media swapping and writing is concerned. I have no problems with Windows Notepad and Notepad++ (backup copies disabled) either, under XP Pro SP3.