Bluetooth no longer works
kaylajrox opened this issue · comments
I tried running this exactly as the instructions. I have a MacbookPro14,1. I tried this because I couldn't connect to my bluetooth devices. I realized this was a mistake because I was using a mouse that runs off a bluetooth usb. I ran this script as instructed and rebooted and now my mouse no longer works. I figured I had changed something in my firmware, but I don't know how to revert back to my original settings. I tried removing the this directory I cloned and rebooting.
I tried to reboot via a new linux bootable with grub and start over and now I am getting errors and not able to reboot. Is there anyway I can uninstall this to revert back my settings?
or possibly try another command to get this to work? I am not that new to setting up linux on a windows computer, but this is my first time getting everything to work on a macbook
When you run the install.bluetooth.sh
script, it just compiles the hci_uart.ko
module and copies it here:
/lib/modules/$(uname -r)/updates/hci_uart.ko
It basically just overrides the stock kernel module found here
/lib/modules/$(uname -r)/kernel/drivers/bluetooth/hci_uart.ko
If you're having issue with it, just the delete the module with
rm /lib/modules/$(uname -r)/updates/hci_uart.ko
and run depmod -a
and reboot as it might be a bit difficult to reload every dependent bluetooth module. That's pretty much it.
I was using a mouse that runs off a bluetooth usb
I'm trying to understand what you mean by that. Could you clarify?
This module has absolutely nothing to do with the btusb driver or with usb at all.
[root@mac ~]# lsmod | egrep 'bt|blue|hci_uart'
hci_uart 155648 0
btqca 24576 1 hci_uart
btrtl 28672 1 hci_uart
btbcm 20480 1 hci_uart
btintel 36864 1 hci_uart
bluetooth 675840 46 btrtl,btqca,btintel,hci_uart,btbcm,bnep,rfcomm
rfkill 32768 6 bluetooth,cfg80211
Can you post the output of this command?
[root@mac ~]# echo list | bluetoothctl
Agent registered
[CHG] Controller 78:4F:43:53:8E:2C Pairable: yes
[bluetooth]# list
Controller 78:4F:43:53:8E:2C mac.example.com [default]
How many controllers do you see?
Here is the output of the first command:
root@kayla-MacBookPro:~# lsmod | egrep 'bt|blue|hci_uart'
hci_uart 126976 0
btqca 20480 1 hci_uart
btrtl 24576 1 hci_uart
btbcm 16384 1 hci_uart
btintel 24576 1 hci_uart
bluetooth 581632 13 btrtl,btqca,btintel,hci_uart,btbcm,bnep
ecdh_generic 16384 1 bluetooth
and the output of the second.
[bluetooth]# list
Agent registered
I was using a mouse that runs off a bluetooth usb: Sorry, I should have clarified on this. I use a logitech mouse which connects the computer via a usb plug. I am still a bit new to this, but when I ran the script as instructed and rebooted this functionality did not work anymore and I could only use a wired mouse connection. I wasn't sure if when I ran this script that it could've rewritten something in my computer's firmware.
I also was able to successfully reboot my computer with a bootable, and when I did this the first time I was immediately able to plug in this mouse and use it, but it does not work anymore.
Thanks!!
I find this weird because I have a Macbook14,1 which should work with this driver regardless. Maybe it isnt this that is the issue ..
When you say reboot my computer with a bootable
-- what you mean by that? You're just booting with your system with a different kernel right?
And when you say I use a logitech mouse which connects the computer via a usb plug
What kind of plug/mouse is it? Is it a 2.4GHz mouse? If that's the case, then that has absolutely nothing to do with bluetooth as that would run off radio waves. Does that mouse work on another system?
Could you run lsusb
and post the line showing that mouse device?
Also when you ran
[bluetooth]# list
Agent registered
That's really odd that it didn't show a bluetooth controller. Were you using the stock hci_uart
module or the one compiled and installed from this project?
Can you post the output of
[root@black ~]# rfkill
ID TYPE DEVICE SOFT HARD
0 wlan phy0 blocked unblocked
3 bluetooth hci0 unblocked unblocked
And the output of
journalctl -b | egrep -i 'blue|hci_uart'
I'm particularily interested in this section
Aug 08 01:04:25 mac.example.com kernel: Bluetooth: hci0: BCM: chip id 92
Aug 08 01:04:25 mac.example.com kernel: Bluetooth: hci0: BCM: features 0x2f
Aug 08 01:04:25 mac.example.com kernel: Bluetooth: hci0: BCM4350C0 UART 37.4 MHz Gamay Murata UHE
Aug 08 01:04:25 mac.example.com kernel: Bluetooth: hci0: BCM (003.001.126) build 1492
Aug 08 01:04:25 mac.example.com kernel: Bluetooth: hci0: BCM: firmware Patch file not found, tried:
Aug 08 01:04:25 mac.example.com kernel: Bluetooth: hci0: BCM: 'brcm/BCM.hcd'
A failure would look like this:
Bluetooth: hci0: command 0xfc18 tx timeout
Bluetooth: hci0: BCM: failed to write update baudrate (-110)
This is issue that the hci_uart
module from this project is meant to resolve.
When I say: Reboot my computer with a bootable I downloaded the .iso file of ubuntu 20.04 and reconfigured the usb with rufus to make a bootable.
This is the type of mouse I am using: https://www.amazon.com/dp/B087Z6LSHW?ref=ppx_yo2_dt_b_product_details&th=1
Output of lsusb
When I connect the mouse this is the output of lsusb
kayla@kayla-MacBookPro:~$ lsusb
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 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 005: ID 046d:c52b Logitech, Inc. Unifying Receiver
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
so its definitely being received and there as "logitech"
When I first rebooted my MacOS to be Ubuntu, I plugged this in and turned it on and it worked just fine. I wasn't sure if my bluetooth was fully working so I tried running this repo with the following commands from readme and only these commands:
apt install wget make gcc linux-headers-generic
git clone https://github.com/leifliddy/macbook12-bluetooth-driver.git
cd macbook12-bluetooth-driver/
# run the following command as root or with sudo
./install.bluetooth.driver.sh
reboot
I ran the second block all at once and it immediately rebooted and when I rebooted the mouse did not work.
Here is the output of rfkill
root@kayla-MacBookPro:~# rfkill
ID TYPE DEVICE SOFT HARD
0 bluetooth hci0 unblocked unblocked
1 wlan phy0 unblocked unblocked
and the output of the other command
kayla@kayla-MacBookPro:~$ journalctl -b | egrep -i 'blue|hci_uart'
Aug 11 01:35:09 kayla-MacBookPro kernel: Bluetooth: Core ver 2.22
Aug 11 01:35:09 kayla-MacBookPro kernel: Bluetooth: HCI device and connection manager initialized
Aug 11 01:35:09 kayla-MacBookPro kernel: Bluetooth: HCI socket layer initialized
Aug 11 01:35:09 kayla-MacBookPro kernel: Bluetooth: L2CAP socket layer initialized
Aug 11 01:35:09 kayla-MacBookPro kernel: Bluetooth: SCO socket layer initialized
Aug 11 01:35:09 kayla-MacBookPro kernel: Bluetooth: HCI UART driver ver 2.3
Aug 11 01:35:09 kayla-MacBookPro kernel: Bluetooth: HCI UART protocol H4 registered
Aug 11 01:35:09 kayla-MacBookPro kernel: Bluetooth: HCI UART protocol BCSP registered
Aug 11 01:35:09 kayla-MacBookPro kernel: Bluetooth: HCI UART protocol LL registered
Aug 11 01:35:09 kayla-MacBookPro kernel: Bluetooth: HCI UART protocol ATH3K registered
Aug 11 01:35:09 kayla-MacBookPro kernel: Bluetooth: HCI UART protocol Three-wire (H5) registered
Aug 11 01:35:09 kayla-MacBookPro kernel: Bluetooth: HCI UART protocol Intel registered
Aug 11 01:35:09 kayla-MacBookPro kernel: Bluetooth: HCI UART protocol Broadcom registered
Aug 11 01:35:09 kayla-MacBookPro kernel: Bluetooth: HCI UART protocol QCA registered
Aug 11 01:35:09 kayla-MacBookPro kernel: Bluetooth: HCI UART protocol AG6XX registered
Aug 11 01:35:09 kayla-MacBookPro kernel: Bluetooth: HCI UART protocol Marvell registered
Aug 11 01:35:09 kayla-MacBookPro kernel: hci_uart_bcm serial0-0: Unexpected ACPI gpio_int_idx: -1
Aug 11 01:35:09 kayla-MacBookPro kernel: hci_uart_bcm serial0-0: Unexpected number of ACPI GPIOs: 0
Aug 11 01:35:09 kayla-MacBookPro kernel: hci_uart_bcm serial0-0: No reset resource, using default baud rate
Aug 11 01:35:11 kayla-MacBookPro kernel: Bluetooth: hci0: command 0xfc18 tx timeout
Aug 11 01:35:12 kayla-MacBookPro systemd[1]: Starting Bluetooth service...
Aug 11 01:35:12 kayla-MacBookPro bluetoothd[599]: Bluetooth daemon 5.53
Aug 11 01:35:12 kayla-MacBookPro systemd[1]: Started Bluetooth service.
Aug 11 01:35:12 kayla-MacBookPro systemd[1]: Reached target Bluetooth.
Aug 11 01:35:12 kayla-MacBookPro bluetoothd[599]: Starting SDP server
Aug 11 01:35:12 kayla-MacBookPro kernel: Bluetooth: BNEP (Ethernet Emulation) ver 1.3
Aug 11 01:35:12 kayla-MacBookPro kernel: Bluetooth: BNEP filters: protocol multicast
Aug 11 01:35:12 kayla-MacBookPro kernel: Bluetooth: BNEP socket layer initialized
Aug 11 01:35:12 kayla-MacBookPro dbus-daemon[603]: [system] Activating via systemd: service name='org.freedesktop.hostname1' unit='dbus-org.freedesktop.hostname1.service' requested by ':1.3' (uid=0 pid=599 comm="/usr/lib/bluetooth/bluetoothd " label="unconfined")
Aug 11 01:35:12 kayla-MacBookPro bluetoothd[599]: Bluetooth management interface 1.14 initialized
Aug 11 01:35:12 kayla-MacBookPro NetworkManager[605]: <info> [1628660112.9194] Loaded device plugin: NMBluezManager (/usr/lib/x86_64-linux-gnu/NetworkManager/1.22.10/libnm-device-plugin-bluetooth.so)
Aug 11 01:35:20 kayla-MacBookPro kernel: Bluetooth: hci0: BCM: failed to write update baudrate (-110)
Aug 11 01:35:20 kayla-MacBookPro kernel: Bluetooth: hci0: Failed to set baudrate
Aug 11 01:35:22 kayla-MacBookPro kernel: Bluetooth: hci0: command 0x0c03 tx timeout
Aug 11 01:35:24 kayla-MacBookPro /usr/lib/gdm3/gdm-x-session[1317]: (II) modeset(0): blueX: 0.152 blueY: 0.053 whiteX: 0.312 whiteY: 0.329
Aug 11 01:35:30 kayla-MacBookPro kernel: Bluetooth: hci0: BCM: Reset failed (-110)
Aug 11 02:35:52 kayla-MacBookPro bluetoothd[599]: Terminating
Aug 11 02:35:52 kayla-MacBookPro systemd[1]: Stopping Bluetooth service...
Aug 11 02:35:52 kayla-MacBookPro bluetoothd[599]: Stopping SDP server
Aug 11 02:35:52 kayla-MacBookPro dbus-daemon[603]: [system] Rejected send message, 0 matched rules; type="error", sender=":1.75" (uid=1000 pid=1224 comm="/usr/bin/pulseaudio --daemonize=no --log-target=jo" label="unconfined") interface="(unset)" member="(unset)" error name="org.freedesktop.DBus.Error.UnknownMethod" requested_reply="0" destination=":1.3" (uid=0 pid=599 comm="/usr/lib/bluetooth/bluetoothd " label="unconfined")
Aug 11 02:35:52 kayla-MacBookPro bluetoothd[599]: Exit
Aug 11 02:35:52 kayla-MacBookPro dbus-daemon[603]: [system] Rejected send message, 0 matched rules; type="error", sender=":1.75" (uid=1000 pid=1224 comm="/usr/bin/pulseaudio --daemonize=no --log-target=jo" label="unconfined") interface="(unset)" member="(unset)" error name="org.freedesktop.DBus.Error.UnknownMethod" requested_reply="0" destination=":1.3" (uid=0 pid=599 comm="/usr/lib/bluetooth/bluetoothd " label="unconfined")
Aug 11 02:35:52 kayla-MacBookPro systemd[1]: bluetooth.service: Succeeded.
Aug 11 02:35:52 kayla-MacBookPro systemd[1]: Stopped Bluetooth service.
Aug 11 02:35:52 kayla-MacBookPro systemd[1]: Starting Bluetooth service...
Aug 11 02:35:52 kayla-MacBookPro bluetoothd[37488]: Bluetooth daemon 5.53
Aug 11 02:35:52 kayla-MacBookPro bluetoothd[37488]: Starting SDP server
Aug 11 02:35:52 kayla-MacBookPro systemd[1]: Started Bluetooth service.
Aug 11 02:35:52 kayla-MacBookPro dbus-daemon[603]: [system] Activating via systemd: service name='org.freedesktop.hostname1' unit='dbus-org.freedesktop.hostname1.service' requested by ':1.140' (uid=0 pid=37488 comm="/usr/lib/bluetooth/bluetoothd " label="unconfined")
Aug 11 02:35:52 kayla-MacBookPro bluetoothd[37488]: Bluetooth management interface 1.14 initialized
Aug 11 02:36:30 kayla-MacBookPro NetworkManager[42764]: <info> [1628663790.4192] Loaded device plugin: NMBluezManager (/usr/lib/x86_64-linux-gnu/NetworkManager/1.22.10/libnm-device-plugin-bluetooth.so)
I also want to note, I haven't tried installing the repo here after I rebooted
So that mouse can connect to a wireless receiver (aka usb plug) or bluetooth. If you have it connected to the wireless receiver then it has nothing to do with bluetooth at all. I'm not sure how you're connecting these two events together as they're completely unrelated.
Have you tried to use that mouse in another systm? Please try that.
I can see that your bluetooth controller isn't even working
Aug 11 01:35:09 kayla-MacBookPro kernel: hci_uart_bcm serial0-0: Unexpected ACPI gpio_int_idx: -1
Aug 11 01:35:09 kayla-MacBookPro kernel: hci_uart_bcm serial0-0: Unexpected number of ACPI GPIOs: 0
Aug 11 01:35:09 kayla-MacBookPro kernel: hci_uart_bcm serial0-0: No reset resource, using default baud rate
Aug 11 01:35:11 kayla-MacBookPro kernel: Bluetooth: hci0: command 0xfc18 tx timeout
Which means that you must not have the /lib/modules/$(uname -r)/updates/hci_uart.ko
module that this project creates.
Also, you shouldn't really run these commands as a block
git clone https://github.com/leifliddy/macbook12-bluetooth-driver.git
cd macbook12-bluetooth-driver/
# run the following command as root or with sudo
./install.bluetooth.driver.sh
reboot
Don't reboot until you verify that the module was compiled and installed successfully (just for your own situational awareness).
You can see the make install
command runs the following --ref Makefile
install:
cp hci_uart.ko /lib/modules/$(shell uname -r)/updates
depmod -a
and the last line of install.bluetooth.sh
shows you the following
echo -e "\ncontents of $update_dir"
ls -lA $update_dir
When you run the script, the last part should look something like this
.....
LD [M] /root/git.projects/macbook12-bluetooth-driver/build/bluetooth-5.13.7/hci_uart.o
MODPOST /root/git.projects/macbook12-bluetooth-driver/build/bluetooth-5.13.7/Module.symvers
CC [M] /root/git.projects/macbook12-bluetooth-driver/build/bluetooth-5.13.7/hci_uart.mod.o
LD [M] /root/git.projects/macbook12-bluetooth-driver/build/bluetooth-5.13.7/hci_uart.ko
BTF [M] /root/git.projects/macbook12-bluetooth-driver/build/bluetooth-5.13.7/hci_uart.ko
Skipping BTF generation for /root/git.projects/macbook12-bluetooth-driver/build/bluetooth-5.13.7/hci_uart.ko due to unavailability of vmlinux
make[1]: Leaving directory '/usr/src/kernels/5.13.7-200.fc34.x86_64'
strip --strip-debug hci_uart.ko
cp hci_uart.ko /lib/modules/5.13.7-200.fc34.x86_64/updates
depmod -a
contents of /lib/modules/5.13.7-200.fc34.x86_64/updates
total 468
-rw-r--r--. 1 root root 320928 Aug 11 16:26 hci_uart.ko
You can see that in this example, it simply
- compiled the
hci_uart.ko
module - copied the
hci_uart.ko
module to/lib/modules/5.13.7-200.fc34.x86_64/updates
- and then ran
depmod -a
It then shows you the contents of /lib/modules/$(uname -r)/updates/
so you can verify the module was actually copied there.
I don't know what else you think this project is doing or how it could have possibly affected the operation of a mouse connected to a wireless receiver. I don't get it....
Anyways, I hope this helps.
Yea, when I ran it as a block I didn't realize it would reboot, so that was definitely a mistake! Okay so I compiled the driver again step by step. My initial error (below) looks exactly as the error on this page #13 except for a different header. Here is the error log for reference
make[1]: Entering directory '/usr/src/linux-headers-5.11.0-25-generic'
CC [M] /home/kayla/macbook_config/macbook12-bluetooth-driver/build/bluetooth-5.11.0/hci_ldisc.o
/home/kayla/macbook_config/macbook12-bluetooth-driver/build/bluetooth-5.11.0/hci_ldisc.c: In function ‘hci_uart_init’:
/home/kayla/macbook_config/macbook12-bluetooth-driver/build/bluetooth-5.11.0/hci_ldisc.c:836:23: error: assignment to ‘ssize_t (*)(struct tty_struct *, struct file *, unsigned char *, size_t, void **, long unsigned int)’ {aka ‘long int (*)(struct tty_struct *, struct file *, unsigned char *, long unsigned int, void **, long unsigned int)’} from incompatible pointer type ‘ssize_t (*)(struct tty_struct *, struct file *, unsigned char *, size_t)’ {aka ‘long int (*)(struct tty_struct *, struct file *, unsigned char *, long unsigned int)’} [-Werror=incompatible-pointer-types]
836 | hci_uart_ldisc.read = hci_uart_tty_read;
| ^
cc1: some warnings being treated as errors
make[2]: *** [scripts/Makefile.build:287: /home/kayla/macbook_config/macbook12-bluetooth-driver/build/bluetooth-5.11.0/hci_ldisc.o] Error 1
make[1]: *** [Makefile:1848: /home/kayla/macbook_config/macbook12-bluetooth-driver/build/bluetooth-5.11.0] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-5.11.0-25-generic'
make: *** [Makefile:19: all] Error 2
cp hci_uart.ko /lib/modules/5.11.0-25-generic/updates
cp: cannot stat 'hci_uart.ko': No such file or directory
make: *** [Makefile:26: install] Error 1
contents of /lib/modules/5.11.0-25-generic/updates
total 0
I followed the thread and tried modifying the hci_ldisc.c with the changes you suggested in #13, and when I tried running the make command I got the following error:
make -C /lib/modules/5.11.0-25-generic/build M= modules
make[1]: Entering directory '/usr/src/linux-headers-5.11.0-25-generic'
SYNC include/config/auto.conf.cmd
HOSTCC scripts/basic/fixdep
HOSTCC scripts/kconfig/conf.o
HOSTCC scripts/kconfig/confdata.o
HOSTCC scripts/kconfig/expr.o
LEX scripts/kconfig/lexer.lex.c
/bin/sh: 1: flex: not found
make[3]: *** [scripts/Makefile.host:9: scripts/kconfig/lexer.lex.c] Error 127
make[2]: *** [Makefile:629: syncconfig] Error 2
make[1]: *** [Makefile:737: include/config/auto.conf.cmd] Error 2
make[1]: *** [include/config/auto.conf.cmd] Deleting file 'include/generated/autoconf.h'
make[1]: Leaving directory '/usr/src/linux-headers-5.11.0-25-generic'
make: *** [Makefile:19: all] Error 2
When that didnt work, I then tried to run solution #12 where I ran ./install.bluetooth.sh
it failed, so I ran
kayla@kayla-MacBookPro:~/macbook_config/macbook12-bluetooth-driver/build/bluetooth-5.11.0$ sudo sed -i 's/size_t nr/size_t nt, void **cookie, unsigned long offset/' hci_ldisc.c
then I cd build/bluetooth-5.10.0/
and did sudo make
and got this error
kayla@kayla-MacBookPro:~/macbook_config/macbook12-bluetooth-driver/build/bluetooth-5.11.0$ sudo make
make -C /lib/modules/5.11.0-25-generic/build M= modules
make[1]: Entering directory '/usr/src/linux-headers-5.11.0-25-generic'
SYNC include/config/auto.conf.cmd
LEX scripts/kconfig/lexer.lex.c
/bin/sh: 1: flex: not found
make[3]: *** [scripts/Makefile.host:9: scripts/kconfig/lexer.lex.c] Error 127
make[2]: *** [Makefile:629: syncconfig] Error 2
make[1]: *** [Makefile:737: include/config/auto.conf.cmd] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-5.11.0-25-generic'
make: *** [Makefile:19: all] Error 2
And yea, probably your repo has nothing to do with my mouse messing up, that was probably my own doing by accidently rebooting it when I wasn't supposed to. Still a bit new at this, but I think I am learning
What OS + version are you using? Judging from that 5.11.0-25-generic
kernel name, I'm guessing you're using Debian or a Debian derivative like Ubuntu.
Can't you just install flex with apt install flex
?
Accidentally rebooting your system, powering off your system...etc will not make your mouse inoperable. I've asked this question twice already, but....does that mouse work on another system?
I was thinking that rebooting the system changed it because of it being in the midst of changing firmware. I was just trying to come up with an explanation, but it sounds like that explanation it wrong.
I am using Ubuntu 20.04.2. I just installed flex. Should I try rerunning the commands in read me now that flex is installed?
The mouse works on a different system (Ubuntu 20.04.2 specifically). I had to change up the settings on the mouse for it to work on this system and actually that did the trick.... so definitely something dumb on my part.
A dumb question: would installing these drivers allow me to connect other bluetooth devices that do not have a usb to plug in? That is what I am assuming, I wanted to be able to connect bluetooth devices that don't have usb plugs. If so, how would I debug the last error?
Also, thank you so much for your help, I know it might be a bit frustrating so I appreciate it.
Yes, install flex
then try installing the module again.
If you look at the description of that mouse:
https://www.amazon.com/dp/B087Z6LSHW
It states USB/Bluetooth Wireless connection
which means you can connect to that mouse via 2 methods.
- via the usb receiver (usb plug)
- or by bluetooth (which doesn't use the usb receiver -- because it's using bluetooth)
**just look at the first question on the amazon page:
Why does this mouse have a dongle if it is Bluetooth?
When you install the hci_uart
module from this project -- the bluetooth controller should work and you'll be able to pair any bluetooth device to it: mouse, headphones, speaker...whatever.
Instructions for how to pair that mouse via bluetooth:
https://www.logitech.com/assets/64937/m720-web-qsg.pdf (page 5)
How to pair a Bluetooth device:
1. Make sure your M720 is turned on
2. Press and hold the toggle button below the display
for 3 seconds (the LED on selected channel will start
to blink fast)
3. Open Bluetooth settings or Bluetooth device manager
on your device and pair with “M720 Triathlon Mouse”
Okay I went into the directory and here is the output of the ./install.bluetooth.driver.sh
command
kayla@kayla-MacBookPro:~/macbook_config/macbook12-bluetooth-driver$ sudo ./install.bluetooth.sh
--2021-08-11 23:26:48-- https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.11.0.tar.xz
Resolving cdn.kernel.org (cdn.kernel.org)... 151.101.1.176, 151.101.65.176, 151.101.129.176, ...
Connecting to cdn.kernel.org (cdn.kernel.org)|151.101.1.176|:443... connected.
HTTP request sent, awaiting response... 404 Not Found
2021-08-11 23:26:48 ERROR 404: Not Found.
--2021-08-11 23:26:48-- https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.11.tar.xz
Resolving cdn.kernel.org (cdn.kernel.org)... 151.101.193.176, 151.101.129.176, 151.101.65.176, ...
Connecting to cdn.kernel.org (cdn.kernel.org)|151.101.193.176|:443... connected.
HTTP request sent, awaiting response... 416 Range Not Satisfiable
The file is already fully retrieved; nothing to do.
tar --strip-components=2 -xvf build/linux-5.11.tar.xz linux-5.11/drivers/bluetooth --directory=build/
linux-5.11/drivers/bluetooth/
linux-5.11/drivers/bluetooth/Kconfig
linux-5.11/drivers/bluetooth/Makefile
linux-5.11/drivers/bluetooth/ath3k.c
linux-5.11/drivers/bluetooth/bcm203x.c
linux-5.11/drivers/bluetooth/bfusb.c
linux-5.11/drivers/bluetooth/bluecard_cs.c
linux-5.11/drivers/bluetooth/bpa10x.c
linux-5.11/drivers/bluetooth/bt3c_cs.c
linux-5.11/drivers/bluetooth/btbcm.c
linux-5.11/drivers/bluetooth/btbcm.h
linux-5.11/drivers/bluetooth/btintel.c
linux-5.11/drivers/bluetooth/btintel.h
linux-5.11/drivers/bluetooth/btmrvl_debugfs.c
linux-5.11/drivers/bluetooth/btmrvl_drv.h
linux-5.11/drivers/bluetooth/btmrvl_main.c
linux-5.11/drivers/bluetooth/btmrvl_sdio.c
linux-5.11/drivers/bluetooth/btmrvl_sdio.h
linux-5.11/drivers/bluetooth/btmtksdio.c
linux-5.11/drivers/bluetooth/btmtkuart.c
linux-5.11/drivers/bluetooth/btqca.c
linux-5.11/drivers/bluetooth/btqca.h
linux-5.11/drivers/bluetooth/btqcomsmd.c
linux-5.11/drivers/bluetooth/btrsi.c
linux-5.11/drivers/bluetooth/btrtl.c
linux-5.11/drivers/bluetooth/btrtl.h
linux-5.11/drivers/bluetooth/btsdio.c
linux-5.11/drivers/bluetooth/btusb.c
linux-5.11/drivers/bluetooth/dtl1_cs.c
linux-5.11/drivers/bluetooth/h4_recv.h
linux-5.11/drivers/bluetooth/hci_ag6xx.c
linux-5.11/drivers/bluetooth/hci_ath.c
linux-5.11/drivers/bluetooth/hci_bcm.c
linux-5.11/drivers/bluetooth/hci_bcsp.c
linux-5.11/drivers/bluetooth/hci_h4.c
linux-5.11/drivers/bluetooth/hci_h5.c
linux-5.11/drivers/bluetooth/hci_intel.c
linux-5.11/drivers/bluetooth/hci_ldisc.c
linux-5.11/drivers/bluetooth/hci_ll.c
linux-5.11/drivers/bluetooth/hci_mrvl.c
linux-5.11/drivers/bluetooth/hci_nokia.c
linux-5.11/drivers/bluetooth/hci_qca.c
linux-5.11/drivers/bluetooth/hci_serdev.c
linux-5.11/drivers/bluetooth/hci_uart.h
linux-5.11/drivers/bluetooth/hci_vhci.c
make -C /lib/modules/5.11.0-25-generic/build M=/home/kayla/macbook_config/macbook12-bluetooth-driver/build/bluetooth-5.11.0 modules
make[1]: Entering directory '/usr/src/linux-headers-5.11.0-25-generic'
ERROR: Kernel configuration is invalid.
include/generated/autoconf.h or include/config/auto.conf are missing.
Run 'make oldconfig && make prepare' on kernel src to fix it.
make[1]: *** [Makefile:745: include/config/auto.conf] Error 1
make[1]: Leaving directory '/usr/src/linux-headers-5.11.0-25-generic'
make: *** [Makefile:19: all] Error 2
cp hci_uart.ko /lib/modules/5.11.0-25-generic/updates
cp: cannot stat 'hci_uart.ko': No such file or directory
make: *** [Makefile:26: install] Error 1
contents of /lib/modules/5.11.0-25-generic/updates
total 0
The top seems to be okay, and I have tried fixing the hci_ldisc.c file to have
static ssize_t hci_uart_tty_read(struct tty_struct *tty, struct file *file,
unsigned char __user *buf, size_t nr,
void **cookie, unsigned long offset)
It says to try running make oldconfig && make prepare
within the kernel, should I do this within the same directory?
No, you don't need to run those commands. Something is wrong. Do you have the kernel headers installed?
apt install linux-headers-generic
If you do, try reinstalling them
apt install --reinstall linux-headers-generic
Also, after you've run the install.bluetooth.driver.sh
script, it'll overwrite your changes to hci_ldisc.c
so you just need to run that script once. Then cd to build/bluetooth-5.11.0
run that sed
command, and then make
+ make install
Actually, run make clean
first for good measure.
You could add that sed command to install.bluetooth,driver.sh
if you wanted to, but remember you won't need to modify hci_ldisc.c
once you hit kernel 5.11.3
I can setup a test ubuntu VM tomorrow if you're still having issues.
Okay, so I reinstalled linux-headers-generic
,
kayla@kayla-MacBookPro:~$ sudo apt install --reinstall linux-headers-generic
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
libfprint-2-tod1 libllvm10 shim
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 3 not upgraded.
Need to get 2,436 B of archives.
After this operation, 0 B of additional disk space will be used.
Get:1 http://us.archive.ubuntu.com/ubuntu focal-updates/main amd64 linux-headers-generic amd64 5.4.0.80.84 [2,436 B]
Fetched 2,436 B in 0s (5,236 B/s)
(Reading database ... 221984 files and directories currently installed.)
Preparing to unpack .../linux-headers-generic_5.4.0.80.84_amd64.deb ...
Unpacking linux-headers-generic (5.4.0.80.84) over (5.4.0.80.84) ...
Setting up linux-headers-generic (5.4.0.80.84) ...
I then ran the install.bluetooth.driver.sh
script within the macbook12-bluetooth-driver
directory. You say it will override my hci_ldisc.c
file, does this override anything in the file? I followed #13 and changed
static ssize_t hci_uart_tty_read(struct tty_struct *tty, struct file *file,
unsigned char __user *buf, size_t nr)
to
static ssize_t hci_uart_tty_read(struct tty_struct *tty, struct file *file,
unsigned char __user *buf, size_t nr,
void **cookie, unsigned long offset)
with the hci_ldisc.c
file.
I then ran the sed
command and that seemed to work just fine:
kayla@kayla-MacBookPro:~/macbook_config/macbook12-bluetooth-driver/build/bluetooth-5.11.0$ sudo sed -i 's/size_t nr/size_t nt, void **cookie, unsigned long offset/' hci_ldisc.c
So from here I ran make clean
and still seem to be having problems with my linux headers even after reinstalling it. This was the output:
kayla@kayla-MacBookPro:~/macbook_config/macbook12-bluetooth-driver/build/bluetooth-5.11.0$ sudo make clean
make -C /lib/modules/5.11.0-25-generic/build M= clean
make[1]: Entering directory '/usr/src/linux-headers-5.11.0-25-generic'
fs/aufs/Makefile:3: fs/aufs/magic.mk: No such file or directory
make[3]: *** No rule to make target 'fs/aufs/magic.mk'. Stop.
make[2]: *** [scripts/Makefile.clean:71: fs/aufs] Error 2
make[1]: *** [Makefile:1855: _clean_fs] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-5.11.0-25-generic'
make: *** [Makefile:23: clean] Error 2
I figured make
wouldn't do anything because of the errors with make clean
but I tried it anyway and here was the output in case this is also useful
kayla@kayla-MacBookPro:~/macbook_config/macbook12-bluetooth-driver/build/bluetooth-5.11.0$ sudo make
make -C /lib/modules/5.11.0-25-generic/build M= modules
make[1]: Entering directory '/usr/src/linux-headers-5.11.0-25-generic'
SYNC include/config/auto.conf.cmd
LEX scripts/kconfig/lexer.lex.c
YACC scripts/kconfig/parser.tab.[ch]
/bin/sh: 1: bison: not found
make[3]: *** [scripts/Makefile.host:17: scripts/kconfig/parser.tab.h] Error 127
make[3]: *** [scripts/kconfig/parser.tab.h] Deleting file 'scripts/kconfig/parser.tab.c'
make[2]: *** [Makefile:629: syncconfig] Error 2
make[1]: *** [Makefile:737: include/config/auto.conf.cmd] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-5.11.0-25-generic'
make: *** [Makefile:19: all] Error 2
And awesome, sounds great!
I can see in the output that bison
isn't found. So you need to install that with
apt install bison
Also, that sed command is what changes
static ssize_t hci_uart_tty_read(struct tty_struct *tty, struct file *file,
unsigned char __user *buf, size_t nr)
to
static ssize_t hci_uart_tty_read(struct tty_struct *tty, struct file *file,
unsigned char __user *buf, size_t nr,
void **cookie, unsigned long offset)
You don't need to do that manually.
Try installing bison
then run make
and post the output from that.
Okay I installed bison. My error is at least different now. Here is the output
kayla@kayla-MacBookPro:~/macbook_config/macbook12-bluetooth-driver/build/bluetooth-5.11.0$ sudo make
make -C /lib/modules/5.11.0-25-generic/build M= modules
make[1]: Entering directory '/usr/src/linux-headers-5.11.0-25-generic'
SYNC include/config/auto.conf.cmd
YACC scripts/kconfig/parser.tab.[ch]
HOSTCC scripts/kconfig/lexer.lex.o
HOSTCC scripts/kconfig/parser.tab.o
HOSTCC scripts/kconfig/preprocess.o
HOSTCC scripts/kconfig/symbol.o
HOSTCC scripts/kconfig/util.o
HOSTLD scripts/kconfig/conf
make[2]: *** No rule to make target 'arch/x86/tools/relocs_32.c', needed by 'arch/x86/tools/relocs_32.o'. Stop.
make[1]: *** [arch/x86/Makefile:211: archscripts] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-5.11.0-25-generic'
make: *** [Makefile:19: all] Error 2
I'm pretty confused as to why it's running
make -C /lib/modules/5.11.0-25-generic/build M= modules
It should be running something more like this
make -C /lib/modules/5.13.7-200.fc34.x86_64/build M=/root/git.projects/macbook12-bluetooth-driver/build/bluetooth-5.13.7 modules
It looks like that M=$(PWD)
in the Makefile
isn't being resolved correctly on your system
PWD is meant to be derived from an environmental variable
[root@black ~]# env | grep PWD
PWD=/root
But apparently that's not set on your system....
Try changing this
all:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
strip --strip-debug hci_uart.ko
clean:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
to this
all:
make -C /lib/modules/$(shell uname -r)/build M=$(shell pwd) modules
strip --strip-debug hci_uart.ko
clean:
make -C /lib/modules/$(shell uname -r)/build M=$(shell pwd) clean
And then post the output from that....
It that works, then I'll make that change in the Makefile
Okay. So I went in and changed the Makefile
as specified. I initially started from scratch and did the ./install command, but it rewrote my changes to the Makefile. So, I went in and changed the Makefile
again, ran make
and here was my output
kayla@kayla-MacBookPro:~/macbook_config/macbook12-bluetooth-driver/build/bluetooth-5.11.0$ sudo make
make -C /lib/modules/5.11.0-25-generic/build M=/home/kayla/macbook_config/macbook12-bluetooth-driver/build/bluetooth-5.11.0 modules
make[1]: Entering directory '/usr/src/linux-headers-5.11.0-25-generic'
CC [M] /home/kayla/macbook_config/macbook12-bluetooth-driver/build/bluetooth-5.11.0/hci_ldisc.o
CC [M] /home/kayla/macbook_config/macbook12-bluetooth-driver/build/bluetooth-5.11.0/hci_serdev.o
CC [M] /home/kayla/macbook_config/macbook12-bluetooth-driver/build/bluetooth-5.11.0/hci_h4.o
CC [M] /home/kayla/macbook_config/macbook12-bluetooth-driver/build/bluetooth-5.11.0/hci_bcsp.o
CC [M] /home/kayla/macbook_config/macbook12-bluetooth-driver/build/bluetooth-5.11.0/hci_ll.o
CC [M] /home/kayla/macbook_config/macbook12-bluetooth-driver/build/bluetooth-5.11.0/hci_ath.o
CC [M] /home/kayla/macbook_config/macbook12-bluetooth-driver/build/bluetooth-5.11.0/hci_h5.o
CC [M] /home/kayla/macbook_config/macbook12-bluetooth-driver/build/bluetooth-5.11.0/hci_intel.o
CC [M] /home/kayla/macbook_config/macbook12-bluetooth-driver/build/bluetooth-5.11.0/hci_bcm.o
CC [M] /home/kayla/macbook_config/macbook12-bluetooth-driver/build/bluetooth-5.11.0/hci_qca.o
CC [M] /home/kayla/macbook_config/macbook12-bluetooth-driver/build/bluetooth-5.11.0/hci_ag6xx.o
CC [M] /home/kayla/macbook_config/macbook12-bluetooth-driver/build/bluetooth-5.11.0/hci_mrvl.o
LD [M] /home/kayla/macbook_config/macbook12-bluetooth-driver/build/bluetooth-5.11.0/hci_uart.o
MODPOST /home/kayla/macbook_config/macbook12-bluetooth-driver/build/bluetooth-5.11.0/Module.symvers
CC [M] /home/kayla/macbook_config/macbook12-bluetooth-driver/build/bluetooth-5.11.0/hci_uart.mod.o
LD [M] /home/kayla/macbook_config/macbook12-bluetooth-driver/build/bluetooth-5.11.0/hci_uart.ko
make[1]: Leaving directory '/usr/src/linux-headers-5.11.0-25-generic'
strip --strip-debug hci_uart.ko
and then ran make install
and received
kayla@kayla-MacBookPro:~/macbook_config/macbook12-bluetooth-driver/build/bluetooth-5.11.0$ sudo make install
cp hci_uart.ko /lib/modules/5.11.0-25-generic/updates
depmod -a
which looks very promising!
Yup, that looks good! Ok, I've modified the Makefile
to use shell pwd
to get the current directory -- so that should be compatible on systems that don't have a PWD
env variable defined. But....I'm not going to create a "fix" for that hci_ldisc.c
issue as it's Debian/Ubuntu-specific and it's due to those distros not using the actual stock 5.11.0
kernel. I never had that issue on Fedora....just sayin ; )
I hope everything is working for you now...
Haha good to know! Everything looks fine now! I am rerunning some of the commands earlier which indicated problems and it looks like yours how its supposed to. Now I am going to see if I can try and connect some headphones via bluetooth with this..
Thanks again!
It sees devices!!! YAY! Thank you!!
Successful connection!