From 90c8f3c14e4d5cf1ea5fd8181810f07d33af4e9b Mon Sep 17 00:00:00 2001
From: huangguanhua <huangguanhua3@huawei.com>
Date: Thu, 18 May 2023 16:29:28 +0800
Subject: [PATCH 17/18] hikptool-fix-maininfo-detail-info-print-error

Signed-off-by: huangguanhua <huangguanhua3@huawei.com>
---
 serdes/hikp_serdes.c | 12 ++++++++----
 serdes/hikp_serdes.h |  3 ++-
 tool_lib/op_logs.c   |  6 +++---
 3 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/serdes/hikp_serdes.c b/serdes/hikp_serdes.c
index dd9eee3..527fd53 100644
--- a/serdes/hikp_serdes.c
+++ b/serdes/hikp_serdes.c
@@ -184,21 +184,22 @@ static void hikp_serdes_brief_info_print(struct major_cmd_ctrl *self,
 	 "Tap16,Tap17,Tap18,Tap19,Tap20]\n"					\
 	 "FWFourEye: It only takes effect when the firmware is running and "	\
 	 "continuous adaptation is turned on\n"					\
+	 "Snr: [SNR_METRIC,SNR_METRIC_HIS_MIN,SNR_CYCLES,HEH,SNR_METRIC_SW]\n" \
 	 "-----------------------------------------------------"		\
 	 "------------------------------------------------"			\
 	 "-----------------------------------------------------"		\
 	 "------------------------------------------------"			\
-	 "-------------------\n"						\
+	 "--------------------------------\n"						\
 	 "               [       FFE         ]"					\
 	 "[                         CTLE                            ]"		\
 	 "[                                               "			\
 	 "DFE                                              ]"			\
-	 "[     FWFourEye     ][  snr  ]\n"					\
+	 "[     FWFourEye     ][       Snr         ]\n"					\
 	 "-----------------------------------------------------"		\
 	 "-------------------------------------------------"			\
 	 "-----------------------------------------------------"		\
 	 "-------------------------------------------------"			\
-	 "------------------\n")
+	 "--------------------------------\n")
 
 static void hikp_serdes_detail_info_print(struct major_cmd_ctrl *self,
 					  const struct hilink_detail_info *data,
@@ -233,7 +234,10 @@ static void hikp_serdes_detail_info_print(struct major_cmd_ctrl *self,
 		printf("][%4d,%4d,%4d,%4d]",
 		       data[ds_id].eye_diagram.top, data[ds_id].eye_diagram.bottom,
 		       data[ds_id].eye_diagram.left, data[ds_id].eye_diagram.right);
-		printf("[%7d]\n", data[ds_id].snr);
+		/* 0: SNR_METRIC, 1:SNR_METRIC_HIS_MIN */
+		printf("[%3d,%3d,%3d,%3d,%3d]\n", data[ds_id].snr_para[0], data[ds_id].snr_para[1],
+		       /* 2:SNR_CYCLES, 3:HEH, 4:SNR_METRIC_SW */
+		       data[ds_id].snr_para[2], data[ds_id].snr_para[3], data[ds_id].snr_para[4]);
 	}
 }
 
diff --git a/serdes/hikp_serdes.h b/serdes/hikp_serdes.h
index 99b9b15..83c28b8 100644
--- a/serdes/hikp_serdes.h
+++ b/serdes/hikp_serdes.h
@@ -192,7 +192,8 @@ struct hilink_detail_info {
 	struct hilink_rx_param rx_ctle_cfg;
 	struct hilink_serdes_rx_tap rx_tap_cfg;
 	struct hilink_4p_eye_result eye_diagram;
-	uint32_t snr;
+	/* 5: (0: SNR_METRIC, 1:SNR_METRIC_HIS_MIN, 2:SNR_CYCLES, 3:HEH, 4:SNR_METRIC_SW) */
+	int32_t snr_para[5];
 };
 
 struct hilink_brief_info {
diff --git a/tool_lib/op_logs.c b/tool_lib/op_logs.c
index 069428d..d91ddb0 100644
--- a/tool_lib/op_logs.c
+++ b/tool_lib/op_logs.c
@@ -431,7 +431,7 @@ void sig_init(void)
 	(void)signal(SIGHUP,  signal_handle);
 	(void)signal(SIGSEGV, signal_handle);
 	(void)signal(SIGBUS,  signal_handle);
-    (void)signal(SIGFPE,  signal_handle);
-    (void)signal(SIGABRT, signal_handle);
-    (void)signal(SIGTSTP, signal_handle); /* Stop process */
+	(void)signal(SIGFPE,  signal_handle);
+	(void)signal(SIGABRT, signal_handle);
+	(void)signal(SIGTSTP, signal_handle); /* Stop process */
 }
-- 
2.25.1

