hieplpvip / Asus-Zenbook-Hackintosh

Run macOS on Asus Zenbook with OpenCore
203 stars 43 forks source link

USB-C hubs not working on UX430UA #20

Closed orditeck closed 5 years ago

orditeck commented 6 years ago

What is your laptop? UX430UA

Which version of macOS are you using? 10.14.1

Describe the problems USB-C hubs that work on other OS and my other Hackintosh doesn't work on this hackintosh

Attach output from gen_debug debug_6182.zip

Additional context For example, this one works well on Windows and Ubuntu on this laptop. It also works on my other Hackintosh (Xiaomi Mi Notebook Pro, same Mojave version).

On this one, only the HDMI out works (but it works great @ 3440x1440!). The USB port on the hub and the ethernet doesn't work. It 100% works on my other Hackintosh. So it'd seem like I have a problem with my USB-C port on MacOS.

xseignard commented 5 years ago

Hello, is your UX430UA a Kaby Lake or a Kaby Lake-R ? If a Kaby Lake R (like mine), I had to change the following hotpatch: https://github.com/hieplpvip/ASUS-ZENBOOK-HACKINTOSH/blob/master/src/hotpatch/include/SSDT-UIAC-UX430-KABYR.dsl

By a port definitions respecting my machine:

#ifndef NO_DEFINITIONBLOCK
DefinitionBlock ("", "SSDT", 2, "hack", "uiac", 0)
{
#endif
    Device(UIAC)
    {
        Name(_HID, "UIA00000")
        Name(RMCF, Package()
        {
            "8086_9d2f", Package()
            {
                "port-count", Buffer() { 18, 0, 0, 0 },
                "ports", Package()
                {
                    "HS01", Package() // usb left (usb3)
                    {
                        "UsbConnector", 3,
                        "port", Buffer() { 1, 0, 0, 0 },
                    },
                    "HS02", Package() // usb right (usb2)
                    {
                        "UsbConnector", 0,
                        "port", Buffer() { 2, 0, 0, 0 },
                    },
                    "HS04", Package() // usb c one side
                    {
                        "UsbConnector", 3,
                        "port", Buffer() { 4, 0, 0, 0 },
                    },
                    "HS05", Package() // card reader
                    {
                        "UsbConnector", 0,
                        "port", Buffer() { 5, 0, 0, 0 },
                    },
                    "HS06", Package() // webcam
                    {
                        "UsbConnector", 255,
                        "port", Buffer() { 6, 0, 0, 0 },
                    },
                    "HS08", Package() // bluetooth
                    {
                        "UsbConnector", 255,
                        "port", Buffer() { 8, 0, 0, 0 },
                    },
                    "HS10", Package() // usb c other side
                    {
                        "UsbConnector", 3,
                        "port", Buffer() { 10, 0, 0, 0 },
                    },
                    "SS01", Package() // usb left (usb3)
                    {
                        "UsbConnector", 3,
                        "port", Buffer() { 13, 0, 0, 0 },
                    },
                    "SS04", Package() // usb c
                    {
                        "UsbConnector", 3,
                        "port", Buffer() { 16, 0, 0, 0 },
                    },
                },
            },
        })
    }
#ifndef NO_DEFINITIONBLOCK
}
#endif

Let me know if it works.

orditeck commented 5 years ago

A Kaby Lake-R (8250u). Thanks for your help, I'll try that as soon as I get the chance to!

xseignard commented 5 years ago

Same machine as mine. Good chances it works, if not read carefully this guide:https://www.tonymacx86.com/threads/guide-creating-a-custom-ssdt-for-usbinjectall-kext.211311/

On either way, you won't brick your hackintosh with this modification.

xseignard commented 5 years ago

By the way, @hieplpvip do you know if the SSDT for the UX430 (KabyLake-R) you provide is proven to work ? Since for me it wasn't at all. If the feedback from @orditeck proves the one I provide works, it may be a good idea that I do a PR, no ? Regards

orditeck commented 5 years ago

@xseignard so I've finally got the chance to try you dsl file. I compiled it to aml using MaciASL and I've put it in EFI/Clover/ACPI/patched.

I lost QE/CI, but the USB-C adapter did work. The ethernet and the USB 3 port on it were working. The HDMI output wasn't working but that may be because I lost the iGPU support.

Any idea why it happened? It would be awesome to get the USB-C port to work correctly on my machine.

