mirror of
				https://github.com/NixOS/nixos-hardware.git
				synced 2025-11-04 17:27:14 +08:00 
			
		
		
		
	Extracted from my system configs. There's still a few issues with this machine: 1. Audio is a lost cause. Will probably need to bribe an Apple or Cirrus engineer for the datasheet. 2. The thunderbolt module will oops upon system resume, and subsequently refuse to work until next reboot. 3. The d3cold state needs to be disabled on the NVME controller for it to wake up. 4. The Bluetooth UART (/dev/ttyS0) is created and then deleted by udev in early boot. I am yet to figure out why. Hack around it by reloading the 8250_dw module, causing it to be re-created.
		
			
				
	
	
		
			39 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			39 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
#!/usr/bin/env bash
 | 
						|
 | 
						|
set -euo pipefail
 | 
						|
 | 
						|
##
 | 
						|
# For some reason /dev/ttyS0 is created, and then removed by udev. We need this
 | 
						|
# for bluetooth, and the only way to get it again is to reload 8502_dw. Do so.
 | 
						|
##
 | 
						|
 | 
						|
 | 
						|
##
 | 
						|
# /sys/devices/pci0000:00/0000:00:1e.0/driver -> intel-lpss
 | 
						|
# /sys/bus/pci/devices/0000:00:1e.0
 | 
						|
# /sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:8a/BCM2E7C:00
 | 
						|
##
 | 
						|
 | 
						|
# udevadm info --query=all --path=/sys/bus/serial/devices/serial0-0
 | 
						|
# P: /devices/pci0000:00/0000:00:1e.0/dw-apb-uart.2/serial0/serial0-0
 | 
						|
# M: serial0-0
 | 
						|
# R: 0
 | 
						|
# U: serial
 | 
						|
# E: DEVPATH=/devices/pci0000:00/0000:00:1e.0/dw-apb-uart.2/serial0/serial0-0
 | 
						|
# E: SUBSYSTEM=serial
 | 
						|
# E: MODALIAS=acpi:BCM2E7C:APPLE-UART-BLTH:
 | 
						|
# E: USEC_INITIALIZED=12406199
 | 
						|
# E: PATH=/nix/store/56jhf2k9q31gwvhjxmm2akkkhi4a8nz1-udev-path/bin:/nix/store/56jhf2k9q31gwvhjxmm2akkkhi4a8nz1-udev-path/sbin
 | 
						|
# E: ID_VENDOR_FROM_DATABASE=Broadcom
 | 
						|
 | 
						|
 | 
						|
if [[ ! -e "/sys/devices/pci0000:00/0000:00:1e.0/dw-apb-uart.2/tty/ttyS0" ]]; then
 | 
						|
    if [[ -e /sys/module/8250_dw ]]; then
 | 
						|
        rmmod 8250_dw
 | 
						|
    fi
 | 
						|
 | 
						|
    modprobe 8250_dw
 | 
						|
fi
 | 
						|
 | 
						|
exec btattach --protocol=h4 --bredr=/dev/ttyS0 --speed=3000000
 |