Skip to content

Commit db7f173

Browse files
roylee123lguohan
authored andcommitted
[Accton AS7712] Add sfp reset in driver and sfputil.py. (#1241)
Signed-off-by: roylee123 <[email protected]>
1 parent 1c0c3ff commit db7f173

File tree

2 files changed

+27
-7
lines changed

2 files changed

+27
-7
lines changed

device/accton/x86_64-accton_as7712_32x-r0/plugins/sfputil.py

+26-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/usr/bin/env python
22

33
try:
4+
import time
45
from sonic_sfp.sfputilbase import SfpUtilBase
56
except ImportError, e:
67
raise ImportError (str(e) + "- required module not found")
@@ -59,14 +60,33 @@ def __init__(self):
5960
SfpUtilBase.__init__(self)
6061

6162
def reset(self, port_num):
62-
return True
63+
# Check for invalid port_num
64+
if port_num < self._port_start or port_num > self._port_end:
65+
return False
66+
67+
path = "/sys/bus/i2c/devices/{0}-0050/sfp_port_reset"
68+
port_ps = path.format(self.port_to_i2c_mapping[port_num+1])
69+
70+
try:
71+
reg_file = open(port_ps, 'w')
72+
except IOError as e:
73+
print "Error: unable to open file: %s" % str(e)
74+
return False
75+
76+
#toggle reset
77+
reg_file.seek(0)
78+
reg_file.write('1')
79+
time.sleep(1)
80+
reg_file.seek(0)
81+
reg_file.write('0')
82+
reg_file.close()
83+
return True
84+
6385
def set_low_power_mode(self, port_nuM, lpmode):
64-
return True
65-
def get_low_power_mode(self, port_num):
66-
return True
86+
raise NotImplementedErro
6787

68-
# def get_presence(self, port_num):
69-
# return True
88+
def get_low_power_mode(self, port_num):
89+
raise NotImplementedErro
7090

7191
def get_presence(self, port_num):
7292
# Check for invalid port_num

0 commit comments

Comments
 (0)