Merge pull request #2243 from balena-os/config-txt-patch-default-dtparam-handling

Patch default dtparam handling in config.txt
This commit is contained in:
flowzone-app[bot] 2024-02-21 21:02:18 +00:00 committed by GitHub
commit b1bb7934b0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 29 additions and 3 deletions

View File

@ -40,7 +40,19 @@ function isBaseParam(dtparam: string): boolean {
// These hardcoded params correspond to the params set
// in the default config.txt provided by balena for pi devices
if (['audio', 'i2c_arm', 'spi'].includes(key)) {
// See: https://www.raspberrypi.com/documentation/computers/configuration.html#part3.3
if (
[
'audio',
'spi',
'i2c',
'i2c_arm',
'i2c_vc',
'i2c_baudrate',
'i2c_arm_baudrate',
'i2c_vc_baudrate',
].includes(key)
) {
return true;
}
return false;

View File

@ -89,10 +89,15 @@ describe('config/config-txt', () => {
dtparam=gpio_out_pin=17
enable_uart=1
avoid_warnings=1
dtparam=i2c_arm=on
dtparam=spi=on
dtparam=audio=on
dtparam=i2c=on
dtparam=i2c_arm=on
dtparam=i2c_vc=on
dtparam=i2c_baudrate=100000
dtparam=i2c_arm_baudrate=100000
dtoverlay=ads7846
dtparam=i2c_vc_baudrate=100000
gpu_mem=16
hdmi_force_hotplug:1=1
`,
@ -102,7 +107,16 @@ describe('config/config-txt', () => {
// Will try to parse /test/data/mnt/boot/config.txt
await expect(configTxt.getBootConfig()).to.eventually.deep.equal({
dtparam: ['i2c_arm=on', 'spi=on', 'audio=on'],
dtparam: [
'spi=on',
'audio=on',
'i2c=on',
'i2c_arm=on',
'i2c_vc=on',
'i2c_baudrate=100000',
'i2c_arm_baudrate=100000',
'i2c_vc_baudrate=100000',
],
dtoverlay: [
'lirc-rpi,gpio_out_pin=17,gpio_in_pin=13,gpio_out_pin=17',
'ads7846',