----------------------- update @ 2018-07-27 ---------------------
quick start
1. systemctl start buletooth
2. bluetoothctl
3. scan on
發現鼠標后.
4. scan off
5. connect 4D:7D:96:B0:79:72
6. pair 4D:7D:96:B0:79:72
7. trust 4D:7D:96:B0:79:72
完.
-------------------------------------------------------------
去年地攤買的破無線鼠標壞掉了。看上微軟的Designer Mouse藍牙鼠,但是買之前我要確認我能不能驅起來。
這款鼠標只支持藍牙4.0。系統支持windows8以上,不支持xp和windows7. 其他系統支持mac和android,沒寫linux。
由於之前也沒搞過藍牙設備,所以需要了解一下linux下的藍牙設備。然后在解決鼠標的問題。
需要解決的問題:
1. archlinux下藍牙設備的使用與配置
2. 確定T450的藍牙版本。
3. 驅鼠標。
首先,按照慣例還是讀一下萬事萬靈的archlinux文檔
0. 插敘一部分其他內容。
a. rfkill 用以控制無線設備的軟開關,功能與鍵盤上邊的快捷鍵Fn+WiFi,Fn+BT相同。演示如下:
[tong@T7 ~]$ rfkill list 0: tpacpi_bluetooth_sw: Bluetooth Soft blocked: no Hard blocked: no 2: phy0: Wireless LAN Soft blocked: no Hard blocked: no 7: hci0: Bluetooth Soft blocked: no Hard blocked: no [tong@T7 ~]$ rfkill block 0 [tong@T7 ~]$ rfkill list 0: tpacpi_bluetooth_sw: Bluetooth Soft blocked: yes Hard blocked: no 2: phy0: Wireless LAN Soft blocked: no Hard blocked: no [tong@T7 ~]$ rfkill block 2 [tong@T7 ~]$ rfkill list 0: tpacpi_bluetooth_sw: Bluetooth Soft blocked: yes Hard blocked: no 2: phy0: Wireless LAN Soft blocked: yes Hard blocked: no [tong@T7 ~]$ ip link 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 2: lan0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000 link/ether 50:7b:9d:5c:1e:9b brd ff:ff:ff:ff:ff:ff 3: wlan0: <BROADCAST,MULTICAST> mtu 1500 qdisc mq state DOWN mode DORMANT group default qlen 1000 link/ether dc:53:60:6c:b5:7e brd ff:ff:ff:ff:ff:ff 4: internal-br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000 link/ether 12:e4:a6:90:01:9b brd ff:ff:ff:ff:ff:ff [tong@T7 ~]$ rfkill unblock 2 [tong@T7 ~]$ ip link 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 2: lan0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000 link/ether 50:7b:9d:5c:1e:9b brd ff:ff:ff:ff:ff:ff 3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DORMANT group default qlen 1000 link/ether dc:53:60:6c:b5:7e brd ff:ff:ff:ff:ff:ff 4: internal-br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000 link/ether 12:e4:a6:90:01:9b brd ff:ff:ff:ff:ff:ff [tong@T7 ~]$ rfkill list 0: tpacpi_bluetooth_sw: Bluetooth Soft blocked: yes Hard blocked: no 2: phy0: Wireless LAN Soft blocked: no Hard blocked: no [tong@T7 ~]$ rfkill unblock 0 [tong@T7 ~]$ rfkill list 0: tpacpi_bluetooth_sw: Bluetooth Soft blocked: no Hard blocked: no 2: phy0: Wireless LAN Soft blocked: no Hard blocked: no 8: hci0: Bluetooth Soft blocked: no Hard blocked: no [tong@T7 ~]$
1. 使用lsusb命令查看藍牙設備,我是使用 -v 參數查看到詳細信息后最終確定才確定了 Bus2 Device5是藍牙設備。關於藍牙設備相關的知識,還需要深入的學習。
在使用lsusb命令前,首先應該使用rfkill命令unblock藍牙開關(tpacpi_bluetooth_sw),之后才能在lsusb中可見。
[tong@T7 ~]$ lsusb Bus 001 Device 002: ID 8087:8001 Intel Corp. Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 003 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub Bus 002 Device 004: ID 04f2:b449 Chicony Electronics Co., Ltd Bus 002 Device 005: ID 8087:0a2a Intel Corp. Bus 002 Device 002: ID 138a:0017 Validity Sensors, Inc. Fingerprint Reader Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub [tong@T7 ~]$
2. 查看驅動,藍牙設備由 btusb 驅動。
[tong@T7 ~]$ lsmod |grep ^btusb btusb 40960 0 [tong@T7 ~]$ modinfo btusb filename: /lib/modules/4.7.6-1-ARCH/kernel/drivers/bluetooth/btusb.ko.gz license: GPL version: 0.8 description: Generic Bluetooth USB driver ver 0.8 ... ...
3. 管理程序,藍牙設備由軟件包bluez (linux藍牙協議棧實現之一) 進行管理。
[tong@T7 ~]$ pacman -Qii bluez Name : bluez Version : 5.42-1 Description : Daemons for the bluetooth protocol stack Architecture : x86_64 URL : http://www.bluez.org/ ... ... UNMODIFIED /etc/dbus-1/system.d/bluetooth.conf UNMODIFIED /etc/bluetooth/main.conf [tong@T7 ~]$ pacman -Ql bluez bluez /etc/bluetooth/main.conf bluez /etc/dbus-1/system.d/bluetooth.conf bluez /usr/lib/bluetooth/bluetoothd bluez /usr/lib/systemd/system/bluetooth.service ... ... bluez /usr/share/man/man8/bluetoothd.8.gz [tong@T7 ~]$
根據配置文件 bluetooth.conf 中的設置,使用bluetoothd的用戶需要加入 ‘lp’ 用戶組。
[tong@T7 ~]$ groups lp wheel docker tong [tong@T7 ~]$ systemctl start bluetooth [tong@T7 ~]$
發現報錯如下:(ERROR 1)
[tong@T7 ~]$ systemctl status bluetooth
● bluetooth.service - Bluetooth service
Loaded: loaded (/usr/lib/systemd/system/bluetooth.service; disabled; vendor preset: disabled)
Active: active (running) since Fri 2016-10-07 22:32:47 CST; 16min ago
Docs: man:bluetoothd(8)
Main PID: 570 (bluetoothd)
Status: "Running"
Tasks: 1 (limit: 4915)
CGroup: /system.slice/bluetooth.service
└─570 /usr/lib/bluetooth/bluetoothd
Oct 07 22:32:47 T7 systemd[1]: Starting Bluetooth service...
Oct 07 22:32:47 T7 bluetoothd[570]: Bluetooth daemon 5.42
Oct 07 22:32:47 T7 systemd[1]: Started Bluetooth service.
Oct 07 22:32:47 T7 bluetoothd[570]: Starting SDP server
Oct 07 22:32:47 T7 bluetoothd[570]: Bluetooth management interface 1.12 initialized
Oct 07 22:32:47 T7 bluetoothd[570]: Failed to obtain handles for "Service Changed" characteristic
Oct 07 22:32:47 T7 bluetoothd[570]: Sap driver initialization failed.
Oct 07 22:32:47 T7 bluetoothd[570]: sap-server: Operation not permitted (1)
[tong@T7 ~]$
KDE圖型化配置工具 bluedevil。在發生上面的這個錯誤之后,有手機s7e進行測試,手機可以接收電腦發送的文件,電腦不能對手機發起鏈接,每次點擊connect按鈕錯誤信息如下:(ERROR 2)
Oct 07 23:30:28 T7 bluetoothd[8666]: a2dp-source profile connect failed for xxx:93:D4: Protocol not available
Oct 07 23:30:59 T7 bluetoothd[8666]: a2dp-source profile connect failed for xxxx93:D4: Protocol not available
a2dp 全名Advanced Audio Distribution Profile,大概因為手機默認會使用這種音頻傳輸,所以由於電腦不支持導致了問題。 從 文檔的audio章節 得到的內容,可以嘗試安裝音頻包 pulseaudio-bluetooth 。 安裝后果然可以成功connect了。鏈接成功之后,電腦會自動播放手機的音頻。然而手機主動推送給電腦的文件,仍然不能正確接受。
ERROR 1 的錯誤仍然存在,先rfkill unblock就會打印ERROR 1. 先啟動再unblock,就不會打印。當unblock時才打印。23333。
Oct 08 00:42:02 T7 plasmashell[651]: file:///usr/share/plasma/plasmoids/org.kde.plasma.bluetooth/contents/ui/logic.js:34: TypeError: Cannot read property 'devices' of undefined Oct 08 00:42:02 T7 plasmashell[651]: file:///usr/share/plasma/plasmoids/org.kde.plasma.bluetooth/contents/ui/logic.js:34: TypeError: Cannot read property 'devices' of undefined Oct 08 00:42:02 T7 plasmashell[651]: file:///usr/share/plasma/plasmoids/org.kde.plasma.bluetooth/contents/ui/logic.js:34: TypeError: Cannot read property 'devices' of undefined Oct 08 00:42:06 T7 plasmashell[651]: file:///usr/share/plasma/plasmoids/org.kde.plasma.bluetooth/contents/ui/logic.js:34: TypeError: Cannot read property 'devices' of undefined Oct 08 00:42:06 T7 plasmashell[651]: file:///usr/share/plasma/plasmoids/org.kde.plasma.bluetooth/contents/ui/logic.js:34: TypeError: Cannot read property 'devices' of undefined Oct 08 00:42:06 T7 plasmashell[651]: file:///usr/share/plasma/plasmoids/org.kde.plasma.bluetooth/contents/ui/logic.js:34: TypeError: Cannot read property 'devices' of undefined
跟蹤了日志,不能上傳文件,看似是UI程序的問題。可以忽略,使用命令行工具繼續測試。
4. 命令行配置工具 bluetoothctl , 通過安裝工具包 bluez-utils。
a. 啟動服務
[tong@T7 ~]$ sudo systemctl start bluetooth [tong@T7 ~]$ rfkill unblock 0
b. 使用 bluetoothctl
Start the bluetoothctl interactive command. There one can input help to get a list of available commands. 1. Turn the power to the controller on by entering power on. It is off by default. 2. Enter devices to get the MAC Address of the device with which to pair. 3. Enter device discovery mode with scan on command if device is not yet on the list. 4. Turn the agent on with agent on. 5. Enter pair MAC Address to do the pairing (tab completion works). 6. If using a device without a PIN, one may need to manually trust the device before it can reconnect successfully. Enter trust MAC Address to do so. 7. Finally, use connect MAC_address to establish a connection.
連接成功了,但是文件傳輸過程中,仍然各種報錯,除了 sdptool browse 20:2D:xxxxxx 成功意外,其他方式 (obexfs, obexftp, ussp-push) 都不能成功。
在bluetoothctl 中有如下報錯信息:
[bluetooth]# connect 20:xxxD4 Attempting to connect to 20:xxxxx:D4 [CHG] Device 20:xxxxx:D4 Connected: yes [CHG] Device 20:xxxxx:D4 ServicesResolved: yes Failed to connect: org.bluez.Error.NotAvailable [CHG] Device 20:xxxxx:D4 ServicesResolved: no [CHG] Device 20:xxxxx:D4 Connected: no [bluetooth]# connect 20:xxxxx:D4 Attempting to connect to 20:xxxxx:D4 [CHG] Device 20:xxxxx:D4 Connected: yes [CHG] Device 20:xxxxx:D4 ServicesResolved: yes Failed to connect: org.bluez.Error.Failed [CHG] Device 20:xxxxx:D4 ServicesResolved: no [CHG] Device 20:xxxxx:D4 Connected: no [CHG] Device 20:xxxxx:D4 Connected: yes [CHG] Device 20:xxxxx:D4 Connected: no [bluetooth]#
journal里有如下信息:
Oct 08 01:57:12 T7 sudo[2164]: pam_unix(sudo:session): session closed for user root Oct 08 01:57:32 T7 bluetoothd[1918]: 20:xxxxx:D4: error updating services: Connection timed out (110) Oct 08 02:01:44 T7 bluetoothd[1918]: Unable to get a audio source object Oct 08 02:02:08 T7 bluetoothd[1918]: Unable to get a audio source object Oct 08 02:03:28 T7 bluetoothd[1918]: 20:xxxxx:D4: error updating services: Connection timed out (110) Oct 08 02:03:44 T7 bluedevil-sendfile[2242]: bluedevil.sendfile: Device "/org/bluez/hci0/dev_20_xxxx_D4" Oct 08 02:03:44 T7 bluedevil-sendfile[2242]: bluedevil.sendfile: Files () Oct 08 02:03:44 T7 bluedevil-sendfile[2242]: bluedevil.sendfile: Manager initialized Oct 08 02:04:14 T7 bluedevil-sendfile[2242]: BluezQt: PendingCall Error: "Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken." Oct 08 02:04:14 T7 bluedevil-sendfile[2242]: bluedevil.sendfile: Error creating session "Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken." Oct 08 02:04:14 T7 bluedevil-sendfile[2242]: bluedevil.sendfile: Initialize Fail Page Oct 08 02:04:30 T7 obexd[726]: Unable to find service record Oct 08 02:05:49 T7 bluedevil-sendfile[2242]: bluedevil.sendfile: Wizard done: 0
暫時放棄了。。。
藍牙版本:也學是從這里看吧?!反正看見了4.2
[tong@T7 ~]$ hciconfig -a hci0: Type: Primary Bus: USB BD Address: DC:53:60:6C:B5:82 ACL MTU: 1021:5 SCO MTU: 96:6 UP RUNNING PSCAN ISCAN RX bytes:59028 acl:385 sco:0 events:1456 errors:0 TX bytes:50956 acl:341 sco:0 commands:563 errors:0 Features: 0xff 0xfe 0x0f 0xfe 0xdb 0xff 0x7b 0x87 Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3 Link policy: RSWITCH HOLD SNIFF Link mode: SLAVE ACCEPT Name: 'T7' Class: 0x1c010c Service Classes: Rendering, Capturing, Object Transfer Device Class: Computer, Laptop HCI Version: 4.2 (0x8) Revision: 0x1000 LMP Version: 4.2 (0x8) Subversion: 0x1000 Manufacturer: Intel Corp. (2)
最后,管他驅不驅得起,買了再說!
到貨! 哪里需要那么復雜,只要打開 bluetooth.service 然后在KDE狀態欄配對連接就ok了。馬上可用!
長時間使用會不會斷啊,什么之類的,還有在觀察,有問題以后更新。
簡單評價一下這個 鼠。外觀設計真的超贊,價錢也不貴。電池藏磁吸附設計,電池的觸點也非常的特別。感覺每一個細節都是精心的設計。滑輪的手感我個人不太喜歡,但是也還好。缺點說實在的在於手感。因為這種扁平的設計,當你把手放在鼠標上的時候,手指是懸空的沒有支持,並不舒服。當然這一點我在買之前就已經想到了。畢竟在完美好看的外觀面前,舒適又算什么呢?2333.
上照一張,附帶我提前衰老的爪。
過一段時間,補充穩定性等問題,並補充開關機自動識別之類的設置。等不及了,我要開始體驗了。
(2個小時以后)。。。
這么快就回來補充配置了。
第一步,rfkill,rfkill的配置是重啟保留的,即如果你之前是block的,關完機再開機它還是block的。如果你之前是unblock的,你關完機再開機它還是unblock的。
第二步,bluez(即守護進程bluetoothd)。使用 systemctl enable bluetooth 設置成開機啟動。
第三步,bluetoothctl。依據前文提到的操作,順序執行 pair, trust, connect. 之后就可以順利使用了。
然后,當我退出bluetoothctl時,實際上關於bluetoothctl的這些配置就都失效了。即藍牙鼠標的關聯是斷開的。當我把x狀態保留在display manager沒有登錄之前時,就可以測試鼠標的這一時效狀態。但是login進入kde之后,鼠標又好使了,因為這個時候kde啟動了bluedevil程序用以藍牙管理。而它會繼承之前在bluetoothctl中對藍牙設備進行的配對等操作。所以在無人工配置的情況下,不進入KDE,藍牙鼠標就不能用。而這一點我是可以接受的,因為不進KDE,要鼠標又有什么用呢? 當然,FVWM下想必也不好使,這個可以留到之后在處理了。
最后,完成了以上三步之后,在KDE環境里,藍牙鼠就是完美可用狀態。out of box。只要在鼠標上打開開關。在電腦上打開開關(rfkill)。無論重啟或開機,或怎么,隨時可用,
完,: )
Update @ 20161028
這一周恢復了正常上下班活動,在公司也增加了鼠標的使用頻率,有了一些進一步的使用體驗,雖然還有小紅點。
在左鍵點擊的時候,偶爾會出現塑料與塑料之間摩擦的‘吱吱’的聲音,影響使用體驗,單擊動作也相應的不夠干脆清爽。整體上,有一種廉價的質感,有一種做工不精良的感覺。
update @ 20170703
換了新電腦,重新pair鼠標
[root@T7 ~]# bluetoothctl
不太好用,最后在plasma UI里面莫名其妙的成功了。