xseignard commented 5 years ago

I usually rebuild the whole sutff using the make_acpi.shfrom this repo. Then I put the result in EFI/Clover/ACPI/patched.

What is QE/CI ? Are you sure you have the good renames in your config.plist ?

orditeck commented 5 years ago

QE/CI are the Graphic Acceleration on MacOS. The aml broke the iGPU support.

Would you be so kind to explain to me the make_acpi.sh & config.plist parts?

hieplpvip commented 5 years ago

@orditeck Replace the content of SSDT-UIAC-UX430-KABYR.dsl with the SSDT by @xseignard, then run ./make_acpi.sh && ./install_acpi.sh

@xseignard The current SSDT for UX430 KabyLake-R is not tested completely, sorry about this

If your SSDT is proven to work, feel free to open a pull request.

xseignard commented 5 years ago

@hieplpvip well, it works well, the only case where it doesn't work is when I plug a USB-C adapter such as the this one and after that trying to put the following USB-C to ethernet adapter on the USB-C port of the first adapter. Which is rather useless for me, but for the sake of the completeness of my SSDT I'd like to provide a solution for such cases. Don't know what to investigate for such solution to work. Any idea ?

hieplpvip commented 5 years ago

@xseignard Unfortunately, I don't have such adapters to test on my laptop (mine is UX410 but should be similar).

Have you tested in Windows?

xseignard commented 5 years ago

No, I don't have windows anymore. But I don't think the problem I'm describing is a big issue.

@orditeck any updates on your side ?

orditeck commented 5 years ago

Not yet. Just moved into a new house and started using the laptop again. I'll do some more tests in the following weeks.

Vmonheros commented 5 years ago

Hi.

I've got an UX430UA (not R) and the USB ports are the same (I tested them). A small remark. USB C port is type 9. It's what I did for HS04, HS10 and SS04. And it works.

Furthermore, I used the last FBPatcher to create an USB Injector (that I adapt a bit with the information we have for USB port). It avoids to use USBInjectAll and the IUC SSDT, and the final "weight" is lighter. It's better when you inject things with Clover.

You can use this injector with Clover injection or in L/E. As you prefer

Note that the injector will works only if you declared MacbookPro 14,1 as SMBIOS. If you use another one, just edit the plist inside the injector and put your chosen SMBIOS in replacement.

USBPorts.kext.zip .

orditeck commented 5 years ago

@Vmonheros gonna try this tonight for sure! Thanks! I've got the UX430UAR (refresh, kaby lake), do you think it could cause an issue?

Vmonheros commented 5 years ago

Not sure.

However I checked and UX430UA (I've got) or UAR (from what provided by xseignard ) use the same USB logic. I will received an UAR soon (my wife will take the UA) and so I will test.

What I'm sure is that USB C ports are type 9 or 10 (if you look at ACPI documentation). So it's the right type in my injector. If not working, have a try and edit the plist inside moving from type 9 to type 10. There is a small difference on USB C depending if you have an internal switch or not, and no idea how ASUS implement it !

At present time, I cannot test USB C port with an external hub. I just tested it with my phone USB C cable (and my phone at the end). I confirm that you need HS04 and HS10 depending on how you plug the USB C cable (so the 2 "sides" of the plug). However I've got nothing to test the "SS04" of this USB C port. Perhaps you will see something tonight.

Et, un petit bonjour du Sud de la France ;).

orditeck commented 5 years ago

I'll try tonight and keep you updated. Thanks for the explanation. Et petit bonjour du Saguenay, au Québec!

orditeck commented 5 years ago

@Vmonheros I tried the kext. I've put the file in /Volumes/EFI/EFI/CLOVER/kexts/Other. I tried with both 9 and 10 for HS04, HS10 and SS04. The hub isn't detected at all. It works great on my other Hackintosh.

The USB-C port does work with another small USB 2.0 hub (usb-c to 2 usb 2.0 ports). I have no idea why.

orditeck commented 5 years ago

I confirm that you need HS04 and HS10 depending on how you plug the USB C cable (so the 2 "sides" of the plug). However I've got nothing to test the "SS04" of this USB C port. Perhaps you will see something tonight.

This made me realize there are sides? I always plug it the same side. I tried it the other side, and it got detected. Lol. Only the USB port works, and it's detected as 2.0 when it should be 3.0. The ethernet port doesn't work, and I think the HDMI is broken on this hub because I can't get it to work on whatever PC I'm using. I bought a new hub and I've got another one at my job, I'll have them both next week to make more tests.

