Skip to content

Commit 12d559a

Browse files
committed
Log audio devices
Parsing the boot-log will help Clover.app finding startup audio settings.
1 parent 9c2995d commit 12d559a

File tree

2 files changed

+24
-15
lines changed

2 files changed

+24
-15
lines changed

rEFIt_UEFI/refit/main.c

+21-3
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,16 @@ EFI_HANDLE ConsoleInHandle;
8989
EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL* SimpleTextEx;
9090
EFI_KEY_DATA KeyData;
9191

92+
CHAR8* AudioOutputNames[] = {
93+
"LineOut",
94+
"Speaker",
95+
"Headphones",
96+
"SPDIF",
97+
"Garniture",
98+
"HDMI",
99+
"Other"
100+
};
101+
92102
extern VOID HelpRefit(VOID);
93103
extern VOID AboutRefit(VOID);
94104
extern BOOLEAN BooterPatch(IN UINT8 *BooterData, IN UINT64 BooterSize, LOADER_ENTRY *Entry);
@@ -101,6 +111,7 @@ extern UINTN DsdtsNum;
101111
extern CHAR16 *DsdtsList[];
102112
extern UINTN AudioNum;
103113
extern HDA_OUTPUTS AudioList[20];
114+
extern CHAR8 *AudioOutputNames[];
104115
extern EFI_AUDIO_IO_PROTOCOL *AudioIo;
105116

106117

@@ -2485,11 +2496,18 @@ RefitMain (IN EFI_HANDLE ImageHandle,
24852496
PutNvramPlistToRtVars();
24862497
}
24872498
}
2488-
2499+
2500+
// log Audio devices in boot-log. Thisis for clients like Clover.app
2501+
GetOutputs();
2502+
for (i = 0; i < AudioNum; i++) {
2503+
if (AudioList[i].Name) {
2504+
// Never change this log, otherwise clients will stop interprete the output.
2505+
MsgLog("Found Audio Device %s (%a) at index %d\n", AudioList[i].Name, AudioOutputNames[AudioList[i].Device], i);
2506+
}
2507+
}
2508+
24892509
if (!GlobalConfig.FastBoot) {
2490-
24912510
CHAR16 *TmpArgs;
2492-
GetOutputs();
24932511
if (gThemeNeedInit) {
24942512
InitTheme(TRUE, &Now);
24952513
gThemeNeedInit = FALSE;

rEFIt_UEFI/refit/menu.c

+3-12
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ extern UINTN DsdtsNum;
7474
extern CHAR16 *DsdtsList[];
7575
extern UINTN AudioNum;
7676
extern HDA_OUTPUTS AudioList[20];
77+
extern CHAR8 *AudioOutputNames[];
7778
extern CHAR8 *NonDetected;
7879
extern BOOLEAN GetLegacyLanAddress;
7980
extern UINT8 gLanMac[4][6]; // their MAC addresses
@@ -237,16 +238,6 @@ CHAR16* ArgOptional[NUM_OPT] = {
237238
L"nvda_drv=1" //19
238239
};
239240

240-
CHAR8* OutputNames[] = {
241-
"LineOut",
242-
"Speaker",
243-
"Headphones",
244-
"SPDIF",
245-
"Garniture",
246-
"HDMI",
247-
"Other"
248-
};
249-
250241
UINTN RunGenericMenu(IN REFIT_MENU_SCREEN *Screen, IN MENU_STYLE_FUNC StyleFunc, IN OUT INTN *DefaultEntryIndex, OUT REFIT_MENU_ENTRY **ChosenEntry);
251242

252243

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

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

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

0 commit comments

Comments
 (0)