Bluetooth and suspend on 12" Macbook Retina

Finally getting Linux somewhat usable on my 2016 12" Macbook Retina.

The form factor and resolution are awesome. Some stuff not working but I’ve come up with some good work-arounds for now.

Try as I might i’m unable to get the onboard BT adapter to work. So for now at least I use a usb (A) plugin adapter. that works fine for BT mouse, headphones, airpods etc.

Onboard wifi works fine but with the integrated BT theres some kind of broadcom firmware issue I can’t get my head around. I don’t know but maybe there is just no getting that to work.

Also unable to get suspend or hibernate to work. Goes to sleep fine but doesn’t wake up right. So for now at least I utilize KDE “user manual” session save feature in conjunction with a ksession.sh script I found on a forum somewhere (had to modify the script to work with kde5). with some additional custom scripting any open VM’s are saved then ksession.sh is executed saving the current session and putting that session data into the "startup’ position on the ~.config/ksmserverrc file. Incidentally KDE does a much better job of saving a session than I experienced with gnome. Some apps are a problem. As earlier indicated I scripted save logic for my virtualbox VM’s. Libre office file recovery gets me through issues with that suite if I happen to be going into my “faux-suspend” with those files open at the time.

I intercept the original shutdown and reboot commands via my own links and fire off my session save scripts rather than a standard reboot or shut down.

Onboard audio speakers don’t work either. I use bluetooth headset (or wired) or a 2" dia. mini speaker that plugs directly into the headset port.

I was hoping I’d get audio and suspend/hibernate working via the linux-macbook kernel available on AUR but no luck so far.

As is the little MBR suits most my needs pretty well. Screen resolution is sweet and my model has the 512G SDD, 8G ram and m7 processor so it hums along.

If anyone has any insight on the BT or suspend/hibernate issues please share.

Also, I’m trying to figure out how to make my right super/meta key (apples “command” key) not function as a Linux super key. I’d like to dedicate it as the host key when running my VM’s. right now it functions same as the left super and brings up the KDE menu in the upper left (i have my panel at the top of the screen rather than along the bottom.

inxi -Fxxxz
mhwd -li

[sadly your hibernate/suspend issue seems documented without a fix]
https://wiki.archlinux.org/index.php/Mac#April_2016_12"_-_Version_9,1

Thank you for the link cscs. Yeh maybe I’m out of luck there. At least for no. I’m somewhat pleased with the session save thing though. Does make the machine quite usable.

Interesting reading the info you pointed me to… It says the keyboard backlight doesn’t work. Mine is working flawlessly though.

Thats the other thing … it might be a bit dated.
(as usual linux land has made some improvements despite apples … non-cooperation)

Can you please provide the output from the commands above so we can see the actual system?

(note - please use the </> button :wink:)

Here’s what I get…

inxi -Fxxxz
System:
  Host: pahoran Kernel: 4.20.7-1-MANJARO x86_64 bits: 64 compiler: gcc v: 8.2.1 
  Desktop: KDE Plasma 5.14.5 tk: Qt 5.12.0 wm: kwin_x11 dm: SDDM 
  Distro: Manjaro Linux 
Machine:
  Type: Laptop System: Apple product: MacBook9,1 v: 1.0 serial: <filter> Chassis: 
  type: 9 v: Mac-9AE82516C7C6B903 serial: <filter> 
  Mobo: Apple model: Mac-9AE82516C7C6B903 v: MacBook9,1 serial: <filter> UEFI: Apple 
  v: MB91.88Z.0154.B22.1706181852 date: 06/18/2017 
Battery:
  ID-1: BAT0 charge: 38.1 Wh condition: 38.6/42.2 Wh (91%) volts: 8.6/7.6 
  model: SMP bq20z451 type: Li-ion serial: N/A status: Full cycles: 152 
  Device-1: hid-c8:47:8c:22:08:60-battery model: Bluetooth Mouse serial: N/A 
  charge: N/A status: Discharging 
CPU:
  Topology: Dual Core model: Intel Core m7-6Y75 bits: 64 type: MT MCP arch: Skylake 
  rev: 3 L2 cache: 4096 KiB 
  flags: lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx bogomips: 10372 
  Speed: 500 MHz min/max: 400/3100 MHz Core speeds (MHz): 1: 500 2: 500 3: 500 4: 502 
Graphics:
  Device-1: Intel HD Graphics 515 vendor: Apple driver: i915 v: kernel 
  bus ID: 00:02.0 chip ID: 8086:191e 
  Display: x11 server: X.Org 1.20.3 driver: intel unloaded: modesetting 
  alternate: fbdev,vesa compositor: kwin_x11 resolution: 2304x1440~60Hz 
  OpenGL: renderer: Mesa DRI Intel HD Graphics 515 (Skylake GT2) v: 4.5 Mesa 18.3.2 
  compat-v: 3.0 direct render: Yes 
Audio:
  Device-1: Intel Sunrise Point-LP HD Audio driver: snd_hda_intel v: kernel 
  bus ID: 00:1f.3 chip ID: 8086:9d70 
  Device-2: Broadcom and subsidiaries 720p FaceTime HD Camera driver: bdc-pci 
  bus ID: 03:00.0 chip ID: 14e4:1570 
  Sound Server: ALSA v: k4.20.7-1-MANJARO 
Network:
  Device-1: Broadcom and subsidiaries BCM4350 802.11ac Wireless Network Adapter 
  vendor: Apple driver: brcmfmac v: kernel port: 3040 bus ID: 02:00.0 
  chip ID: 14e4:43a3 
  IF: wlp2s0 state: down mac: <filter> 
  IF-ID-1: eth0 state: up speed: N/A duplex: N/A mac: <filter> 
  IF-ID-2: tun0 state: unknown speed: 10 Mbps duplex: full mac: N/A 
Drives:
  Local Storage: total: 465.92 GiB used: 39.15 GiB (8.4%) 
  ID-1: /dev/nvme0n1 vendor: Apple model: SSD AP0512J size: 465.92 GiB 
  speed: 15.8 Gb/s lanes: 2 serial: <filter> rev: 9.134.01 scheme: GPT 
  ID-2: /dev/nvme0n2 vendor: Apple model: SSD AP0512J size: 8 KiB speed: 15.8 Gb/s 
  lanes: 2 serial: <filter> rev: 9.134.01 
Partition:
  ID-1: / size: 28.71 GiB used: 9.85 GiB (34.3%) fs: ext4 dev: /dev/nvme0n1p4 
  ID-2: /home size: 338.32 GiB used: 29.27 GiB (8.7%) fs: ext4 dev: /dev/nvme0n1p6 
  ID-3: swap-1 size: 8.00 GiB used: 0 KiB (0.0%) fs: swap dev: /dev/nvme0n1p7 
Sensors:
  System Temperatures: cpu: 29.0 C mobo: N/A 
  Fan Speeds (RPM): N/A 
Info:
  Processes: 197 Uptime: 2h 01m Memory: 7.69 GiB used: 1.17 GiB (15.2%) Init: systemd 
  v: 239 Compilers: gcc: 8.2.1 Shell: bash v: 5.0.0 running in: konsole inxi: 3.0.30 

and

mhwd -li
> Installed PCI configs:
--------------------------------------------------------------------------------
                  NAME               VERSION          FREEDRIVER           TYPE
--------------------------------------------------------------------------------
           video-linux            2018.05.04                true            PCI


Warning: No installed USB configs!

See here


The principle is the same and, since is an apple too, it should work/help.

Interesting concept. Didn’t address my situation though. On wake from suspend, still stuck at what would be the login screen. No mouse, no touch pad, no keyboard input. For all appearances, locked up.

Hibernate issue… the 12MBR is unable to wakeup the SSD. I get a flashing folder icon. A cold boot brings the machine back to life. Minus the saved (hibernate) state of things.

Winterheart Broadcom Bluetooth Firmware Installation

Detection and Installation:

Find your bluetooth chipset and device ID

lsusb | grep -i bluetooth

This package is intended to provide firmware for Broadcom Bluetooth devices.

This includes BCM20702, BCM20703, BCM43142 chipsets (and others) for the Linux kernel.

The firmware is located here:

git clone https://github.com/winterheart/broadcom-bt-firmware

The above command will download the firmware to your home directory as:

~/broadcom-bt-firmware

Copy the downloaded file BCM20703A1-0a5c-6410.hcd to /lib/firmware/brcm/BCM-0a5c-6410.hcd (for the bcm4360), substitute your adapter model.

Figure out where the kernel is looking for the firmware from the dmesg log, copy the firmware to that location.

dmesg | grep -i bluetooth

The Broadcom Bluetooth firmware can not be installed properly without knowing the correct device ID information gathered from your logs or via the lsusb command.

Bluetooth: hci1: BCM: chip id 63
Bluetooth: hci1: BCM20702A
Bluetooth: hci1: BCM20702A1 (001.002.014) build 0000
bluetooth hci1: Direct firmware load for brcm/BCM20702A1-0b05-17cb.hcd failed with error -2
Bluetooth: hci1: BCM: Patch brcm/BCM20702A1-0b05-17cb.hcd not found

In the above example from the logs, it is clear that you would need the brcm/BCM20702A1-0b05-17cb.hcd firmware.

The name of this file is critical. The two sets of four characters, in this case 0b05-17cb, need to match your device’s Vendor ID and Product ID exactly.

Place the required .hcd file into /lib/firmware/brcm.

sudo cp ~/broadcom-bt-firmware/brcm/BCM20703A1-0a5c-6410.hcd /lib/firmware/brcm/BCM-0a5c-6410.hcd

Substitute your adapter ID into the above command example, assuming your adapter requires a different module than 0a5c-6410.hcd.

Once the firmware has been sucessfully copied, issue these commands:

sudo modprobe -r btusb

sudo modprobe btusb

If your adapter didn’t initialize properly with those commands, then power down completely and then restart.

After properly copying the correct firmware to the requied directory your device should now successfully load:

Example:

Bluetooth: hci1: BCM: chip id 63
Bluetooth: hci1: BCM20702A
Bluetooth: hci1: BCM20702A1 (001.002.014) build 0000
Bluetooth: hci1: BCM20702A1 (001.002.014) build 1467
Bluetooth: hci1: Broadcom Bluetooth Device

In some cases installing additional packages may be required, such as:

bluez
bluez-utils
blueman

After your firmware is installed, Bluetooth may still require further configuration from within the Bluez utility for proper Bluetooth functionality.

The following service units may solve your suspend/resume problems if it is related to your wifi.

Suspend unit:

Create:

/etc/systemd/system/network-suspend.service

With the following contents:

#/etc/systemd/system/network-suspend.service
#sudo systemctl enable network-suspend.service
#sudo systemctl start network-suspend.service
#sudo systemctl status network-suspend.service
#sudo systemctl daemon-reload
[Unit]
Description=Network suspend service 
Before=sleep.target
StopWhenUnneeded=yes

[Service]
User=root
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/bin/sudo -u $USER /bin/bash -lc 'nmcli networking off'
ExecStart=/usr/bin/sleep 1
ExecStart=/usr/bin/systemctl stop NetworkManager
ExecStart=/usr/bin/sleep 1
ExecStart=/usr/bin/ip link set wlp2s0  down
ExecStart=/usr/bin/sleep 1
ExecStart=/usr/bin/rmmod  brcmfmac

[Install]
WantedBy=sleep.target

Resume unit:

Create:

/etc/systemd/system/network-resume.service

With the following contents:

#/etc/systemd/system/network-resume.service
#sudo systemctl enable network-resume.service
#sudo systemctl start network-resume.service
#sudo systemctl status network-resume.service
#sudo systemctl daemon-reload
[Unit]
Description=Network resume service
After=suspend.target
StopWhenUnneeded=yes

[Service]
User=root
Type=oneshot
RemainAfterExit=yes
ExecStartPre=/usr/bin/sleep 10
ExecStart=/usr/bin/modprobe brcmfmac
ExecStart=/usr/bin/sleep 2
ExecStart=/usr/bin/ip link set wlp2s0 up
ExecStart=/usr/bin/sleep 2
ExecStart=/usr/bin/systemctl start NetworkManager
ExecStart=/usr/bin/sleep 2
ExecStart=/usr/bin/sudo -u $USER /bin/bash -lc 'nmcli networking on'
ExecStart=/usr/bin/sleep 2
ExecStart=/usr/bin/sudo -u $USER /bin/bash -lc 'nmcli r wifi off'
ExecStart=/usr/bin/sleep 2
ExecStart=/usr/bin/sudo -u $USER /bin/bash -lc 'nmcli r wifi on'

[Install]
WantedBy=suspend.target

If your adapter ID is different than “wlp2s0” you will need to substitute you own adapter’s ID into the service files.

If your driver module is different than “brcmfmac” you will need to substitute you own module into the service files.

After creating the services files, you must enable both services:

sudo systemctl enable network-suspend.service

sudo systemctl enable network-resume.service

Then reboot and test if your suspend/resume function is working properly now.

1 Like

Okay, Following the directions above I determined my 12"MBR was looking for BCM20702A1-0a5c-21e8.hcd and not finding it I got the -2 error. I followed the directions downloaded the github.com/winterheart/broadcom-bt-firmware did the modprobe thing and no joy. So per directions I completely shutdown and then restarted.

The -2 error is gone, now I get -110 error see below…

dmesg | grep -i bluetooth
[    3.201719] Bluetooth: Core ver 2.22
[    3.201736] Bluetooth: HCI device and connection manager initialized
[    3.201739] Bluetooth: HCI socket layer initialized
[    3.201742] Bluetooth: L2CAP socket layer initialized
[    3.201745] Bluetooth: SCO socket layer initialized
[    3.299227] Bluetooth: HCI UART driver ver 2.3
[    3.299229] Bluetooth: HCI UART protocol H4 registered
[    3.304344] Bluetooth: HCI UART protocol BCSP registered
[    3.304376] Bluetooth: HCI UART protocol LL registered
[    3.304377] Bluetooth: HCI UART protocol ATH3K registered
[    3.304394] Bluetooth: HCI UART protocol Three-wire (H5) registered
[    3.304436] Bluetooth: HCI UART protocol Intel registered
[    3.304485] Bluetooth: HCI UART protocol Broadcom registered
[    3.304495] Bluetooth: HCI UART protocol QCA registered
[    3.304496] Bluetooth: HCI UART protocol AG6XX registered
[    3.304497] Bluetooth: HCI UART protocol Marvell registered
[    3.422490] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[    3.422492] Bluetooth: BNEP filters: protocol multicast
[    3.422496] Bluetooth: BNEP socket layer initialized
[    5.565938] Bluetooth: hci0: command 0xfc18 tx timeout
[   13.459142] Bluetooth: hci0: BCM: failed to write update baudrate (-110)
[   13.459145] Bluetooth: hci0: Failed to set baudrate
[   15.592528] Bluetooth: hci0: command 0x0c03 tx timeout
[   23.485923] Bluetooth: hci0: BCM: Reset failed (-110)

Probably goes without saying but the adapter does not show up in system-settings

bluez is already installed. blueman and bluez-utils are not installed at this writing. Should I install them? Don’t know if it’s relevant or not but when I plug in the usb bt adapter that fires right up without the utils or blueman installed.

Cant speak much to it now, and until tbg returns … heres some light reading that may or may not help:
https://wiki.archlinux.org/index.php/Bluetooth

Please post:

sudo rfkill list all

Here’s some more light reading:

According to sources on that thread:

The reason for the timeout (-110 is -ETIMEDOUT) is the wrong baudrate being used

sudo rfkill list all

gets me…

0: hci0: Bluetooth
        Soft blocked: no
        Hard blocked: no
1: phy0: Wireless LAN
        Soft blocked: yes
        Hard blocked: no
2: hci1: Bluetooth
        Soft blocked: no
        Hard blocked: no

So I read thru the post. Poster roadrunner2 said he got it mostly working combining patches with another patch he displayed there.

I don’t even know where to st art in duplicating what he did.

I mean, I have questions like…

  • Where are the patches he referred to and how do I install them?
  • The patch he posted, what programming language is that and how do I do that?

If I understand correctly, in the post he’s working on the laptop I have; the 12" MBR.

According to your outputs we have a big contradiction. Your outputs say your wifi is not working at all.

You need to run this command:

sudo rfkill unblock all

Then post again:

sudo rfkill list all

I went to great trouble to write two services for the suspend issues you said you were having. Did you even test them?

Yeah I have the wifi off at the moment. Tethering my phone via USB. Either way I’d be using my phone. That’s my Internet source.

Wow! I’m sorry tbg, I totally blew by that post. I’m working nights and somewhere between going to sleep then trying to get after this again I just missed the network services suggestion. Scrolling back I did try the USB-restart service trick but totally missed trying the network services thing. I’ll get after that now.

I gave you very detailed instructions on how to install the winterhart Bluetooth firmware. Did you check that the PCI:ID matched for the firmware you installed as was given in my instructions. I believe you installed the wrong firmware because you never checked that you had the proper ID’s. You must uninstall the firmware you installed.

Instead install this Package from the AUR.

bcm4350-firmware

You obviously haven’t been paying much attention to my posts, because you’re just making things way harder on yourself.

(I thought they were trying and being nice and even mentioned accidentally missing your post and then stated intention to follow … too bad you both were writing at roughly the same time…)

Definitely trying and being nice @cscs, but you know how I start to get annoyed when my instructions aren’t followed correctly. The instructions were very explicit to cross check the chips ID.

Sorry , but I get rather curt when wasting time and effort.

Forum kindly sponsored by Bytemark