orditeck commented 5 years ago

@xseignard

I just tried your dsl with the instructions provided by @hieplpvip

Replace the content of SSDT-UIAC-UX430-KABYR.dsl with the SSDT by @xseignard, then run ./make_acpi.sh && ./install_acpi.sh

It works. The hub works! Your dsl should definitely replace the one in the repo.

I'll make more tests when I get my hand on my other hubs to verify the HDMI out but the ethernet now works and the USB port works. It's detected as USB 2.0 but I'm starting to wondering that maybe it's 2.0. I'll verify tomorrow on my other hackintosh.

hieplpvip commented 5 years ago

@orditeck Try this one. The only difference is that I have changed UsbConnector for USB-C to 9 (thanks @Vmonheros)

#ifndef NO_DEFINITIONBLOCK
DefinitionBlock ("", "SSDT", 2, "hack", "uiac", 0)
{
#endif
    Device(UIAC)
    {
        Name(_HID, "UIA00000")
        Name(RMCF, Package()
        {
            "8086_9d2f", Package()
            {
                "port-count", Buffer() { 18, 0, 0, 0 },
                "ports", Package()
                {
                    "HS01", Package() // USB 3.0 (left)
                    {
                        "UsbConnector", 3,
                        "port", Buffer() { 1, 0, 0, 0 },
                    },
                    "HS02", Package() // USB 2.0 (right)
                    {
                        "UsbConnector", 0,
                        "port", Buffer() { 2, 0, 0, 0 },
                    },
                    "HS04", Package() // USB-C one side
                    {
                        "UsbConnector", 9,
                        "port", Buffer() { 4, 0, 0, 0 },
                    },
                    "HS05", Package() // Card Reader
                    {
                        "UsbConnector", 0,
                        "port", Buffer() { 5, 0, 0, 0 },
                    },
                    "HS06", Package() // Webcam
                    {
                        "UsbConnector", 255,
                        "port", Buffer() { 6, 0, 0, 0 },
                    },
                    "HS08", Package() // Bluetooth
                    {
                        "UsbConnector", 255,
                        "port", Buffer() { 8, 0, 0, 0 },
                    },
                    // HS09 is for ELAN fingerprint sensor
                    // It doesn't work on macOS, so we should disable it
                    "HS10", Package() // USB-C other side
                    {
                        "UsbConnector", 9,
                        "port", Buffer() { 10, 0, 0, 0 },
                    },
                    "SS01", Package() // USB 3.0 (left)
                    {
                        "UsbConnector", 3,
                        "port", Buffer() { 13, 0, 0, 0 },
                    },
                    "SS04", Package() // USB-C 3.0 (both sides)
                    {
                        "UsbConnector", 9,
                        "port", Buffer() { 16, 0, 0, 0 },
                    },
                },
            },
        })
    }
#ifndef NO_DEFINITIONBLOCK
}
#endif
Vmonheros commented 5 years ago

HI.

Last info. I found the explanation for USB C with or without switch. When you have a switch, it means that you have no USB change when you reverse the connector side. As it is not our case (we have 2 HS for the USB C connector), we have no switch = we are type 10.

@hieplpvip I will do more test tonight.

hieplpvip commented 5 years ago

Would be great if someone who has a USB-C 3.0 drive can test the port, we need to know if there exists SS10.

orditeck commented 5 years ago

@hieplpvip it changed nothing. The hub still works. So 9 and 10 would have the same result? 🤷‍♂️

I just tried the same hub on my other hackintosh and the USB port shows as 2.0, so my guess is that it's 2.0 lol. I'll try with more hubs soon: another identical hub but with HDMI out working, a brand new one, and this one when I find where I put it.

Vmonheros commented 5 years ago

One question.

Did you see something attached to SS04 when you plug the hub. And did this one recognized only if you plug it on "one side", not the other one ?

The idea of @hieplpvip on SS10 is around that. I will check as I'm not sure that the XHC 100 series chip can handle more than 6 SS ports.

I tried to connect an USB key (and recognized on SS01) on the USB C port with an USB A to USB C adapter, and I can only see it on HS04 and HS10 so USB 2.0... But perhaps it comes from the adapter !

orditeck commented 5 years ago

