Thank you for your donation!


Cloudsmith graciously provides open-source package management and distribution for our project.


[split] Maintaining config.txt
#6
Below is i2c section of raspi-config script. It looks like its doing the following:

1. Adding "dtparam=i2c_arm=on" to /boot/config.txt
2. Adding "i2c-dev' to /etc/modules
3. Manually loading i2c-dev module via "modprobe i2c-dev"

moOde already includes "dtparam=i2c_arm=on" in /boot/config.txt so if I add "i2c-dev' to /etc/modules" as the default it will get loaded automatically at boot by Linux. 

There wouldn't be a need to use raspi-config at this point correct?
What is SPI used for?

Code:
do_i2c() {
 DEFAULT=--defaultno
 if [ $(get_i2c) -eq 0 ]; then
   DEFAULT=
 fi
 if [ "$INTERACTIVE" = True ]; then
   whiptail --yesno "Would you like the ARM I2C interface to be enabled?" $DEFAULT 20 60 2
   RET=$?
 else
   RET=$1
 fi
 if [ $RET -eq 0 ]; then
   SETTING=on
   STATUS=enabled
 elif [ $RET -eq 1 ]; then
   SETTING=off
   STATUS=disabled
 else
   return $RET
 fi

 set_config_var dtparam=i2c_arm $SETTING $CONFIG &&
 if ! [ -e $BLACKLIST ]; then
   touch $BLACKLIST
 fi
 sed $BLACKLIST -i -e "s/^\(blacklist[[:space:]]*i2c[-_]bcm2708\)/#\1/"
 sed /etc/modules -i -e "s/^#[[:space:]]*\(i2c[-_]dev\)/\1/"
 if ! grep -q "^i2c[-_]dev" /etc/modules; then
   printf "i2c-dev\n" >> /etc/modules
 fi
 dtparam i2c_arm=$SETTING
 modprobe i2c-dev

 if [ "$INTERACTIVE" = True ]; then
   whiptail --msgbox "The ARM I2C interface is $STATUS" 20 60 1
 fi
}
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply


Messages In This Thread
[split] Maintaining config.txt - by adrii - 05-28-2021, 05:09 PM
RE: [split] Maintaining config.txt - by adrii - 05-31-2021, 02:29 PM
RE: [split] Maintaining config.txt - by adrii - 05-31-2021, 04:24 PM
RE: Official moOde 7.2.1 support thread - by Tim Curtis - 05-29-2021, 01:35 PM

Forum Jump: