]> git.proxmox.com Git - mirror_edk2.git/blob - ShellPkg/Library/UefiShellDriver1CommandsLib/Reconnect.c
ShellPkg: Standardized HP Copyright Message String
[mirror_edk2.git] / ShellPkg / Library / UefiShellDriver1CommandsLib / Reconnect.c
1 /** @file
2 Main file for Reconnect shell Driver1 function.
3
4 (C) Copyright 2015 Hewlett-Packard Development Company, L.P.<BR>
5 Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR>
6 This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
10
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13
14 **/
15
16 #include "UefiShellDriver1CommandsLib.h"
17
18 STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
19 {L"-r", TypeFlag},
20 {NULL, TypeMax}
21 };
22
23 /**
24 Connect all the possible console devices.
25
26 **/
27 VOID
28 ConnectAllConsoles (
29 VOID
30 )
31 {
32 ShellConnectFromDevPaths(L"ConInDev");
33 ShellConnectFromDevPaths(L"ConOutDev");
34 ShellConnectFromDevPaths(L"ErrOutDev");
35
36 ShellConnectFromDevPaths(L"ErrOut");
37 ShellConnectFromDevPaths(L"ConIn");
38 ShellConnectFromDevPaths(L"ConOut");
39 }
40
41
42 /**
43 Function for 'reconnect' command.
44
45 @param[in] ImageHandle Handle to the Image (NULL if Internal).
46 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
47 **/
48 SHELL_STATUS
49 EFIAPI
50 ShellCommandRunReconnect (
51 IN EFI_HANDLE ImageHandle,
52 IN EFI_SYSTEM_TABLE *SystemTable
53 )
54 {
55 SHELL_STATUS ShellStatus;
56 LIST_ENTRY *Package;
57 CHAR16 *ProblemParam;
58 EFI_STATUS Status;
59
60 gInReconnect = TRUE;
61 ShellStatus = SHELL_SUCCESS;
62
63 //
64 // initialize the shell lib (we must be in non-auto-init...)
65 //
66 Status = ShellInitialize();
67 ASSERT_EFI_ERROR(Status);
68
69 Status = CommandInit();
70 ASSERT_EFI_ERROR(Status);
71
72 //
73 // parse the command line
74 //
75 Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE);
76 if (EFI_ERROR(Status)) {
77 if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) {
78 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDriver1HiiHandle, "reconnect", ProblemParam);
79 FreePool(ProblemParam);
80 ShellStatus = SHELL_INVALID_PARAMETER;
81 } else {
82 ASSERT(FALSE);
83 }
84 } else {
85 ShellStatus = ShellCommandRunDisconnect(ImageHandle, SystemTable);
86 if (ShellStatus == SHELL_SUCCESS) {
87 if (ShellCommandLineGetFlag(Package, L"-r")) {
88 ConnectAllConsoles();
89 }
90 ShellStatus = ShellCommandRunConnect(ImageHandle, SystemTable);
91 }
92 }
93
94 gInReconnect = FALSE;
95
96 return (ShellStatus);
97 }
98