@Vmonheros how can I can see if something is attached to SS04 in particular? With IORegistryExplorer?

I didn't try both sides but I tried 9 and 10 and the hub was always plugged the same side and nothing changed in its compatibility. So for now, after testing with only one hub, the result is the same. But I'll test with more hub.

Vmonheros commented 5 years ago

I looked at the default USB port definition in default DSDT.

And I'm surprised but they seems OK. The ports not used are disabled and the port used have correct type. Surprisely I've got type 9 on SS04 and HS04. And HS10 is here but with type 0 (so USB2) ! So I think we have a switch (so type 9) but ASUS add the HS10 in case of we have "false" USB C connector that are in fact remap USB A (or mini). As I've got with my adaptors. So we certainly not need any SS10, that cannot exists as we cannot have more than 8 SS ports with current chipset.

Scope (_SB.PCI0.XHC.RHUB.HS10) { Method (_UPC, 0, Serialized) // _UPC: USB Port Capabilities { Name (XUPC, Package (0x04) { 0xFF, Zero, Zero, Zero })

When the USB port is disable, it's Zero where you have 0xFF. The second value is the port type. Check. For me, we don't need to patch anything for USB, what is done by default is correct (outside of the fact that the ELAN fingerprint is on, but is it an issue ?).

Can you check without UsbInjectall kext ? If things works, it means that we need nothing.

hieplpvip commented 5 years ago

@Vmonheros That's a huge discovery! I removed USBInjectAll and everything works great. Pretty cool that we don't need USBInjectAll anymore.

About ELAN fingerprint sensor on HS09, my laptop doesn't have that sensor and HS09 is still on (god damn Asus), so I think it's ok to leave it as default.

Thank you very much!

hieplpvip commented 5 years ago

One more thing, could you guys tell me how's your experience with AsusSMC (keyboard backlight, ambient light sensor, fn keys)?

xseignard commented 5 years ago

Hello/Bonjour! Sorry I'm late on this thread, so from what I understand there is no more need for the port definitions ? I just need to pull the repo, and run ./make_acpi.sh && ./install_acpi.sh to update ?

About AsusSMC what I can tell is the following:

orditeck commented 5 years ago

@hieplpvip, AFAIK the USBInjectAll is supposed to be used only temporarily to create a custom SSDT.

@xseignard, pretty sure that the custom SSDT is still needed, which is where the port definitions are placed. The only thing that can be safely removed (and should probably have been already) is the USBInjectAll kext injected with Clover.

I could be wrong as all this is still new to me. Edit: re-reading @Vmonheros last reply, I'm understanding that even the SSDT would not be needed?

I wouldn't close this issue until more tests have been done with more USB-C hubs/accessories.

xseignard commented 5 years ago

I tested more the fn keys:

Thanks again @hieplpvip very nice work! I sent you a small tip on your paypal.

Vmonheros commented 5 years ago

Hi.

Same remarks than @xseignard. But mute is working for me ! However, I'm on UX430UA (not R)

However, I cannot see that ambient sensor is working. Is there any manner to test it ? Note that on Azerty Keyboard, it's Fn + Q not Fn + A (even if the "key" is at the same side on the keyboard, I'm not sure it's the same for the internal code.

Furthermore, on kext provided by Dinesh (I know him, we discuss al lot together), Keyboard backlight stop after a certain amount of time without typing. Typing something or putting a finger on the touchpad enable backlight again. Not sure if we can do it.

Final note. Can we make a separate issue to track AsusSMC (that is great !!!). It's fine to have more On Screen Notification than previously (Sleep, keyboard).

Vmonheros commented 5 years ago

@orditeck

Test without USBInjectAll. If it works for you, you can remove the SSDT UIAC information in your SSDT (as it is what is read by the Kext, it is not something that is defined in ACPI so it cannot be use elsewhere).

Better will be to regenerate SSDT with last modification done by @hieplpvip

Keep us informed.

hieplpvip commented 5 years ago

@Vmonheros Ambient light sensor is enabled on every boot. Fn+A shouldn't be used to toggle ALS (although it works) since there's no notification yet.

As I written in AsusSMC's README, keyboard backlight+ALS are natively supported by macOS. That means you can config them in System Preferences. And yes, there's an option to turn off keyboard backlight automatically. Find it in Keyboard section

Vmonheros commented 5 years ago

So I missed something. I will check. Thanks ;).