Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,30 @@ def show_set_help():
print " use \""+ cmd + " sfp 1-56 {0|1}\" to set sfp# tx_disable"
sys.exit(0)

def dis_i2c_ir3570a(addr):
cmd = "i2cset -y 0 0x%x 0xE5 0x01" % addr
status, output = commands.getstatusoutput(cmd)
cmd = "i2cset -y 0 0x%x 0x12 0x02" % addr
status, output = commands.getstatusoutput(cmd)
return status

def ir3570_check():
cmd = "i2cdump -y 0 0x42 s 0x9a"
try:
status, output = commands.getstatusoutput(cmd)
lines = output.split('\n')
hn = re.findall(r'\w+', lines[-1])
version = int(hn[1], 16)
if version == 0x24: #only for ir3570a
ret = dis_i2c_ir3570a(4)
else:
ret = 0
except Exception as e:
print "Error on ir3570_check() e:" + str(e)
return -1
return ret


def show_eeprom_help():
cmd = sys.argv[0].split("/")[-1]+ " " + args[0]
print " use \""+ cmd + " 1-56 \" to dump sfp# eeprom"
Expand Down Expand Up @@ -359,6 +383,9 @@ def do_install():
return status
else:
print PROJECT_NAME.upper()+" drivers detected...."

ir3570_check()

if not device_exist():
print "No device, installing...."
status = device_install()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,26 +221,26 @@ def show_set_help():
print " use \""+ cmd + " sfp 1-32 {0|1}\" to set sfp# tx_disable"
sys.exit(0)

def diss_i2c_ir3507a(addr):
def dis_i2c_ir3570a(addr):
cmd = "i2cset -y 0 0x%x 0xE5 0x01" % addr
status, output = commands.getstatusoutput(cmd)
cmd = "i2cset -y 0 0x%x 0x12 0x02" % addr
status, output = commands.getstatusoutput(cmd)
return status

def ir3507_check():
def ir3570_check():
cmd = "i2cdump -y 0 0x42 s 0x9a"
try:
status, output = commands.getstatusoutput(cmd)
lines = output.split('\n')
hn = re.findall(r'\w+', lines[-1])
version = int(hn[1], 16)
if version == 0x24: #only for ir3507a
ret = diss_i2c_ir3507a(4)
if version == 0x24: #only for ir3570a
ret = dis_i2c_ir3570a(4)
else:
ret = 0
except Exception as e:
print "Error on ir3507_check() e:" + str(e)
print "Error on ir3570_check() e:" + str(e)
return -1
return ret

Expand Down Expand Up @@ -410,7 +410,7 @@ def do_install():
else:
print PROJECT_NAME.upper()+" drivers detected...."

ir3507_check()
ir3570_check()

if not device_exist():
status = device_install()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,30 @@ def show_eeprom_help():
print " use \""+ cmd + " 1-32 \" to dump sfp# eeprom"
sys.exit(0)

def dis_i2c_ir3570a(addr):
cmd = "i2cset -y 0 0x%x 0xE5 0x01" % addr
status, output = commands.getstatusoutput(cmd)
cmd = "i2cset -y 0 0x%x 0x12 0x02" % addr
status, output = commands.getstatusoutput(cmd)
return status

def ir3570_check():
cmd = "i2cdump -y 0 0x42 s 0x9a"
try:
status, output = commands.getstatusoutput(cmd)
lines = output.split('\n')
hn = re.findall(r'\w+', lines[-1])
version = int(hn[1], 16)
if version == 0x24: #only for ir3570a
ret = dis_i2c_ir3570a(4)
else:
ret = 0
except Exception as e:
print "Error on ir3570_check() e:" + str(e)
return -1
return ret


def my_log(txt):
if DEBUG == True:
print "[ACCTON DBG]: "+txt
Expand Down Expand Up @@ -355,6 +379,9 @@ def do_install():
return status
else:
print PROJECT_NAME.upper()+" drivers detected...."

ir3570_check()

if not device_exist():
status = device_install()
if status:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,26 +124,26 @@ def show_set_help():
print " use \""+ cmd + " sfp 1-64 {0|1}\" to set sfp# tx_disable"
sys.exit(0)

def diss_i2c_ir3507a(addr):
def dis_i2c_ir3570a(addr):
cmd = "i2cset -y 0 0x%x 0xE5 0x01" % addr
status, output = commands.getstatusoutput(cmd)
cmd = "i2cset -y 0 0x%x 0x12 0x02" % addr
status, output = commands.getstatusoutput(cmd)
return status

def ir3507_check():
def ir3570_check():
cmd = "i2cdump -y 0 0x42 s 0x9a"
try:
status, output = commands.getstatusoutput(cmd)
lines = output.split('\n')
hn = re.findall(r'\w+', lines[-1])
version = int(hn[1], 16)
if version == 0x24: #only for ir3507a
ret = diss_i2c_ir3507a(4)
if version == 0x24: #only for ir3570a
ret = dis_i2c_ir3570a(4)
else:
ret = 0
except Exception as e:
print "Error on ir3507_check() e:" + str(e)
print "Error on ir3570_check() e:" + str(e)
return -1
return ret

Expand Down Expand Up @@ -338,7 +338,7 @@ def do_install():
else:
print PROJECT_NAME.upper()+" drivers detected...."

ir3507_check()
ir3570_check()

if not device_exist():
print "No device, installing...."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,30 @@ def show_set_help():
print " use \""+ cmd + " sfp 1-32 {0|1}\" to set sfp# tx_disable"
sys.exit(0)

def dis_i2c_ir3570a(addr):
cmd = "i2cset -y 0 0x%x 0xE5 0x01" % addr
status, output = commands.getstatusoutput(cmd)
cmd = "i2cset -y 0 0x%x 0x12 0x02" % addr
status, output = commands.getstatusoutput(cmd)
return status

def ir3570_check():
cmd = "i2cdump -y 0 0x42 s 0x9a"
try:
status, output = commands.getstatusoutput(cmd)
lines = output.split('\n')
hn = re.findall(r'\w+', lines[-1])
version = int(hn[1], 16)
if version == 0x24: #only for ir3570a
ret = dis_i2c_ir3570a(4)
else:
ret = 0
except Exception as e:
print "Error on ir3570_check() e:" + str(e)
return -1
return ret


def show_eeprom_help():
cmd = sys.argv[0].split("/")[-1]+ " " + args[0]
print " use \""+ cmd + " 1-32 \" to dump sfp# eeprom"
Expand Down Expand Up @@ -352,6 +376,9 @@ def do_install():
return status
else:
print PROJECT_NAME.upper()+" drivers detected...."

ir3570_check()

if not device_exist():
status = device_install()
if status:
Expand Down