diff --git a/platform/broadcom/platform-modules-accton.mk b/platform/broadcom/platform-modules-accton.mk index 49be5781c8f0..7b6ae093b8d1 100755 --- a/platform/broadcom/platform-modules-accton.mk +++ b/platform/broadcom/platform-modules-accton.mk @@ -83,4 +83,5 @@ ACCTON_AS5835_54X_PLATFORM_MODULE = sonic-platform-accton-as5835-54x_$(ACCTON_AS $(ACCTON_AS5835_54X_PLATFORM_MODULE)_PLATFORM = x86_64-accton_as5835_54x-r0 $(eval $(call add_extra_package,$(ACCTON_AS7712_32X_PLATFORM_MODULE),$(ACCTON_AS5835_54X_PLATFORM_MODULE))) + SONIC_STRETCH_DEBS += $(ACCTON_AS7712_32X_PLATFORM_MODULE) diff --git a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/classes/thermalutil.py b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/classes/thermalutil.py index 2060bc19d943..c569bf7a5638 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/classes/thermalutil.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/classes/thermalutil.py @@ -74,10 +74,10 @@ class ThermalUtil(object): THERMAL_NUM_4_IDX: ['15', '4b'], } thermal_sysfspath ={ - THERMAL_NUM_1_IDX: ["/sys/bus/i2c/drivers/lm75/15-0048/hwmon/hwmon2/temp1_input"], - THERMAL_NUM_2_IDX: ["/sys/bus/i2c/drivers/lm75/15-0049/hwmon/hwmon3/temp1_input"], - THERMAL_NUM_3_IDX: ["/sys/bus/i2c/drivers/lm75/15-004a/hwmon/hwmon4/temp1_input"], - THERMAL_NUM_4_IDX: ["/sys/bus/i2c/drivers/lm75/15-004b/hwmon/hwmon5/temp1_input"], + THERMAL_NUM_1_IDX: ["/sys/bus/i2c/drivers/lm75/15-0048/hwmon/hwmon*/temp1_input"], + THERMAL_NUM_2_IDX: ["/sys/bus/i2c/drivers/lm75/15-0049/hwmon/hwmon*/temp1_input"], + THERMAL_NUM_3_IDX: ["/sys/bus/i2c/drivers/lm75/15-004a/hwmon/hwmon*/temp1_input"], + THERMAL_NUM_4_IDX: ["/sys/bus/i2c/drivers/lm75/15-004b/hwmon/hwmon*/temp1_input"], THERMAL_NUM_5_IDX: ["/sys/class/hwmon/hwmon0/temp1_input"], } @@ -89,28 +89,25 @@ def _get_thermal_val(self, thermal_num): return None if thermal_num < self.THERMAL_NUM_6_IDX: - device_path = self.get_thermal_to_device_path(thermal_num) - if(os.path.isfile(device_path)): - for filename in glob.glob(device_path): - try: - val_file = open(filename, 'r') - except IOError as e: - logging.error('GET. unable to open file: %s', str(e)) - return None - content = val_file.readline().rstrip() - if content == '': - logging.debug('GET. content is NULL. device_path:%s', device_path) - return None - try: - val_file.close() - except: - logging.debug('GET. unable to close file. device_path:%s', device_path) - return None + device_path = self.get_thermal_to_device_path(thermal_num) + + for filename in glob.glob(device_path): + try: + val_file = open(filename, 'r') + except IOError as e: + logging.error('GET. unable to open file: %s', str(e)) + return None + + content = val_file.readline().rstrip() + if content == '': + logging.debug('GET. content is NULL. device_path:%s', device_path) + return None + try: + val_file.close() + except: + logging.debug('GET. unable to close file. device_path:%s', device_path) + return None return int(content) - - else: - print "No such device_path=%s"%device_path - return 0 else: log_os_system(self.BCM_thermal_cmd,0) @@ -122,8 +119,7 @@ def _get_thermal_val(self, thermal_num): print "Error: unable to open file: %s" % str(e) return 0 file_str = check_file.read() - search_str="average current temperature is" - print "file_str.find=%s"%file_str.find(search_str) + search_str="average current temperature is" str_len = len(search_str) idx=file_str.find(search_str) if idx==-1: @@ -139,7 +135,7 @@ def _get_thermal_val(self, thermal_num): #print "file_str[idx]=%c"%file_str[idx+str_len+2+5] #print "file_str[idx]=%c"%file_str[idx+str_len+2+6] temp_str=file_str[idx+str_len+1] + file_str[idx+str_len+2] + file_str[idx+str_len+3]+file_str[idx+str_len+4] +file_str[idx+str_len+5] - print "bcm temp_str=%s"%temp_str + #print "bcm temp_str=%s"%temp_str check_file.close() return float(temp_str)*1000 diff --git a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/accton_as7326_monitor.py b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/accton_as7326_monitor.py index 1cbcf5b4cf7c..cc022e721e26 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/accton_as7326_monitor.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/accton_as7326_monitor.py @@ -212,21 +212,16 @@ def manage_fans(self): temp_get= (temp2 + temp4)/2 # Use (sensor_LM75_49 + Thermal sensor_LM75_CPU_4B) /2 ori_state=fan_policy_state fan_policy_state=self.get_state_from_fan_policy(temp_get, fan_policy) - print "temp2=%d"%temp2 - print "temp4=%d"%temp4 - print "temp_get=%d"%temp_get - #print "temp4=%d"%temp4 - #print "temp6=%d"%temp6 logging.debug('lm75_48=%d, lm75_49=%d, lm75_4a=%d, lm_4b=%d, cpu=%d, bcm=%d', temp1,temp2,temp3,temp4,temp5,temp6) logging.debug('ori_state=%d, fan_policy_state=%d', ori_state, fan_policy_state) new_pwm = fan_policy_state_pwm_tlb[fan_policy_state][0] if fan_fail==0: - logging.debug('new_pwm=%d', new_pwm) + logging.debug('new_pwm=%d', new_pwm) if fan_fail==0: - if new_pwm!=ori_pwm: - fan.set_fan_duty_cycle(new_pwm) - logging.info('Set fan speed from %d to %d', ori_pwm, new_pwm) + if new_pwm!=ori_pwm: + fan.set_fan_duty_cycle(new_pwm) + logging.info('Set fan speed from %d to %d', ori_pwm, new_pwm) for i in range (fan.FAN_NUM_1_IDX, fan.FAN_NUM_ON_MAIN_BROAD+1): if fan.get_fan_status(i)==0: @@ -337,4 +332,4 @@ def main(argv): if __name__ == '__main__': main(sys.argv[1:]) - \ No newline at end of file + diff --git a/platform/broadcom/sonic-platform-modules-accton/debian/control b/platform/broadcom/sonic-platform-modules-accton/debian/control index e6249a6a2c71..1a36758a0fb9 100755 --- a/platform/broadcom/sonic-platform-modules-accton/debian/control +++ b/platform/broadcom/sonic-platform-modules-accton/debian/control @@ -56,3 +56,4 @@ Description: kernel modules for platform devices such as fan, led, sfp Package: sonic-platform-accton-as5835-54x Architecture: amd64 Description: kernel modules for platform devices such as fan, led, sfp + diff --git a/platform/broadcom/sonic-platform-modules-accton/debian/rules b/platform/broadcom/sonic-platform-modules-accton/debian/rules index 5eecf73139e4..60cec5ab13e5 100755 --- a/platform/broadcom/sonic-platform-modules-accton/debian/rules +++ b/platform/broadcom/sonic-platform-modules-accton/debian/rules @@ -19,7 +19,7 @@ PACKAGE_PRE_NAME := sonic-platform-accton KVERSION ?= $(shell uname -r) KERNEL_SRC := /lib/modules/$(KVERSION) MOD_SRC_DIR:= $(shell pwd) -MODULE_DIRS:= as7712-32x as5712-54x as7816-64x as7716-32x as7716-32xb as7312-54x as7326-56x as6712-32x as7726-32x as4630-54pe minipack as5812-54x as5835-54x +MODULE_DIRS:= as7712-32x as5712-54x as7816-64x as7716-32x as7716-32xb as7312-54x as7326-56x as6712-32x as7726-32x as4630-54pe minipack as5812-54x as5835-54x MODULE_DIR := modules UTILS_DIR := utils SERVICE_DIR := service