]> code.delx.au - refind/commitdiff
CD-eject feature & fix for GRUB 2 problems
authorsrs5694 <srs5694@users.sourceforge.net>
Sat, 19 May 2012 04:50:39 +0000 (00:50 -0400)
committersrs5694 <srs5694@users.sourceforge.net>
Sat, 19 May 2012 04:50:39 +0000 (00:50 -0400)
Make.common
Makefile
NEWS.txt
refind/lib.c
refind/lib.h
refind/main.c
refind/menu.c
refind/menu.h

index 5661e3d0f1274000a2c76933971c6e0bf358c0d4..89fd914e762405220a05ba5bbb52759ea7ed99a3 100644 (file)
@@ -74,6 +74,7 @@ endif
 LDFLAGS        += -T $(LDSCRIPT) -shared -Bsymbolic -L$(EFILIB) -L$(GNUEFILIB) $(CRTOBJS)
 LIBS            = -lefi -lgnuefi $(shell $(CC) $(ARCH3264) -print-libgcc-file-name)
 FORMAT          = efi-app-$(ARCH)
+FORMAT_DRIVER   = efi-bsdrv-$ARCH)
 
 
 # general rules
index e6f6ca0688c87c909919f693313f731c2cade396..9b6ee1079c8bc5696343e0f493dbd9ec853b011c 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -7,16 +7,22 @@ SRCS=$(NAMES:=.c)
 OBJS=$(NAMES:=.o)
 HEADERS=$(NAMES:=.h)
 LOADER_DIR=refind
+FS_DIR=filesystems
 LIB_DIR=libeg
 
 # Build the Symbiote library itself.
 all:
        make -C $(LIB_DIR)
        make -C $(LOADER_DIR)
+#      make -C $(FS_DIR)
+
+filesystems:
+       make -C $(FS_DIR)
 
 clean:
        make -C $(LIB_DIR) clean
        make -C $(LOADER_DIR) clean
+#      make -C $(FS_DIR) clean
 
 # NOTE TO DISTRIBUTION MAINTAINERS:
 # The "install" target installs the program directly to the ESP
index 0e192ec16a89efd0e99cf90bbdc240a1d06c9f30..b1334020cda2fc7c5a40308e1ba1bf9288ea51f7 100644 (file)
--- a/NEWS.txt
+++ b/NEWS.txt
@@ -1,3 +1,12 @@
+0.3.6 (?/??/2012):
+------------------
+
+- Added new feature to eject CDs (and other removable media): Press F12
+  to eject all such media.
+
+- Fixed a problem that could cause GRUB 2 to fail to read its configuration
+  file when launched from rEFInd.
+
 0.3.5 (5/15/2012):
 ------------------
 
index 1370e2b6141449574070132c5ec076c8bdaa589e..2735fea54172624867e037100c740f4cce020ffd 100644 (file)
@@ -47,6 +47,7 @@
 #include "icns.h"
 #include "screen.h"
 #include "refit_call_wrapper.h"
+#include "RemovableMedia.h"
 
 // variables
 
@@ -1276,3 +1277,27 @@ CHAR16 *FindCommaDelimited(IN CHAR16 *InString, IN UINTN Index) {
    } // if
    return (FoundString);
 } // CHAR16 *FindCommaDelimited()
+
+
+static EFI_GUID AppleRemovableMediaGuid = APPLE_REMOVABLE_MEDIA_PROTOCOL_GUID;
+
+// Eject all removable media
+VOID EjectMedia(VOID) {
+   EFI_STATUS                      Status;
+   UINTN                           HandleIndex, HandleCount = 0;
+   EFI_HANDLE                      *Handles, Handle;
+   APPLE_REMOVABLE_MEDIA_PROTOCOL  *Ejectable;
+
+   Status = LibLocateHandle(ByProtocol, &AppleRemovableMediaGuid, NULL, &HandleCount, &Handles);
+   if (EFI_ERROR(Status) || HandleCount == 0)
+      return; // probably not an Apple system
+
+   for (HandleIndex = 0; HandleIndex < HandleCount; HandleIndex++) {
+      Handle = Handles[HandleIndex];
+      Status = refit_call3_wrapper(BS->HandleProtocol, Handle, &AppleRemovableMediaGuid, (VOID **) &Ejectable);
+      if (EFI_ERROR(Status))
+         continue;
+      Status = refit_call1_wrapper(Ejectable->Eject, Ejectable);
+   }
+   FreePool(Handles);
+} // VOID EjectMedia()
index 1cba88a4481d550e2a13b1ad1fc49402e152f642..d502f8a9c24fe86f13eecdbc56aeaecad8d261a6 100644 (file)
@@ -105,4 +105,6 @@ CHAR16 *FindPath(IN CHAR16* FullPath);
 CHAR16 *FindNumbers(IN CHAR16 *InString);
 CHAR16 *FindCommaDelimited(IN CHAR16 *InString, IN UINTN Index);
 
