ShellPkg: decode serial console attribute set failure status when used thru sermode...
authorTapan Shah <tapandshah@hp.com>
Tue, 14 Jul 2015 17:54:12 +0000 (17:54 +0000)
committerjcarsey <jcarsey@Edk2>
Tue, 14 Jul 2015 17:54:12 +0000 (17:54 +0000)
Serial console driver may not support all databits / stopbits attribute values.
But ‘sermode’ command only displays a general error indicating operation failure.
Instead it should decode error status and report more accurate error message.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Tapan Shah <tapandshah@hp.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17978 6f19259b-4bc3-4df7-8a09-765794883524

ShellPkg/Library/UefiShellDebug1CommandsLib/SerMode.c
ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.uni

index 448e5cc..d885677 100644 (file)
@@ -337,8 +337,16 @@ ShellCommandRunSerMode (
                               StopBits\r
                              );\r
           if (EFI_ERROR (Status)) {\r
-            ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SERMODE_SET_FAIL), gShellDebug1HiiHandle, L"sermode", ConvertHandleToHandleIndex(Handles[Index]));  \r
-            ShellStatus = SHELL_ACCESS_DENIED;\r
+            if (Status == EFI_INVALID_PARAMETER) {\r
+              ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SERMODE_SET_UNSUPPORTED), gShellDebug1HiiHandle, L"sermode", ConvertHandleToHandleIndex(Handles[Index]));  \r
+              ShellStatus = SHELL_UNSUPPORTED;\r
+            } else if (Status == EFI_DEVICE_ERROR) {\r
+              ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SERMODE_SET_DEV_ERROR), gShellDebug1HiiHandle, L"sermode", ConvertHandleToHandleIndex(Handles[Index]));  \r
+              ShellStatus = SHELL_ACCESS_DENIED;\r
+            } else {\r
+              ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SERMODE_SET_FAIL), gShellDebug1HiiHandle, L"sermode", ConvertHandleToHandleIndex(Handles[Index]));  \r
+              ShellStatus = SHELL_ACCESS_DENIED;\r
+            }\r
           } else {\r
             ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SERMODE_SET_HANDLE), gShellDebug1HiiHandle, ConvertHandleToHandleIndex(Handles[Index]));\r
           }\r
index 9180281..167cacc 100644 (file)
Binary files a/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.uni and b/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.uni differ