From 7bc93a08c4f0ca6a610f015af366c7241a0606e0 Mon Sep 17 00:00:00 2001 From: Serge Schneider Date: Tue, 2 Jun 2015 10:46:18 +0100 Subject: [PATCH] Load i2c-dev when i2c is enabled --- raspi-config | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/raspi-config b/raspi-config index 256ed40..d035f5f 100755 --- a/raspi-config +++ b/raspi-config @@ -523,13 +523,19 @@ do_i2c() { RET=$? if [ $RET -eq 0 ]; then 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 modprobe i2c-bcm2708 + modprobe i2c-dev whiptail --msgbox "I2C kernel module will now be loaded by default" 20 60 1 elif [ $RET -eq 1 ]; then sed $BLACKLIST -i -e "s/^#\(blacklist[[:space:]]*i2c[-_]bcm2708\)/\1/" if ! grep -q "^blacklist i2c[-_]bcm2708" $BLACKLIST; then printf "blacklist i2c-bcm2708\n" >> $BLACKLIST fi + sed /etc/modules -i -e "s/^\(i2c[-_]dev\)/#\1/" whiptail --msgbox "I2C kernel module will no longer be loaded by default" 20 60 1 else return 0