acidanthera / bugtracker

Acidanthera Bugtracker
385 stars 45 forks source link

Potential Incompatibility between newer HP Touchscreen Laptops and KeySupport #1354

Closed HansKeksnascher closed 3 years ago

HansKeksnascher commented 3 years ago

Hello there,

a bug exists in the UEFI firmware implementations of certain HP Premium Laptops with touchscreen (manufactured after 2017?) which causes the firmware to think, when you boot an .efi file from the internal storage, that the file is a diagnostic tool. Then it offers a touchscreen keyboard for the user. (see attached screenshot)

This bug prevents the macOS kernel from booting from internal storage, external one work fine. It just freezes at #[EB|LOG:EXITBS:START]

When Clover was used, the workaround was to grab PreLoader.efi from efitools and rename the CloverX64.efi to Loader.efi, so the bootchain was PreLoader.efi -> Loader.efi and the touchscreen keyboard was gone in the Clover menu.

When using OpenCore this workaround does nothing. Touchscreen keyboard is still here.

After some research I discovered, that setting UEFI -> Input -> KeySupport to False fixed my problem, the touchscreen keyboard was gone and I was able to boot. But the new problem was, that OpenCore doesn't recognize any keyboard input and my trackpad, which is connected via SMBUS, stopped working in macOS. I also tried using OpenUsbKbDxe.efi, Ps2KeyboardDxe.efi, Ps2MouseDxe.efi and UsbMouseDxe.efi without any success. I also played around with the UEFI -> Input -> KeySupportMode setting, but it also changed nothing.

Some more ressources regarding this problem:

My device is a HP Spectre x360 - 13-ae001ng (Intel Core i5-8250U Kaby Lake Refresh with Intel UHD Graphics 620). The used OpenCore version was 0.6.4.

Let me know if you need any additional information and thanks for your fantastic work.

freeze

vit9696 commented 3 years ago

Using ExitBootServicesDelay does not fix your issue? Could you upload the firmware of your laptop?

vit9696 commented 3 years ago

The firmware for your laptop: 083B9.bin.zip. Dedicated driver for the soft keyboard is named SoftKbd: Section_PE32_image_8A2FDFC3-0395-442C-B9F7-9A3D69D2094C_SoftKbd_body.efi.zip Easily found by referencing 0B91234C-00DD-4853-AE76-0B8457874214.

There is a dedicated protocol for this, which I tried calling in https://github.com/acidanthera/OpenCorePkg/commit/a8749e3b2d74b5dbc3c9225778e92dd992abb183

Get the test build from https://github.com/acidanthera/OpenCorePkg/runs/1543700314 and report if it helps.

vit9696 commented 3 years ago

Assuming there is no interest in getting this fixed. Closed.

TingyiChen commented 3 years ago

This issue still persists on HP Spectre X360 13-ac010tu i5 7200U model with OpenCore 0.6.5

vit9696 commented 3 years ago

Oh, finally a human to test this =) Will you be able to test several test builds and provide us the results? If so, please update to the latest 0.6.6 version from master first.

TingyiChen commented 3 years ago

i'll do this, but i checked my firmware,the softkbd module is not exist in my model, i doubt it may not work.Trying to figure out the driver in my bios now

TingyiChen commented 3 years ago

i'll do this, but i checked my firmware,the softkbd module is not exist in my model, i doubt it may not work.Trying to figure out the driver in my bios now

Uh just double checked, the module exists,sorry image

vit9696 commented 3 years ago

Right, just to clarify. You do have a virtual keyboard that is stuck onscreen breaking macOS boot. If so, update to 0.6.6 and I will upload a test build here soon (with a softkbd workaround).

TingyiChen commented 3 years ago

uh nop, the soft kbd disappears when stuck,lemme give a image

TingyiChen commented 3 years ago

i doubt it is not the soft kbd which caused boot stuck

TingyiChen commented 3 years ago

image there should be a small kbd icon in the top right of the screen i disabled log so it just displayed a apple logo when the log is about to reach "EXITBS:START" ,the kbd icon disappears

TingyiChen commented 3 years ago

anyway i downloaded 0.6.6,lemme try if it can work now

vit9696 commented 3 years ago

Hmmm, then it could be the Booter quirk set actually as well. Please upload your EFI folder as well.

TingyiChen commented 3 years ago

just checked release from https://github.com/acidanthera/OpenCorePkg/actions/runs/502565047 it doesn't work,still stuck my efi: https://transfer.sh/FOw4m/EFI.zip

vit9696 commented 3 years ago

Right, please retry with this version, and tell me, if the icon behaves any differently.

SoftKbd-r1.zip

Also provide a debug log with Target=67.

vit9696 commented 3 years ago

Regarding EFI, are you sure you do not need AppleXcpmCfgLock = YES? I am not positive you can unlock E2 on these machines.

TingyiChen commented 3 years ago

i unlocked cfg lock via setup_var ,and i can confirm it works. the same efi boots well when boot from usb drive

TingyiChen commented 3 years ago

just checked,it doesn't work log file: opencore-2021-01-22-141231.txt

vit9696 commented 3 years ago

i unlocked cfg lock via setup_var ,and i can confirm it works.

Right.

the same efi boots well when boot from usb drive

Hmmm, i.e. this EFI folder boots into macOS from a USB flash, but does not boot from the SSD? Is there any visual difference between these boots?

