diff --git a/nicsensor_v2/nicsensor.sh b/nicsensor_v2/nicsensor.sh index df45386..abbc2ac 100644 --- a/nicsensor_v2/nicsensor.sh +++ b/nicsensor_v2/nicsensor.sh @@ -121,7 +121,7 @@ conf_pre_check parse_slot_name i2c_bus=`connect_i2c` -if [ $? -ne 0 ];then +if [ $i2c_bus -lt 0 ];then $fmt_print "console" "Error" "An Error occured when build i2c connection with ${nic_type} ${slot_id}" exit 1 fi diff --git a/nicsensor_v2/platform_5280m7.sh b/nicsensor_v2/platform_5280m7.sh index a933c59..ec66ce8 100644 --- a/nicsensor_v2/platform_5280m7.sh +++ b/nicsensor_v2/platform_5280m7.sh @@ -15,6 +15,13 @@ pca9548_channel="" is_have_pca9641=0 +# An func to echo a error code and then exit +# @Param1 error code +throw_error(){ + echo $1 + exit 1 +} + record_i2c_status(){ $fmt_print "log" "Info" "[platform_5280m7] Start record i2c configuration" $fmt_print "log" "Info" "Nic Type: $nic_type" @@ -89,7 +96,7 @@ get_pca9641_control(){ if [ "$res_build" != "0x87" ];then $fmt_print "console" "Error" "Cannot establish connection with pca9641 !!!" - exit 1 + throw_error "-1" fi } diff --git a/nicsensor_v2/platform_5688m7.sh b/nicsensor_v2/platform_5688m7.sh index d3be9d9..4f97e52 100644 --- a/nicsensor_v2/platform_5688m7.sh +++ b/nicsensor_v2/platform_5688m7.sh @@ -15,6 +15,13 @@ pca9548_channel="" is_have_pca9641=0 +# An func to echo a error code and then exit +# @Param1 error code +throw_error(){ + echo $1 + exit 1 +} + record_i2c_status(){ $fmt_print "log" "Info" "[platform_5688m7] Start record i2c configuration" $fmt_print "log" "Info" "Nic Type: $nic_type" @@ -83,7 +90,7 @@ get_pca9641_control(){ if [ "$res_build" != "0x87" ];then $fmt_print "console" "Error" "Cannot establish connection with pca9641 !!!" - exit 1 + throw_error "-1" fi }