# Bluetooth kernel upgrade
My bluetooth drivers of Ubuntu usually fail, so I record the steps I have done today for the future need.(for the time it fails again :laughing: )
## Problems description
Ubuntu's bluetooth driver can not find the bluetooth mouse after turned on.

## The possible causes
https://www.autodesk.com/products/eagle/blog/wifi-vs-bluetooth-wireless-electronics-basics/
## Solutions
### sol 1. Check the hardware by terminal then find the kernel
```
lshw
```
the best tools to check the hardware the can be seen under Linux on a specific system.
```
sudo lshw -businfo
sudo lshw //deeper
```
other commands:
```
lsusb //for usb connected devices
lspci //for PCI-attached hardware like GPU, audio device, ethernet controller, usb controller, and DRAM
lsscsi //for storage devices using the SCSI layer like disk
//not installed in default in Ubuntu 18.04
```
When Ubuntu running startup, it would display some informations including each hardware and disk partitions. The infos may not be used in ordinary life, but it would help a lot when the system have some problems.
==dmesg== is the command that would display the info in startup.
```
dmesg | grep -i 'blue'; rfkill list
```
### sol 2. Install the hardinfo
```
sudo apt install hardinfo
```
then you can call the hardinfo by typing ```hardinfo``` or click ```alt```+```F2```.

### sol3. Upgrade the BlueZ to the last version directly
BlueZ is official Linux Bluetooth protocol stack. It provides the services to the developers to communicate with blueZ library and Bluetooth device with command lines.
To check the version of BlueZ:
```
dpkg --status bluez | grep 'Version'
```
result: Version: 5.48-0ubuntu3.4
Add the following repository to get the last version of bluez (5.50 Aug 16/2020):
http://www.bluez.org/
```linux
sudo add-apt-repository ppa:bluetooth/bluez
sudo apt-get update
```
After running the command you should be able to update to bluez 5.50 via:
```linux
sudo apt upgrade
```
After getting the new bluez version you should have access to bluetooth after system suspension and also get a more stable behaviour during common bluetooth actions such as connection, disconnection or pairing.
## Solutions for Surface (failed)
Install the special kernels for surface series.
### Download Pre-built Kernel and Headers
The setup.sh script in the below Instructions will handle downloading these for you. Otherwise, you may still download them directly (not recommended as you will want to run the setup.sh script).
Downloads for ubuntu based distros (other distros will need to compile from source using the included patches):
https://github.com/jakeday/linux-surface/releases
You will need to download the image, headers and libc-dev deb files for the version you want to install.
### Instructions
(Prep) Install Dependencies:
```
sudo apt install git curl wget sed
```
Clone the linux-surface repo:
git clone --depth 1 https://github.com/jakeday/linux-surface.git ~/linux-surface
Change directory to linux-surface repo:
```
cd ~/linux-surface
```
Run setup script:
sudo sh setup.sh
Reboot on installed kernel.
The setup script will handle installing the latest kernel for you. You can also choose to download any version you want and install yourself: Install the headers, kernel and libc-dev (make sure you cd to your download location first):
```
sudo dpkg -i linux-headers-[VERSION].deb linux-image-[VERSION].deb linux-libc-dev-[VERSION].deb
```