TingyiChen commented 3 years ago

Hmmm, i.e. this EFI folder boots into macOS from a USB flash, but does not boot from the SSD? Is there any visual difference between these boots?

Both EFI are same, when the EFI boots fine from USB, directly copy it into internal SSD EFI partition and boot , it hangs.

vit9696 commented 3 years ago

Both EFI are same, when the EFI boots fine from USB, directly copy it into internal SSD EFI partition and boot , it hangs.

Right, but is there any visually noticeable difference between USB boot and SSD boot? Well, besides the hang :D

I tried disabling the soft keyboard right before launching boot.efi. Please try this one and include the debug log with Target 67: SoftKbd-r2.zip. I expect that you see the soft keyboard icon disappear right before the Apple logo appears, please confirm that.

TingyiChen commented 3 years ago

Right, but is there any visually noticeable difference between USB boot and SSD boot? Well, besides the hang :D

The keyboard icon doesn't appear when booting from usb device

I'll check it right now

TingyiChen commented 3 years ago

The icon still disappears after apple logo comes out

TingyiChen commented 3 years ago

i tried unload the softkbd from efishell and quit to opencore and boot,still hangs and it looks like that the icon is not shown by the driver, it is still there after the softkbd unloaded

TingyiChen commented 3 years ago

log file: opencore-2021-01-22-142652.txt opencore-2021-01-22-142800.txt

TingyiChen commented 3 years ago

https://github.com/Just-maple/Hp-spectre-X360-hackintosh/blob/master/CLOVER/PreLoader.efi it is said that use this preloader efi wrapper to load clover worked,but it didn't work on oc

vit9696 commented 3 years ago

Hmmm, can you upload your firmware and make a clearer photo of your icon? Also, that preloader, do you have the source code for it?

TingyiChen commented 3 years ago

My firmware: 0827E.zip that icon: image the preloader file seems comes from linux, released by microsoft or someone else: https://blog.hansenpartnership.com/linux-foundation-secure-boot-system-released/ https://wiki.archlinux.org/index.php/Unified_Extensible_Firmware_Interface/Secure_Boot

vit9696 commented 3 years ago

Hmmm, uneasy. Cannot find it so far. Can you disable picker showing and KeySupport in OC? And simply let it boot macOS without any keyboard interaction? Master version and r2.

TingyiChen commented 3 years ago

lemme try now as I saw somewhere before, it is said that hp bios is treating opencore as it's diag utility UEFI and applied some limitations, I don't know if it is true

TingyiChen commented 3 years ago

I tried both versions, still the same

vit9696 commented 3 years ago

Try this version (please include the log). Also tell me if the icon is affected anyhow. SoftKbd-r3.zip

TingyiChen commented 3 years ago

It doesn't work The icon still behaves like before,disappeared after the apple logo comes out Log file: opencore-2021-01-22-161000.txt I doubt it is not caused by that icon related things?Because the boot process still hang even after I unloaded the SoftKbd module from EFI shell. Is there any other way to debug?

vit9696 commented 3 years ago

Hard to say. The soft keyboard driver is definitely off according to the logs. Can you try setting ExitBootServicesDelay to a reasonable value? See the docs…

TingyiChen commented 3 years ago

Sure,I'll check it

vit9696 commented 3 years ago

Also try this one, provide logs…

SoftKbd-r4.zip

TingyiChen commented 3 years ago

i applied 5 second delay,With r3 it doesn't work,lemme try r4

TingyiChen commented 3 years ago

R3 log: opencore-2021-01-22-170013.txt

TingyiChen commented 3 years ago

R4 One failed to boot,showing smc io protocol fatal error log: opencore-2021-01-22-170735.txt

vit9696 commented 3 years ago

Sorry, fixed. SoftKbd-r5.zip

TingyiChen commented 3 years ago

Failed to load Openruntime.efi: invalid arg log: opencore-2021-01-22-171818.txt I'm going to sleep now..may test tomorrow,i'll try to figure out which efi driver caused this loop

TingyiChen commented 3 years ago

I doubt that Hp did something in their bios for touch or some input driver,maybe not exist in the softkbd module need further investigation

vit9696 commented 3 years ago

Very hard to say, but trying to unload other drivers might help. The situation with r5 is very strange, and I'd suggest you try loading r5 without OpenRuntime driver tomorrow.

TingyiChen commented 3 years ago

I tried boot without openruntime, the screen becomes black after os pickup menu, and the keyboard icon is always there and the kbd can be triggered out when clicking on it log: opencore-2021-01-23-014812.txt

vit9696 commented 3 years ago

Very strange, I will try to understand this, but probably you are best to try finding the driver to unload.

TingyiChen commented 3 years ago

I'll try to figure out the diff when booting from internal and usb, haven't found now.

TingyiChen commented 3 years ago

usb.txt internal.txt This is loaded module list when booting from different devices

vit9696 commented 3 years ago

I do not expect to see any difference in the module list, but rather some configuration issue. Thus I would unload the input-related drivers. Also, it might be easier to try to understand why the kernel does not boot in the first place. Is there a serial header on the motherboard?

TingyiChen commented 3 years ago

Serial number of motherboard?Or something else

vit9696 commented 3 years ago

Serial/COM port pins to attach a serial debugger and see early kernel boot logs.