mirror of
				https://github.com/brain-hackers/brain-config.git
				synced 2025-10-31 04:28:40 +09:00 
			
		
		
		
	dtparam used instead of modprobe for SPI and I2C.
This commit is contained in:
		
							
								
								
									
										59
									
								
								raspi-config
									
									
									
									
									
								
							
							
						
						
									
										59
									
								
								raspi-config
									
									
									
									
									
								
							| @@ -607,29 +607,8 @@ do_spi() { | |||||||
|     touch $BLACKLIST |     touch $BLACKLIST | ||||||
|   fi |   fi | ||||||
|  |  | ||||||
|   if [ "$INTERACTIVE" = True ]; then |   sed $BLACKLIST -i -e "s/^\(blacklist[[:space:]]*spi[-_]bcm2708\)/#\1/" | ||||||
|     whiptail --yesno "Would you like the SPI kernel module to be loaded by default?" $DEFAULT 20 60 2 |   sudo dtparam spi=on | ||||||
|     RET=$? |  | ||||||
|   else |  | ||||||
|     RET=$1 |  | ||||||
|   fi |  | ||||||
|   if [ $RET -eq 0 ]; then |  | ||||||
|     sed $BLACKLIST -i -e "s/^\(blacklist[[:space:]]*spi[-_]bcm2708\)/#\1/" |  | ||||||
|     modprobe spi-bcm2708 |  | ||||||
|     if [ "$INTERACTIVE" = True ]; then |  | ||||||
|       whiptail --msgbox "SPI kernel module will now be loaded by default" 20 60 1 |  | ||||||
|     fi |  | ||||||
|   elif [ $RET -eq 1 ]; then |  | ||||||
|     sed $BLACKLIST -i -e "s/^#\(blacklist[[:space:]]*spi[-_]bcm2708\)/\1/" |  | ||||||
|     if ! grep -q "^blacklist spi[-_]bcm2708" $BLACKLIST; then |  | ||||||
|       printf "blacklist spi-bcm2708\n" >> $BLACKLIST |  | ||||||
|     fi |  | ||||||
|     if [ "$INTERACTIVE" = True ]; then |  | ||||||
|       whiptail --msgbox "SPI kernel module will no longer be loaded by default" 20 60 1 |  | ||||||
|     fi |  | ||||||
|   else |  | ||||||
|     return 0 |  | ||||||
|   fi |  | ||||||
| } | } | ||||||
|  |  | ||||||
| do_i2c() { | do_i2c() { | ||||||
| @@ -692,35 +671,13 @@ do_i2c() { | |||||||
|     touch $BLACKLIST |     touch $BLACKLIST | ||||||
|   fi |   fi | ||||||
|  |  | ||||||
|   if [ "$INTERACTIVE" = True ]; then |   sed $BLACKLIST -i -e "s/^\(blacklist[[:space:]]*i2c[-_]bcm2708\)/#\1/" | ||||||
|     whiptail --yesno "Would you like the I2C kernel module to be loaded by default?" $DEFAULT 20 60 2 |   sed /etc/modules -i -e "s/^#[[:space:]]*\(i2c[-_]dev\)/\1/" | ||||||
|     RET=$? |   if ! grep -q "^i2c[-_]dev" /etc/modules; then | ||||||
|   else |     printf "i2c-dev\n" >> /etc/modules | ||||||
|     RET=$1 |  | ||||||
|   fi |  | ||||||
|   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 |  | ||||||
|     if [ "$INTERACTIVE" = True ]; then |  | ||||||
|       whiptail --msgbox "I2C kernel module will now be loaded by default" 20 60 1 |  | ||||||
|     fi |  | ||||||
|   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/" |  | ||||||
|     if [ "$INTERACTIVE" = True ]; then |  | ||||||
|       whiptail --msgbox "I2C kernel module will no longer be loaded by default" 20 60 1 |  | ||||||
|     fi |  | ||||||
|   else |  | ||||||
|     return 0 |  | ||||||
|   fi |   fi | ||||||
|  |   sudo dtparam i2c_arm=on | ||||||
|  |   modprobe i2c-dev | ||||||
| } | } | ||||||
|  |  | ||||||
| do_serial() { | do_serial() { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 spl
					spl