01-29-2021, 01:39 AM
01-29-2021, 11:35 AM
Problem is that Moode always rewrite dtoverlay at the bottom of the file, so after a modification custom lines will be the first.
01-29-2021, 12:28 PM
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.
01-29-2021, 12:32 PM
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
01-29-2021, 12:42 PM
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.
Find "dtparam=audio" then insert "dtoverlay=boss-dac-pcm512x-audio" after it. Something like that.
01-29-2021, 12:58 PM
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