public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Jarlstrom, Laurie" <laurie.jarlstrom@intel.com>
To: "Carsey, Jaben" <jaben.carsey@intel.com>,
	Rafael Machado <rafaelrodrigues.machado@gmail.com>,
	"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Cc: "Carsey, Jaben" <jaben.carsey@intel.com>
Subject: Re: Improvement at Wiki (EFI_SHELL_INTERFACE)
Date: Mon, 9 Jan 2017 18:22:11 +0000	[thread overview]
Message-ID: <10380531DF222B45964BE3E93EFE5F045D27CA39@fmsmsx104.amr.corp.intel.com> (raw)
In-Reply-To: <CB6E33457884FA40993F35157061515C54B3DE5B@FMSMSX103.amr.corp.intel.com>

Rafael,

You may have been referring to the EFI_SHELL_INTERFACE that is the older protocol from the EFI Shell Interface protocol from EDK (1) shell (no Specification).
If you are using older UEFI Firmware with the EDK 1 Shell not the EDK II Shell 2 then you can use this protocol.

You can check which Shell your app is getting called from by checking which of the protocols it getting used:

Here is a snippet of code to determine :

EFI_STATUS
EFIAPI
UefiMain (
  IN EFI_HANDLE        ImageHandle,
  IN EFI_SYSTEM_TABLE  *SystemTable
  )
{
 EFI_STATUS      Status;
 EFI_SHELL_PARAMETERS_PROTOCOL    *EfiShellParametersProtocol;  // EfiShellParameters.h
 EFI_SHELL_INTERFACE              	  *EfiShellInterface;  // EfiShellInterface.h

 UINTN	   Argc;
 CHAR16	   **Argv;
 EFI_GUID  mEfiShellParametersProtocolGuid = EFI_SHELL_PARAMETERS_PROTOCOL_GUID;  // Current UEFI Shell 2.
 EFI_GUID  mEfiShellInterfaceGuid = SHELL_INTERFACE_PROTOCOL_GUID;			// Older EDK Shell 1

 
 //Initialize local protocol pointers
  EfiShellParametersProtocol = NULL;
  EfiShellInterface = NULL;

  // check input parameters from command line using UEFI Shell 2.0
 Status = gBS->OpenProtocol(ImageHandle,
            &mEfiShellParametersProtocolGuid,
            (VOID **)&EfiShellParametersProtocol,
            ImageHandle,
            NULL,
            EFI_OPEN_PROTOCOL_GET_PROTOCOL
            ); 
 if (!EFI_ERROR(Status)) {
  // use shell 2.0 interface
	  Print(L"Using UEFI Shell 2.0 Parameter Protocol\n"); 
      Argc = EfiShellParametersProtocol->Argc;
      Argv = EfiShellParametersProtocol->Argv;
    // Call our main with Argc / Argv parameters 
      SampleMain ( Argc, Argv);  // TODO what you need to do for using UEFI Shell 2
 }else{ // else check if EFI Shell 1.0 
      Status = gBS->OpenProtocol(ImageHandle,
                  &mEfiShellInterfaceGuid,
                  (VOID **)&EfiShellInterface,
                  ImageHandle,
                  NULL,
                  EFI_OPEN_PROTOCOL_GET_PROTOCOL
                  );
	     if (!EFI_ERROR(Status)) 
		{
			Print(L"Using EFI Shell 1.0 Interface Protocol\n"); 
			Argc = EfiShellInterface->Argc;
			Argv = EfiShellInterface->Argv;
			SampleMain ( Argc, Argv);   // TODO What you need to do to use EFI Shell 1.0 
	     }else {
		      Print(L"\nGetting Shell params did NOT work: \n");
	     }
 }

  
	return EFI_SUCCESS;
}



thanks,
Laurie
 
laurie.jarlstrom@intel.com

Intel SSG/STO/EBP
(503) 712-9395


-----Original Message-----
From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Carsey, Jaben
Sent: Monday, January 09, 2017 7:44 AM
To: Rafael Machado; edk2-devel@lists.01.org
Cc: Carsey, Jaben
Subject: Re: [edk2] Improvement at Wiki (EFI_SHELL_INTERFACE)

Rafael,

Actually it's the opposite.  EFI_SHELL_INTERFACE is the older and deprecated protocol.  I do not know of any active development using that protocol.

-Jaben

> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of 
> Rafael Machado
> Sent: Saturday, January 7, 2017 1:14 PM
> To: edk2-devel@lists.01.org
> Subject: [edk2] Improvement at Wiki (EFI_SHELL_INTERFACE)
> Importance: High
> 
> Hi everyone
> 
> During a a development I faced the following wiki information at 
> tianocore's
> github:
> 
> https://github.com/tianocore/tianocore.github.io/wiki/Creating-a-Shell
> -
> Application#Using_EFI_SHELL_PROTOCOL
> 
> I remember a case when I was working with a system that didn't have a 
> instance of the EFI_SHELL_PARAMETERS_PROTOCOL, and the solution was to 
> use the EFI_SHELL_INTERFACE protocol, that seems to be a newer 
> protocol to be used when doing something like what the wiki presents.
> 
> I believe it would be nice to update this wiki adding this information.
> 
> Thanks and Regards
> Rafael R. Machado
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


      reply	other threads:[~2017-01-09 18:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-07 21:13 Improvement at Wiki (EFI_SHELL_INTERFACE) Rafael Machado
2017-01-09 15:44 ` Carsey, Jaben
2017-01-09 18:22   ` Jarlstrom, Laurie [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=10380531DF222B45964BE3E93EFE5F045D27CA39@fmsmsx104.amr.corp.intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox