Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MacBookPro 15,1/2? #71

Open
aunali1 opened this issue Aug 13, 2018 · 531 comments
Open

MacBookPro 15,1/2? #71

aunali1 opened this issue Aug 13, 2018 · 531 comments

Comments

@aunali1
Copy link
Contributor

aunali1 commented Aug 13, 2018

Any support/documentation for the refreshed 2018 MacBook Pros?

I have one and I'll be willing to help with tinkering stuff especially since they are using the new T2 chips.

@roadrunner2
Copy link
Contributor

Is the keyboard and touchbar (using the drivers at my clone of macbook12-spi-driver) working for you? I've had reports so far that at least the keyboard doesn't. Assuming that's true, help would be appreciated in trying to debug the issue (and in which case please open an issue for this specifically).

@aunali1
Copy link
Contributor Author

aunali1 commented Aug 13, 2018

So I went ahead and custom built a Arch Linux live image with @roadrunner2's driver. (Archiso releng profile + macbook12-spi-driver-dkms from AUR)

While the driver successfully loads, the keyboard fails to function and the touchbar remains blank.

EDIT:
A link to the image for reference

@Dunedan
Copy link
Owner

Dunedan commented Aug 13, 2018

Any support/documentation for the refreshed 2018 MacBook Pros?

You're the first person here who got one, so you might be the one being able to provide information. 😄

As there are some significant differences compared to the previous models, mainly due to the introduction of Apple's T2-chip, I suspect fewer components will work for now.

As a start a PR with the output of the get-info.sh script would be really good.

And you can of course follow the instructions for the 2016/2017 models and have a look which components work and which don't. For example I expect that Linux won't have access to the sensors previously exposed by the system management controller (SMC), as that's now handled by the T2-chip. Same for access to the disk via NVMe. While I expect that this works, it might require a kernel patch as did the controller for the 2016 and 2017 models.

But as said: a PR with the information from the get-info.sh would be a great start and much appreciated. 👍

@aunali1
Copy link
Contributor Author

aunali1 commented Aug 14, 2018

Well the SSD doesn't work at all, same with WIFI, looks like a new chip BCM4464 (nothing on google.)

I also attempted manually specifying the SSD PCI ID (106B:2005 - ANS2 NVME Controller) with the following,

$ modprobe nvme
$ echo 106b 2005 > /sys/bus/pci/drivers/nvme/new_id

after which lsblk showed a basic nvme dev, then after about 10 seconds the screen instantly went black alongside which the fans spun up to full speed, lasting for about a second, then the MacBook rebooted into macOS.

Not sure what went wrong, prob the T2 crashed or smth? I did receive a crash report after booting macOS with BridgeOS reporting a recoverable ANS2 failure.

FYI, sending in a PR with the info from get-info.sh soon.

@Dunedan
Copy link
Owner

Dunedan commented Aug 15, 2018

Lots of interesting bits in the dumps. The obvious ones:

  • no iBridge device shown in lsusb (which might explain why the Touch Bar doesn't work. Because of that I also expect the iSight webcam to not work as well)
  • two unknown PCI-devices Apple Inc. Device [106b:1801] and Apple Inc. Device [106b:1802] (maybe that's what the T2-chip exposes for Touch Bar and iSight webcam?)
  • applesmc failing to read stuff (kind of expected as the T2-chip includes the SMC functionality now)

@aunali1
Copy link
Contributor Author

aunali1 commented Aug 15, 2018

@Dunedan Would a dump from system_profiler on macOS be helpful?

@Dunedan
Copy link
Owner

Dunedan commented Aug 16, 2018

Sure. More information is always good. 😄

@aunali1
Copy link
Contributor Author

aunali1 commented Aug 17, 2018

Pastebin was complaining about file size so I just uploaded to here. (2.7 MB)

Of particular interest are the following,

  • IOBC@0,1 matching [106b:1801] above (Bridge Controller?)
  • SEPM@0,2 matching [106b:1802] above (Secure Enclave Processor?)

It seems that Apple is emulating a HCI controller through the IOBC to interface with the iBridge devices as USB, as evidenced by the recurring AppleUSBVHCIPorts and AppleUSBVHCIBCE virtual controller.

@wsy2220
Copy link

wsy2220 commented Aug 20, 2018

The biggest problem on my 15,1 is applesmc module, it refused to load with these messages:

[ 1124.528835] applesmc: send_byte(0x10, 0x0304) fail: 0xff
[ 1124.528837] applesmc: #KEY: read arg fail
[ 1124.719729] applesmc: send_byte(0x10, 0x0304) fail: 0xff
[ 1124.719732] applesmc: #KEY: read arg fail
[ 1124.907593] applesmc: send_byte(0x10, 0x0304) fail: 0xff
[ 1124.907595] applesmc: #KEY: read arg fail
[ 1125.095762] applesmc: send_byte(0x10, 0x0304) fail: 0xff
[ 1125.095764] applesmc: #KEY: read arg fail
[ 1125.283551] applesmc: send_byte(0x10, 0x0304) fail: 0xff
[ 1125.283553] applesmc: #KEY: read arg fail
[ 1125.471537] applesmc: send_byte(0x10, 0x0304) fail: 0xff
[ 1125.471539] applesmc: #KEY: read arg fail
[ 1125.659650] applesmc: send_byte(0x10, 0x0304) fail: 0xff
[ 1125.659652] applesmc: #KEY: read arg fail
[ 1125.847437] applesmc: send_byte(0x10, 0x0304) fail: 0xff
[ 1125.847439] applesmc: #KEY: read arg fail
[ 1126.035669] applesmc: send_byte(0x10, 0x0304) fail: 0xff
[ 1126.035671] applesmc: #KEY: read arg fail
[ 1126.223667] applesmc: send_byte(0x10, 0x0304) fail: 0xff
[ 1126.223668] applesmc: #KEY: read arg fail
[ 1126.411547] applesmc: send_byte(0x10, 0x0304) fail: 0xff
[ 1126.411549] applesmc: #KEY: read arg fail
[ 1126.599665] applesmc: send_byte(0x10, 0x0304) fail: 0xff
[ 1126.599667] applesmc: #KEY: read arg fail

without applesmc, it's always very hot.

My kernel is

Linux version 4.17.0-3-amd64 ([email protected]) (gcc version 7.3.0 (Debian 7.3.0-28)) #1 SMP Debian 4.17.17-1 (2018-08-18)

I haven't tried to get keyboard/touchpad to work. I'd like to provide any information needed.

edit:
#70 solved the melting temperature, by adding 'acpi_mask_gpe=0x6e' kernel parameter

@mikeeq
Copy link

mikeeq commented Aug 20, 2018

Have you tried to turn off secure boot? https://support.apple.com/en-us/HT208330
Maybe that's the reason why it doesn't see any NVMe devices.

@aunali1
Copy link
Contributor Author

aunali1 commented Aug 21, 2018

@mikeeq Yes, thats the only way I was able to boot the device.

@aunali1
Copy link
Contributor Author

aunali1 commented Aug 21, 2018

@wsy2220 Do you have FileVault enabled? If not it me be worthwhile to test the following commands I used to recognize the NVMe drive:

$ modprobe nvme
$ echo 106b 2005 > /sys/bus/pci/drivers/nvme/new_id

I have a hunch that with FileVault disabled it won't spontaneously crash like it did in my situation.

@wsy2220
Copy link

wsy2220 commented Aug 21, 2018

@aunali1 I have no FileVault. I tried those commands, and nvme device didn't show up, and the system got reset after about 10s.

@roadrunner2
Copy link
Contributor

Regarding the keyboard, looking at the provided pci listing and dsdt, I see two things:

  1. There does not appear to be any driver in the kernel for the SPI controller on these machines (pci id 8086:a324)
  2. I cannot find any info about the keyboard in the DSDT, so I don't think it's attached to the SPI bus/controller (in fact, according to the DSDT there's nothing attached the SPI bus/controller)

Looking at the ioreg info is more informative: it appears it's back on the USB bus, and hanging off the Bridge-Controller/T2-chip. But since it doesn't show up in lspci, I guess something needs to initialize the BridgeController first?

@AndreasAZiegler
Copy link

Did someone have any success with the nvme of the MacBook Pro 2018? I have the same problems as other people described earlier (keyboard and trackpad not working and nvme not visible). The not working keyboard and trackpad doesn't bother me that much as I'm anyway using an external keyboard and mouse most of the time. The not recognized nvme however bother me quite a lot.

@Dunedan
Copy link
Owner

Dunedan commented Oct 3, 2018

@wsy2220 I don't expect applesmc to work anymore for the MacBook Pro 2018, as Apple moved the SMC-functionality into the T2-chip. We saw the first step already with devices with the T1-chip, where the ambient light sensor isn't handled by the SMC anymore, but probably by the T1-chip, using a different interface to access it (and so far nobody has figured out how that looks like).

@AndreasAZiegler The NVMe controller isn't recognized by default, because Apple screwed up and put a typo in the class code for the NVMe controller. So to get it automatically detected a patch for the Linux kernel is necessary (e.g. check out the patch I submitted for the MacBook Pro 2016: http://lists.infradead.org/pipermail/linux-nvme/2017-February/008323.html). Without the patch, you can manually discover the NVMe controller with the following commands (as already mentioned in the thread by @aunali1):

$ modprobe nvme
$ echo 106b 2005 > /sys/bus/pci/drivers/nvme/new_id

The problem then seems to be that this is causing system resets soon after as mentioned above as well.

I did receive a crash report after booting macOS with BridgeOS reporting a recoverable ANS2 failure.

@aunali1 Any chance you (or somebody else) can provide such a crash report? Maybe it contains some useful information.

Updating to the latest macOS version could also fix the system reset, if it was caused by a bug in BridgeOS (not likely, but worth a shot).

@KTRosenberg
Copy link

Hello all, I recently received this model of macbook pro, but it looks like unfortunately Linux is crippled on it. I would have liked to boot off an external drive, but if I understand correctly, the keyboard and trackpad don't work, and even worse, audio and wifi don't work at all. I suppose that brightness controls also don't work then? Has any headway been made towards making Linux usable on these machines?
Thanks.

@jboyens
Copy link

jboyens commented Oct 7, 2018

@KTRosenberg This entire Github project is designed to help you make it work on these laptops. I use it daily on a 14,3. There are compromises, but it's very useable.

@roadrunner2
Copy link
Contributor

Could somebody provide the output from sudo acpidump? On the MBP13,3 at least the entries for the iBridge are in one of supplementary tables, not the main DSDT. And I'm wondering if the new chip(s) need some sort of ACPI call to activate them, since they don't appear on the USB bus. Of course since they show up as pci devices it's also possible they need to be activated via PCI.

@Dunedan Might I suggest changing the get-info.sh script to get the full acpi info rather than just the DSDT?

@KTRosenberg
Copy link

@jboyens I see. But just to confirm--is it true that the wifi and audio are still unusuable beyond connecting external adapters and audio interfaces?

@jboyens
Copy link

jboyens commented Oct 7, 2018

@KTRosenberg it depends on the model. But yes, audio and WiFi are not working consistently without some compromises. I use a small WiFi dongle and USB headphones.

@KTRosenberg
Copy link

I was referring to the 2018 model, which seems to be less functional than the previous models due to the T2 chip-related changes.

@Dunedan
Copy link
Owner

Dunedan commented Oct 7, 2018

@roadrunner2 Sure. Free free to open a PR and add what you think would be beneficial as well.

@AndreasAZiegler
Copy link

While trying around with the latest Arch Linux installer (2018.10) and the current Ubuntu Live System, I made the following observations. When I run
modprobe nvme
echo 106b 2005 > /sys/bus/pci/drivers/nvme/new_id

in the Ubuntu Live system sometimes the nvme drive appears and sometimes it doesn't. In both cases the system resets after around 10s as desribed by @wsy2220. In the Arch Linux installer neither does the drive appear nor does the system resets. Does anyone has some more success yet?

@aunali1
Copy link
Contributor Author

aunali1 commented Oct 7, 2018

@roadrunner2 I'll spin up a new Arch image and test out the command.
@Dunedan If the T2 crashes again, as it probably will, I'll post the dump of the report from macOS.
@AndreasAZiegler Odd. It always showed up for me before crashing on Arch.

@AndreasAZiegler
Copy link

AndreasAZiegler commented Oct 7, 2018

@Dunedan I posted the dump of the report from macOS here https://pastebin.com/UtvGz403 (I hope that's right).

Just for clarification how this report was generated: I booted from the Ubuntu Live USB stick, modified the nvme driver, recompiled the driver, loaded the driver "modprobe nvme", then my laptop crashed after around 10s, in macOS the aforementioned report was presented to me.

@roadrunner2
Copy link
Contributor

Regarding the NVME related resets, there's this hack in the linux driver (drivers/nvme/host/pci.c line 2097 or thereabouts) for an older apple controller:

        /*
         * Temporary fix for the Apple controller found in the MacBook8,1 and
         * some MacBook7,1 to avoid controller resets and data loss.
         */
        if (pdev->vendor == PCI_VENDOR_ID_APPLE && pdev->device == 0x2001) {
                dev->q_depth = 2;
                dev_warn(dev->ctrl.device, "detected Apple NVMe controller, "
                        "set queue depth=%u to work around controller resets\n",
                        dev->q_depth);

Might be worth seeing if this is also needed for the new controller.

@wsy2220
Copy link

wsy2220 commented Oct 8, 2018

@roadrunner2

Could somebody provide the output from sudo acpidump?

Here is my acpidump on 15,1:
https://gist.github.com/wsy2220/dddb13f3a3649a5cb63bf88e98bde6f6

@aunali1
Copy link
Contributor Author

aunali1 commented Jan 16, 2020

@TRPB 5.4.11 seems to have introduced a breaking change to the functionality of @MCMrARM's bce module. If u have version 5.4.10-3 still cached you can revert to that as a temporary fix, I'll be reverting the repo soon so a removal and reinstall of the kernel and driver should do the trick.

@TRPB
Copy link

TRPB commented Jan 16, 2020

Unfortunately pacman gives me download errors from your repo (I think this is back: aunali1/linux-mbp-arch#2 ) and I have just been manually grabbing the files with wget as I can increase the retries. I didn't think to keep them after installing them though.

@aunali1
Copy link
Contributor Author

aunali1 commented Jan 16, 2020

@TRPB Odd, I'll look into that. Regarding previous releases, everything is mirrored on the github repo's releases so you can pull previous versions from there.

@imbushuo
Copy link

@MCMrARM Not sure if I am late, but I highly doubt SMC is emulated inside the T2 bridgeOS portion (with some kext and userland applications) instead of SEP.

@MCMrARM
Copy link

MCMrARM commented Jan 20, 2020

@imbushuo it's in the SEP

@MCMrARM
Copy link

MCMrARM commented Jan 31, 2020

Fixed the 5.4.15 compat issue in the BCE driver, apparently I misunderstood what address_device is for and after they fixed the new_scheme formula it broke my driver as it stubbed it.

@vvne
Copy link

vvne commented Feb 24, 2020

Hi, thanks for the great work done here, I can now install arch on my mba2019.
BCE driver from MCMrARM plus keyboard, touchpad, hid_apple and wifi patches against kernel 5.5.4 do the job.
As many, I had to add pci_ports=compat parameter to fix slow resume issue and to avoid random boot hangs.

Not working now: bluetooth and built in speakers.
Earphones are OK (codec-output), but speakers do not show in gnome sound panel.
I suspect BCE driver not seeing every device, lsusb yields:

Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 005 Device 008: ID 05ac:027a Apple, Inc. Apple Internal Keyboard / Trackpad
Bus 005 Device 005: ID 05ac:8103 Apple, Inc. Headset
Bus 005 Device 004: ID 05ac:8262 Apple, Inc. Ambient Light Sensor
Bus 005 Device 003: ID 05ac:8514 Apple, Inc. FaceTime HD Camera (Built-in)
Bus 005 Device 002: ID 05ac:8233 Apple, Inc. Apple T2 Controller
Bus 005 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Any clue about this issue? Is the T2 implementation different on mba vs mbp?
bce module shows many "bce_vhci_urb_dequeue 1" and "Not implemented" messages in dmesg.
I'd be willing to investigate, but I don't know how to start...

@M4VG
Copy link

M4VG commented Feb 24, 2020

Hi all, sorry for barging in. This is some amazing work, congratulations! I see there's an Arch distro available with the updated kernel but I really need to use Ubuntu 16.04. How would I implement your solution with Ubuntu? Does anyone already have this distro running with the updated kernel? I have a MacBook Pro 15,2. Thank you!

@vvne
Copy link

vvne commented Feb 28, 2020

Hi,
Here is an update for my "linux on mba quest log", using mostly gnome on arch:

  • Speakers are actually working. I just removed config files /usr/share/alsa/cards/AppleT2.conf, /usr/lib/udev/rules.d/91-pulseaudio.rules and /usr/share/pulseaudio/alsa-mixer/profiles-sets/apple-t2.conf and default audio is now internal speakers. I guess correct config would make earphones working too...

  • therefore, bce driver is fine on mba :-)

  • I have random hangs in the boot process, so I blacklisted tthunderbolt, brcmfmac and intel_lpss_pci in /etc/modprobe.d/blacklist.conf. Obviously, I have to modprobe them after boot complete to get wifi (brcmfmac) and BT (intel_lpss_pci).

  • wifi works great using iwd, I still have to test sound quality via BT.

  • Minor issue: keyboard backlight stops working after suspend/resume. I still can do "echo 128 > /sys/class/leds/apple::kbd_backlight/brightness, but dedicaced keys stop working. dbus problem?

To be continued, thanks again everyone for these amazing results

@vamsi360
Copy link

Hi,
Noob question: Are the patches stable and can be mainlined upstream?

@mfvianna
Copy link

mfvianna commented Apr 12, 2020

Any news on Touch bar support for MacbookPro15,2 (MacbookPro 13" from 2018/2019)?

I've made almost everything to work, including keyboard, sensors, sound and WiFi with the kernel patches from https://github.com/aunali1/linux-mbp-arch and the BCE driver from (https://github.com/MCMrARM/mbp2018-bridge-drv.
No need to use the SPI driver from https://github.com/roadrunner2/macbook12-spi-driver to make any of this to work (even for the keyboard or touchpad), the BCE driver suffices.

I've tried, though, to use the SPI driver specifically for the touchbar. The modules compile and load fine, but nothing happens.

I'd like to support this. Currently I don't have much time to code, but I can test and provide logs, system info collected from lshw, lsusb, dmesg, etc. and of course do some local compilations and test or make minor code adjustments.

@beawareoftheg
Copy link

beawareoftheg commented Apr 30, 2020

Can i ask you how you used the patches from linux-mbp-arch? I have a Macbook15,1 and I manage to make keyboard, touchbar, touchpad work, but with wifi I get nothing. In the settings on Wifi I get "No WiFi adapter found".

I'm on Ubuntu 18.04 with kernel 5.3.0. I've tried 5.4.0 but was really bad, nothing worked.

@stefanpartheym
Copy link

stefanpartheym commented May 1, 2020

@MultiGiachi

Actually, I created some scripts to make the installation process of the driver files in Linux more convenient.
You can go ahead and clone this repo: https://github.com/stefanpartheym/mbp15-wifi-driver

Original answer

You need the wifi driver files from your MacOS.
Use the following command in MacOS to retrieve the necessary driver files:

ioreg -l | grep 'C-4364' | grep 'RequestedFiles'

The wifi device name might differ on your Macbook, as I'm using MacbookPro15,2.
If you want to get super fancy, you could even convert the output from the command above to JSON like this:

ioreg -l | grep 'C-4364' | grep 'RequestedFiles' | sed 's/.*(\\(.*\\))/\\1/' | sed 's/=/:/g'`

The files listed in the output must be renamed accordingly and copied to /lib/firmware/brcm.
Please see the "Wifi setup" part of https://geeks-world.github.io/articles/472106/index.html for more information.

@beawareoftheg
Copy link

@stefanpartheym
First of all, thanks for the help.
For Macbook15,1 the Wifi device name is the same: C-4364.
I follow the steps, but Wifi is still not working.
ifconfig find an interface that I think it's the Wifi, but it shows up like an Ethernet interface and the MAC address, I think, it's completely random. Do you use iwd on Ubuntu or Arch?

@stefanpartheym
Copy link

@MultiGiachi
Hmm, that seems odd. Yes, I use iwd on Arch in combination with NetworkManager (iwd configured as backend).
Did you use iwctl to try to connect to wifi?
Also make sure you restart the iwd service after installing the driver files: sudo systemctl restart iwd.
Also double check the driver file names of the files you copied to /lib/firmware/brcm. File names should be correct if you used my script though.

@appimatic
Copy link

appimatic commented Jul 5, 2020

any support for an iMac Pro? or suggestions as to mods that would allow me to install linux on the internal SSD and boot from it? so far everything just hangs, even though I've disabled secure boot and system integrity protection.

can't get past the EFI / boot selection - once chosen, only darkness.

@tanner02
Copy link

tanner02 commented Sep 8, 2020

@stefanpartheym
Hi, I already created an issue on your repository. But I thought about posting or asking it here as well.
I got my WiFi working by using your Script but I can’t connect to Secured Networks. The least information I could get is “CTRL-EVENT-ASSOC-REJECT status_code=16“
Any idea how I could fix this ?
I’m using a MacBook15,2 running Linux Mint

@stefanpartheym
Copy link

Hi @Skurrrr ,
I commented on the issue, see stefanpartheym/mbp15-wifi-driver#3 for details ;)

@unstressable
Copy link

Hey,
is there a manual how to install this oin windows 10?

@zfortier
Copy link

zfortier commented Feb 1, 2021

@MultiGiachi @stefanpartheym
If wifi is flaky, try binding iwd and NetworkManager services to each other.

/etc/systemd/system/multi-user.target.wants/NetworkManager.service:

[Unit]
BindsTo=iwd.service
Requires=polkit.service
ReloadPropagatedFrom=iwd.service
Description=Network Manager
Documentation=man:NetworkManager(8)
Wants=network.target
After=network-pre.target dbus.service iwd.service
Before=network.target

[.......]

/etc/systemd/system/multi-user.target.wants/iwd.service:

[Unit]
BindsTo=NetworkManager.service
PropagatesReloadTo=NetworkManager.service
Description=Wireless service
Before=network.target
Wants=network.target

[........]

important are BindsTo, PropagatesReloadTo, ReloadPropagatedFrom and adding iwd.service to the After for NetworkManager.

@stefanpartheym
Copy link

Hey @zfortier
Thanks! I will try this. The flaky wifi is indeed annoying, especially when using a VPN for work.

@stefanpartheym
Copy link

@zfortier : I made the changes and it seems to work fine. Can't say for sure wifi will be less flaky now. I think have to observe this for some days. But thanks for your help!

@ghost
Copy link

ghost commented Feb 26, 2023

I am on the MacBookPro15,1. I attempted the b3 (4464) driver on the custom t2 linux iso. Copy it over from the ISO to the disk you install arch on. Wifi will work afterwards. I hope this helps!

@modz2014
Copy link

T2 chip controls the SMC on a macbook pro you can patch kernel but it wont work properly so to get full support on this you would need to create drivers by dump the T2 chip and smc i have done this with script many years ago i tried agian making drivers for touch id and stuff to work proeprly in bottcamp in windows i got bored with it and gave i can try and find this script and upload here if you guys need it

@almas
Copy link

almas commented May 11, 2024

Isn't there any possibility of getting a driver from the OpenCoreLegacyPatcher?
https://www.reddit.com/r/OpenCoreLegacyPatcher/comments/17c3by0/mbp_with_t1_touch_id_working_on_sonoma/
If it is possible then we might have success with the T1 chip.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests