Skip to content

Commit 83bf8ce

Browse files
committed
device\celestica\x86_64-cel_redstone_xp-r0\sonic_platform\psu.py: Changed use of the Fan class for the PSU fans.
device\celestica\x86_64-cel_redstone_xp-r0\sonic_platform\fan.py: Changed the logic to calculate if the fan is part of a PSU.
1 parent f9af481 commit 83bf8ce

File tree

2 files changed

+4
-4
lines changed
  • device/celestica/x86_64-cel_redstone_xp-r0/sonic_platform

2 files changed

+4
-4
lines changed

device/celestica/x86_64-cel_redstone_xp-r0/sonic_platform/fan.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,14 @@
4444
class Fan(FanBase):
4545
"""Platform-specific Fan class"""
4646

47-
def __init__(self, fan_tray_index, fan_index=0, is_psu_fan=False, psu_index=0):
47+
def __init__(self, fan_tray_index, fan_index=0):
4848
FanBase.__init__(self)
4949
self.fan_index = fan_index
5050
self._api_helper = APIHelper()
5151
self.fan_tray_index = fan_tray_index
52-
self.is_psu_fan = is_psu_fan
52+
self.is_psu_fan = fan_tray_index >= 4
5353
if self.is_psu_fan:
54-
self.psu_index = psu_index
54+
self.psu_index = fan_tray_index - 4
5555
self.psu_i2c_num = PSU_I2C_MAPPING[self.psu_index]["num"]
5656
self.psu_i2c_addr = PSU_I2C_MAPPING[self.psu_index]["addr"]
5757
self.psu_hwmon_path = PSU_HWMON_PATH.format(

device/celestica/x86_64-cel_redstone_xp-r0/sonic_platform/psu.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def __init__(self, psu_index):
4545
self.hwmon_path = self._api_helper.get_hwmon_path(i2c_adapter, i2c_address)
4646
self.eeprom_path = "/sys/bus/i2c/devices/{}-00{}/eeprom".format(i2c_adapter, i2c_eeprom)
4747

48-
self._fan_list.append(Fan(0, 0, is_psu_fan=True, psu_index=self.index))
48+
self._fan_list.append(Fan(self.index + 4, 0))
4949

5050
@property
5151
def presence(self):

0 commit comments

Comments
 (0)