Fixing broken bluetooth on Dell XPS 13 (Ubuntu)

If you are unable to scan for bluetooth devices on your Dell XPS 13 after upgrading from Ubuntu 14.04 to 15.04 or 16.04. And if you get this error in the output of dmesg command :

bluetooth hci0: Direct firmware load for brcm/BCM20702A1-0a5c-216f.hcd failed with error -2
Bluetooth: hci0: BCM: Patch brcm/BCM20702A1-0a5c-216f.hcd not found

I might have a solution for you.

The error message says the file named BCM20702A1-0a5c-216f.hcd can't be found. This file should be in /lib/firmware/brcm/. Go check this directory and you will probably think you have found the file... but no. There is one named "BCM20702A0-0a5c-216f.hcd" but your computer is trying to access a file named "BCM20702A1-0a5c-216f.hcd". Haaa !

I supposed it's a more recent version of the file but I was not able to download it anywhere so I just copied the A0 into the A1 file :

$ cd /lib/firmware/brcm/
$ sudo cp BCM20702A0-0a5c-216f.hcd BCM20702A1-0a5c-216f.hcd

Then restarted bluetooth service :

$ sudo service bluetooth restart

And bluetooth started working !

I know it's probably a dumb solution, but at least it works now after hours of painful and frustrating debugging... If you find a better way, please write it in the comments !