Honggang Li c600aa
diff --git a/small_utils/mlxfwresetlib/mlxfwreset_status_checker.py b/small_utils/mlxfwresetlib/mlxfwreset_status_checker.py
Honggang Li c600aa
index 36b82ff..1d614ac 100755
Honggang Li c600aa
--- a/small_utils/mlxfwresetlib/mlxfwreset_status_checker.py
Honggang Li c600aa
+++ b/small_utils/mlxfwresetlib/mlxfwreset_status_checker.py
Honggang Li c600aa
@@ -1,87 +1,87 @@
Honggang Li c600aa
-#!/usr/bin/python
Honggang Li c600aa
-
Honggang Li c600aa
-# Copyright (c) 2004-2010 Mellanox Technologies LTD. All rights reserved.
Honggang Li c600aa
-#
Honggang Li c600aa
-# This software is available to you under a choice of one of two
Honggang Li c600aa
-# licenses.  You may choose to be licensed under the terms of the GNU
Honggang Li c600aa
-# General Public License (GPL) Version 2, available from the file
Honggang Li c600aa
-# COPYING in the main directory of this source tree, or the
Honggang Li c600aa
-# OpenIB.org BSD license below:
Honggang Li c600aa
-#
Honggang Li c600aa
-#     Redistribution and use in source and binary forms, with or
Honggang Li c600aa
-#     without modification, are permitted provided that the following
Honggang Li c600aa
-#     conditions are met:
Honggang Li c600aa
-#
Honggang Li c600aa
-#      - Redistributions of source code must retain the above
Honggang Li c600aa
-#        copyright notice, this list of conditions and the following
Honggang Li c600aa
-#        disclaimer.
Honggang Li c600aa
-#
Honggang Li c600aa
-#      - Redistributions in binary form must reproduce the above
Honggang Li c600aa
-#        copyright notice, this list of conditions and the following
Honggang Li c600aa
-#        disclaimer in the documentation and/or other materials
Honggang Li c600aa
-#        provided with the distribution.
Honggang Li c600aa
-#
Honggang Li c600aa
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
Honggang Li c600aa
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
Honggang Li c600aa
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
Honggang Li c600aa
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
Honggang Li c600aa
-# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
Honggang Li c600aa
-# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
Honggang Li c600aa
-# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
Honggang Li c600aa
-# SOFTWARE.
Honggang Li c600aa
-#--
Honggang Li c600aa
-
Honggang Li c600aa
-"""
Honggang Li c600aa
-* $Id           : fwreset_status_checker.py 2017-11-28
Honggang Li c600aa
-* $Authors      : Ahmad Soboh (ahmads@mellanox.com)
Honggang Li c600aa
-"""
Honggang Li c600aa
-
Honggang Li c600aa
-######################################################################
Honggang Li c600aa
-# Description:  FirmwareResetStatusChecker
Honggang Li c600aa
-# OS Support :  Linux/Windows.
Honggang Li c600aa
-######################################################################
Honggang Li c600aa
-
Honggang Li c600aa
-
Honggang Li c600aa
-class FirmwareResetStatusChecker(object):
Honggang Li c600aa
-
Honggang Li c600aa
-    FirmwareUptimeStatusInit = 0x0
Honggang Li c600aa
-    FirmwareUptimeStatusBeforeDone = 0x1
Honggang Li c600aa
-    FirmwareUptimeStatusAfterDone = 0x2
Honggang Li c600aa
-    FirmwareUptimeStatusError = 0x3
Honggang Li c600aa
-
Honggang Li c600aa
-    FirmwareResetStatusDone = 0x0
Honggang Li c600aa
-    FirmwareResetStatusFailed = 0x1
Honggang Li c600aa
-    FirmwareResetStatusUnknown = 0x2
Honggang Li c600aa
-
Honggang Li c600aa
-    def __init__(self, regAccessObj):
Honggang Li c600aa
-        self._RegAccessObj = regAccessObj
Honggang Li c600aa
-        self._UptimeBeforeReset = 0x0
Honggang Li c600aa
-        self._UptimeBeforeStatus = FirmwareResetStatusChecker.FirmwareUptimeStatusInit
Honggang Li c600aa
-        self._UptimeAfterReset = 0x0
Honggang Li c600aa
-        self._UptimeAfterStatus = FirmwareResetStatusChecker.FirmwareUptimeStatusInit
Honggang Li c600aa
-
Honggang Li c600aa
-    def UpdateUptimeBeforeReset(self):
Honggang Li c600aa
-        try:
Honggang Li c600aa
-            self._UptimeBeforeReset = self._RegAccessObj.getFWUptime()
Honggang Li c600aa
-            self._UptimeBeforeStatus = FirmwareResetStatusChecker.FirmwareUptimeStatusBeforeDone
Honggang Li c600aa
-        except Exception as e:
Honggang Li c600aa
-            self._UptimeBeforeStatus = FirmwareResetStatusChecker.FirmwareUptimeStatusError
Honggang Li c600aa
-
Honggang Li c600aa
-    def UpdateUptimeAfterReset(self):
Honggang Li c600aa
-        try:
Honggang Li c600aa
-            self._UptimeAfterReset = self._RegAccessObj.getFWUptime()
Honggang Li c600aa
-            self._UptimeAfterStatus = FirmwareResetStatusChecker.FirmwareUptimeStatusAfterDone
Honggang Li c600aa
-        except Exception as e:
Honggang Li c600aa
-            self._UptimeAfterStatus = FirmwareResetStatusChecker.FirmwareUptimeStatusError
Honggang Li c600aa
-
Honggang Li c600aa
-    def GetStatus(self):
Honggang Li c600aa
-        if self._UptimeBeforeStatus == FirmwareResetStatusChecker.FirmwareUptimeStatusBeforeDone and\
Honggang Li c600aa
-                        self._UptimeAfterStatus == FirmwareResetStatusChecker.FirmwareUptimeStatusAfterDone:
Honggang Li c600aa
-            if self._UptimeAfterReset < self._UptimeBeforeReset:
Honggang Li c600aa
-                return FirmwareResetStatusChecker.FirmwareResetStatusDone
Honggang Li c600aa
-            else:
Honggang Li c600aa
-                if self._UptimeBeforeReset > 5: #5 seconds
Honggang Li c600aa
-                    return FirmwareResetStatusChecker.FirmwareResetStatusFailed
Honggang Li c600aa
-                else:
Honggang Li c600aa
-                    return FirmwareResetStatusChecker.FirmwareResetStatusUnknown
Honggang Li c600aa
-        return FirmwareResetStatusChecker.FirmwareResetStatusUnknown
Honggang Li c600aa
\ No newline at end of file
Honggang Li c600aa
+#!/usr/bin/python
Honggang Li c600aa
+
Honggang Li c600aa
+# Copyright (c) 2004-2010 Mellanox Technologies LTD. All rights reserved.
Honggang Li c600aa
+#
Honggang Li c600aa
+# This software is available to you under a choice of one of two
Honggang Li c600aa
+# licenses.  You may choose to be licensed under the terms of the GNU
Honggang Li c600aa
+# General Public License (GPL) Version 2, available from the file
Honggang Li c600aa
+# COPYING in the main directory of this source tree, or the
Honggang Li c600aa
+# OpenIB.org BSD license below:
Honggang Li c600aa
+#
Honggang Li c600aa
+#     Redistribution and use in source and binary forms, with or
Honggang Li c600aa
+#     without modification, are permitted provided that the following
Honggang Li c600aa
+#     conditions are met:
Honggang Li c600aa
+#
Honggang Li c600aa
+#      - Redistributions of source code must retain the above
Honggang Li c600aa
+#        copyright notice, this list of conditions and the following
Honggang Li c600aa
+#        disclaimer.
Honggang Li c600aa
+#
Honggang Li c600aa
+#      - Redistributions in binary form must reproduce the above
Honggang Li c600aa
+#        copyright notice, this list of conditions and the following
Honggang Li c600aa
+#        disclaimer in the documentation and/or other materials
Honggang Li c600aa
+#        provided with the distribution.
Honggang Li c600aa
+#
Honggang Li c600aa
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
Honggang Li c600aa
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
Honggang Li c600aa
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
Honggang Li c600aa
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
Honggang Li c600aa
+# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
Honggang Li c600aa
+# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
Honggang Li c600aa
+# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
Honggang Li c600aa
+# SOFTWARE.
Honggang Li c600aa
+#--
Honggang Li c600aa
+
Honggang Li c600aa
+"""
Honggang Li c600aa
+* $Id           : fwreset_status_checker.py 2017-11-28
Honggang Li c600aa
+* $Authors      : Ahmad Soboh (ahmads@mellanox.com)
Honggang Li c600aa
+"""
Honggang Li c600aa
+
Honggang Li c600aa
+######################################################################
Honggang Li c600aa
+# Description:  FirmwareResetStatusChecker
Honggang Li c600aa
+# OS Support :  Linux/Windows.
Honggang Li c600aa
+######################################################################
Honggang Li c600aa
+
Honggang Li c600aa
+
Honggang Li c600aa
+class FirmwareResetStatusChecker(object):
Honggang Li c600aa
+
Honggang Li c600aa
+    FirmwareUptimeStatusInit = 0x0
Honggang Li c600aa
+    FirmwareUptimeStatusBeforeDone = 0x1
Honggang Li c600aa
+    FirmwareUptimeStatusAfterDone = 0x2
Honggang Li c600aa
+    FirmwareUptimeStatusError = 0x3
Honggang Li c600aa
+
Honggang Li c600aa
+    FirmwareResetStatusDone = 0x0
Honggang Li c600aa
+    FirmwareResetStatusFailed = 0x1
Honggang Li c600aa
+    FirmwareResetStatusUnknown = 0x2
Honggang Li c600aa
+
Honggang Li c600aa
+    def __init__(self, regAccessObj):
Honggang Li c600aa
+        self._RegAccessObj = regAccessObj
Honggang Li c600aa
+        self._UptimeBeforeReset = 0x0
Honggang Li c600aa
+        self._UptimeBeforeStatus = FirmwareResetStatusChecker.FirmwareUptimeStatusInit
Honggang Li c600aa
+        self._UptimeAfterReset = 0x0
Honggang Li c600aa
+        self._UptimeAfterStatus = FirmwareResetStatusChecker.FirmwareUptimeStatusInit
Honggang Li c600aa
+
Honggang Li c600aa
+    def UpdateUptimeBeforeReset(self):
Honggang Li c600aa
+        try:
Honggang Li c600aa
+            self._UptimeBeforeReset = self._RegAccessObj.getFWUptime()
Honggang Li c600aa
+            self._UptimeBeforeStatus = FirmwareResetStatusChecker.FirmwareUptimeStatusBeforeDone
Honggang Li c600aa
+        except Exception as e:
Honggang Li c600aa
+            self._UptimeBeforeStatus = FirmwareResetStatusChecker.FirmwareUptimeStatusError
Honggang Li c600aa
+
Honggang Li c600aa
+    def UpdateUptimeAfterReset(self):
Honggang Li c600aa
+        try:
Honggang Li c600aa
+            self._UptimeAfterReset = self._RegAccessObj.getFWUptime()
Honggang Li c600aa
+            self._UptimeAfterStatus = FirmwareResetStatusChecker.FirmwareUptimeStatusAfterDone
Honggang Li c600aa
+        except Exception as e:
Honggang Li c600aa
+            self._UptimeAfterStatus = FirmwareResetStatusChecker.FirmwareUptimeStatusError
Honggang Li c600aa
+
Honggang Li c600aa
+    def GetStatus(self):
Honggang Li c600aa
+        if self._UptimeBeforeStatus == FirmwareResetStatusChecker.FirmwareUptimeStatusBeforeDone and\
Honggang Li c600aa
+                        self._UptimeAfterStatus == FirmwareResetStatusChecker.FirmwareUptimeStatusAfterDone:
Honggang Li c600aa
+            if self._UptimeAfterReset < self._UptimeBeforeReset:
Honggang Li c600aa
+                return FirmwareResetStatusChecker.FirmwareResetStatusDone
Honggang Li c600aa
+            else:
Honggang Li c600aa
+                if self._UptimeBeforeReset > 5: #5 seconds
Honggang Li c600aa
+                    return FirmwareResetStatusChecker.FirmwareResetStatusFailed
Honggang Li c600aa
+                else:
Honggang Li c600aa
+                    return FirmwareResetStatusChecker.FirmwareResetStatusUnknown
Honggang Li c600aa
+        return FirmwareResetStatusChecker.FirmwareResetStatusUnknown