ทำไมต้องติดตั้ง BlueZ เอง?
Ubuntu ใส่ BlueZ (Bluetooth protocol stack) เวอร์ชันเก่าที่เสถียร แต่ขาดฟีเจอร์ใหม่ๆ หากต้องการฟีเจอร์ล่าสุด ต้องคอมไพล์และติดตั้งเองจาก Source Code
ขั้นตอนที่ 1: ถอน BlueZ เวอร์ชันเดิม
sudo apt autoremove bluez
กด Y ยืนยัน
ขั้นตอนที่ 2: ดาวน์โหลด Source Code ล่าสุด
ไปที่ เว็บไซต์ BlueZ หรือใช้ wget:
wget https://www.kernel.org/pub/linux/bluetooth/bluez-5.66.tar.xz
เปลี่ยนหมายเลขเวอร์ชันให้เป็นเวอร์ชันล่าสุด
ขั้นตอนที่ 3: ติดตั้ง Dependencies
sudo apt install build-essential libreadline-dev libical-dev libdbus-1-dev libudev-dev libglib2.0-dev python3-docutils
หมายเหตุ: ใช้ build-essential ไม่ใช่ build-essentials
ขั้นตอนที่ 4: Build และติดตั้ง
tar -xzvf bluez-* && cd bluez*
./configure
make
sudo make install
ขั้นตอนที่ 5: ตั้งค่าและเปิดใช้งาน Service
- แก้ไข systemd service:
เปลี่ยนบรรทัดsudo nano /lib/systemd/system/bluetooth.serviceExecStartเป็น:ExecStart=/usr/local/libexec/bluetooth/bluetoothd --experimental - Reload และเริ่ม service:
sudo systemctl daemon-reload sudo systemctl unmask bluetooth.service sudo systemctl restart bluetooth - ตรวจสอบสถานะ:
sudo systemctl status bluetooth - ทดสอบด้วย
bluetoothctl:sudo bluetoothctl
สรุป
ตอนนี้คุณมี BlueZ เวอร์ชันล่าสุดพร้อมฟีเจอร์ใหม่ทั้งหมด การอัปเกรด Bluetooth stack ยังช่วยแก้ปัญหาการเชื่อมต่อ Bluetooth บน Linux ได้อีกด้วย