Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[platform-device/haliburton] Support xcvr and sensor monitoring #1998

Merged
merged 4 commits into from
Aug 29, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
[device/haliburton] sfputil to support xcvrd monitoring.
  • Loading branch information
pphuchar committed Aug 29, 2018
commit 84a9aa68df2693bec2fb8ef1ee5f67c1556d5a2d
15 changes: 13 additions & 2 deletions device/celestica/x86_64-cel_e1031-r0/plugins/sfputil.py
Original file line number Diff line number Diff line change
@@ -120,5 +120,16 @@ def set_low_power_mode(self, port_num, lpmode):
def reset(self, port_num):
raise NotImplementedError

def get_transceiver_change_event(self):
raise NotImplementedError
def get_transceiver_change_event(self, timeout=0):
modabs_interrupt_path = '/sys/devices/platform/e1031.smc/SFP/modabs_int'
ports_evt = {}
try:
with open(modabs_interrupt_path, 'r') as port_changes:
changes = int(port_changes.read(), 16)
for port_num in self._sfp_port:
change = (changes >> ( port_num - 49)) & 1
if change == 1:
ports_evt[str(port_num)] = str(self.get_presence(port_num))
except IOError:
return False, {}
return True, ports_evt