Moode Forum

Full Version: Include moodecfg.txt on ISO
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
Even better :-)
Problem is that Moode always rewrite dtoverlay at the bottom of the file, so after a modification custom lines will be the first.
With @TookaFace approach the line is replaced and so there would not be a need to rewrite anything after it. Custom lines would be preserved. I'll have to check a few other parts of the code that manipulate config.txt but I think this should work.
Hum it could be a problem if i2s device is set to None, in that case, if you set a new i2s device, the line will be added to the end, but its probably something we can change
IIRC there's a SED that finds a given line and then inserts the new line after it.

Find "dtparam=audio" then insert "dtoverlay=boss-dac-pcm512x-audio" after it. Something like that.
Code:
$result = cfgdb_read('cfg_audiodev', cfgdb_connect(), $i2sDevice);
sysCmd('sed -i "s/dtparam=audio=on/dtparam=audio=off/" ' . '/boot/config.txt');
sysCmd('echo dtoverlay=' . $result[0]['driver'] . ' >> ' . '/boot/config.txt');

If instead of using echo we use sed in the last line:

Code:
sed -i '/dtparam=audio=off/a dtoverlay=test' /boot/config.txt

it will react the way you describe, the dtoverlay line will be added after dtparam=audio=off
Pages: 1 2 3