+VOID EjectMedia(VOID);
+
 #endif
\ No newline at end of file
index 1f574383154a95e6c3b2fd6f121bc81d07f2b518..f619bec592fc4225bf59bec466566da68d1e7951 100644 (file)
@@ -104,7 +104,7 @@ static VOID AboutrEFInd(VOID)
 {
     if (AboutMenu.EntryCount == 0) {
         AboutMenu.TitleImage = BuiltinIcon(BUILTIN_ICON_FUNC_ABOUT);
-        AddMenuInfoLine(&AboutMenu, L"rEFInd Version 0.3.5");
+        AddMenuInfoLine(&AboutMenu, L"rEFInd Version 0.3.5.1");
         AddMenuInfoLine(&AboutMenu, L"");
         AddMenuInfoLine(&AboutMenu, L"Copyright (c) 2006-2010 Christoph Pfisterer");
         AddMenuInfoLine(&AboutMenu, L"Copyright (c) 2012 Roderick W. Smith");
@@ -701,7 +701,13 @@ LOADER_ENTRY * AddLoaderEntry(IN CHAR16 *LoaderPath, IN CHAR16 *LoaderTitle, IN
       Entry->me.Title = PoolPrint(L"Boot %s from %s", (LoaderTitle != NULL) ? LoaderTitle : LoaderPath, Volume->VolName);
       Entry->me.Row = 0;
       Entry->me.BadgeImage = Volume->VolBadgeImage;
-      Entry->LoaderPath = StrDuplicate(LoaderPath);
+      if ((LoaderPath != NULL) && (LoaderPath[0] != L'\\')) {
+         Entry->LoaderPath = StrDuplicate(L"\\");
+      } else {
+         Entry->LoaderPath = NULL;
+      }
+      MergeStrings(&(Entry->LoaderPath), LoaderPath, 0);
+//      Entry->LoaderPath = StrDuplicate(LoaderPath);
       Entry->VolName = Volume->VolName;
       Entry->DevicePath = FileDevicePath(Volume->DeviceHandle, Entry->LoaderPath);
       SetLoaderDefaults(Entry, LoaderPath, Volume);
@@ -1393,18 +1399,6 @@ static VOID ScanForBootloaders(VOID) {
    UINTN i;
 
    ScanVolumes();
-   // Commented-out below: Was part of an attempt to get rEFInd to
-   // re-scan disk devices on pressing Esc; but doesn't work (yet), so
-   // removed....
-//     MainMenu.Title = StrDuplicate(L"Main Menu 2");
-//     MainMenu.TitleImage = NULL;
-//     MainMenu.InfoLineCount = 0;
-//     MainMenu.InfoLines = NULL;
-//     MainMenu.EntryCount = 0;
-//     MainMenu.Entries = NULL;
-//     MainMenu.TimeoutSeconds = 20;
-//     MainMenu.TimeoutText = StrDuplicate(L"Automatic boot");
-   //    DebugPause();
 
    // scan for loaders and tools, add them to the menu
    for (i = 0; i < NUM_SCAN_OPTIONS; i++) {
index 4b2b5fb5fdced9f7c4d272f72cf6c27dcfe706cf..1ed2aa9999220e43db473d95c60dde9903aca39e 100644 (file)
@@ -461,6 +461,9 @@ static UINTN RunGenericMenu(IN REFIT_MENU_SCREEN *Screen, IN MENU_STYLE_FUNC Sty
             case SCAN_F10:
                 egScreenShot();
                 break;
+                       case 0x0016: // F12
+                               EjectMedia();
+                               break;
         }
         switch (key.UnicodeChar) {
             case CHAR_LINEFEED:
index be906a9af0a4cdcb83e74f6ad85ee76ba3d2ff5d..f9052d17d7ab331bec30ceac03a4629651f88cfb 100644 (file)
@@ -58,6 +58,7 @@
 #define MENU_EXIT_ESCAPE  (2)
 #define MENU_EXIT_DETAILS (3)
 #define MENU_EXIT_TIMEOUT (4)
+#define MENU_EXIT_EJECT   (5)
 
 #define TAG_RETURN       (99)