From cdcd5ee09933961a3809335cef56e36336e0d19c Mon Sep 17 00:00:00 2001 From: Olivier Matz Date: Fri, 17 May 2013 21:36:42 +0200 Subject: [PATCH] prog_fuse.sh: undefined bits must be set to 1 instead of 0 Signed-off-by: Olivier Matz --- config/prog_fuses.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/config/prog_fuses.sh b/config/prog_fuses.sh index 60bd651..8db5090 100755 --- a/config/prog_fuses.sh +++ b/config/prog_fuses.sh @@ -139,9 +139,9 @@ CANNOT_READ=0 for f in ${FUSE_LIST} do rm -f $f 2> /dev/null - echo 0x00 > ${f}_new - ${AVRDUDE} ${DELAY} -p ${MCU} -P `echo ${AVRDUDE_PORT} | sed 's,",,g'` \ - -c ${AVRDUDE_PROGRAMMER} -U ${f}:r:${f}:i + echo 0xff > ${f}_new # default for each bit is 1 (unprogrammed) + ${AVRDUDE} ${DELAY} -p ${MCU} -P `echo ${AVRDUDE_PORT} | \ + sed 's,",,g'` -c ${AVRDUDE_PROGRAMMER} -U ${f}:r:${f}:i if [ ! -f $f ]; then CANNOT_READ=1 fi @@ -210,10 +210,11 @@ do 1) NEW_VAL=$((1 << $BIT | `cat ${FUSE}_new`)) printf "0x%x\n" ${NEW_VAL} > ${FUSE}_new - # <<$ fix syntax coloration echo " get 1 (unprogrammed)" ;; 0) + NEW_VAL=$((~(1 << $BIT) & `cat ${FUSE}_new`)) + printf "0x%x\n" ${NEW_VAL} > ${FUSE}_new echo " get 0 (programmed)" ;; *) -- 2.39.5