Skip to content

Commit

Permalink
Log audio devices
Browse files Browse the repository at this point in the history
Parsing the boot-log will help Clover.app finding startup audio settings.
  • Loading branch information
vectorsigma72 committed Dec 28, 2019
1 parent 9c2995d commit 12d559a
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 15 deletions.
24 changes: 21 additions & 3 deletions rEFIt_UEFI/refit/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,16 @@ EFI_HANDLE ConsoleInHandle;
EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL* SimpleTextEx;
EFI_KEY_DATA KeyData;

CHAR8* AudioOutputNames[] = {
"LineOut",
"Speaker",
"Headphones",
"SPDIF",
"Garniture",
"HDMI",
"Other"
};

extern VOID HelpRefit(VOID);
extern VOID AboutRefit(VOID);
extern BOOLEAN BooterPatch(IN UINT8 *BooterData, IN UINT64 BooterSize, LOADER_ENTRY *Entry);
Expand All @@ -101,6 +111,7 @@ extern UINTN DsdtsNum;
extern CHAR16 *DsdtsList[];
extern UINTN AudioNum;
extern HDA_OUTPUTS AudioList[20];
extern CHAR8 *AudioOutputNames[];
extern EFI_AUDIO_IO_PROTOCOL *AudioIo;


Expand Down Expand Up @@ -2485,11 +2496,18 @@ RefitMain (IN EFI_HANDLE ImageHandle,
PutNvramPlistToRtVars();
}
}


// log Audio devices in boot-log. Thisis for clients like Clover.app
GetOutputs();
for (i = 0; i < AudioNum; i++) {
if (AudioList[i].Name) {
// Never change this log, otherwise clients will stop interprete the output.
MsgLog("Found Audio Device %s (%a) at index %d\n", AudioList[i].Name, AudioOutputNames[AudioList[i].Device], i);
}
}

if (!GlobalConfig.FastBoot) {

CHAR16 *TmpArgs;
GetOutputs();
if (gThemeNeedInit) {
InitTheme(TRUE, &Now);
gThemeNeedInit = FALSE;
Expand Down
15 changes: 3 additions & 12 deletions rEFIt_UEFI/refit/menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ extern UINTN DsdtsNum;
extern CHAR16 *DsdtsList[];
extern UINTN AudioNum;
extern HDA_OUTPUTS AudioList[20];
extern CHAR8 *AudioOutputNames[];
extern CHAR8 *NonDetected;
extern BOOLEAN GetLegacyLanAddress;
extern UINT8 gLanMac[4][6]; // their MAC addresses
Expand Down Expand Up @@ -237,16 +238,6 @@ CHAR16* ArgOptional[NUM_OPT] = {
L"nvda_drv=1" //19
};

CHAR8* OutputNames[] = {
"LineOut",
"Speaker",
"Headphones",
"SPDIF",
"Garniture",
"HDMI",
"Other"
};

UINTN RunGenericMenu(IN REFIT_MENU_SCREEN *Screen, IN MENU_STYLE_FUNC StyleFunc, IN OUT INTN *DefaultEntryIndex, OUT REFIT_MENU_ENTRY **ChosenEntry);


Expand Down Expand Up @@ -1298,7 +1289,7 @@ VOID ApplyInputs(VOID)
if (InputItems[i].Valid) {
EFI_DEVICE_PATH_PROTOCOL* DevicePath = NULL;
UINT8 TmpIndex = OldChosenAudio & 0xFF;
DBG("Chosen output %d:%s_%a\n", OldChosenAudio, AudioList[OldChosenAudio].Name, OutputNames[OldChosenAudio]);
DBG("Chosen output %d:%s_%a\n", OldChosenAudio, AudioList[OldChosenAudio].Name, AudioOutputNames[OldChosenAudio]);

DevicePath = DevicePathFromHandle(AudioList[OldChosenAudio].Handle);
if (DevicePath != NULL) {
Expand Down Expand Up @@ -5148,7 +5139,7 @@ REFIT_MENU_ENTRY *SubMenuAudioPort()

for (i = 0; i < AudioNum; i++) {
InputBootArgs = (__typeof__(InputBootArgs))AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG));
InputBootArgs->Entry.Title = PoolPrint(L"%s_%a", AudioList[i].Name, OutputNames[AudioList[i].Device]);
InputBootArgs->Entry.Title = PoolPrint(L"%s_%a", AudioList[i].Name, AudioOutputNames[AudioList[i].Device]);
InputBootArgs->Entry.Tag = TAG_SWITCH;
InputBootArgs->Entry.Row = i;
InputBootArgs->Item = &InputItems[119];
Expand Down

0 comments on commit 12d559a

Please sign in to comment.