====== Bluetooth Mouse ======
Stan na: **FreeBSD 14.2**
===== Opis problemu =====
Niektóre myszy bluetooth, takie jak:
* Logitech M535
* Lenovo ThinkPad Bluetooth Laser Mouse
Gubią połączenie po restarcie systemu.
===== Parowanie =====
Dodajemy do ''/etc/rc.conf'' wpisy:
# Bluetooth
bthidd_enable="YES"
hcsecd_enable="YES"
sdpd_enable="YES"
Na tę chwilę odpalenie ich nie jest konieczne. Będą potrzebne później, do normalnej pracy.
Włączamy tryb parowania w myszy, po czym wyszukujemy urządzenie:
# bluetooth-config scan
Scanning for new Bluetooth devices (Attempt 1 of 5) ... done.
Found 3 new bluetooth devices (now scanning for names):
[ 1] 98:fd:b4:77:fd:c2 "ThinkPad Bluetooth Laser Mouse" ()
[ 2] ec:fa:5c:40:a8:4e "domcia" ()
[ 3] 3c:6d:66:08:9f:2b "SHIELD" ()
Select device to pair with [1-3, or 0 to rescan]: 1
Adding device 98:fd:b4:77:fd:c2 to /etc/bluetooth/hosts.
Enter friendly name. [ThinkPad Bluetooth Laser Mouse]:
Notice: Using sanitized name"ThinkPad_Bluetooth_Laser_Mouse" in /etc/bluetooth/hosts.
Writing pairing information description block to /etc/bluetooth/hcsecd.conf.
(To get PIN, put device in pairing mode first.)
Enter PIN [nopin]: 0000
Stopping hcsecd.
Waiting for PIDS: 1329.
Starting hcsecd.
This device provides human interface device services.
Set it up? [yes]: yes
Pin musimy zawsze podać, jeśli wybierzemy ''nopin'', mysz się sparuje ale tylko raz. Nie będziemy w stanie zapisać też klucza uwierzytelniającego Bluetooth.
Odpalamy teraz ''bthidd'':
# service bthidd start
Następnie przechodzmy do ''/var/db'' gdzie sprawdzamy dwa pliki:
# cd /var/db
# cat bthidd.hids
98:fd:b4:77:fd:c2
# cat hcsecd.keys
00:11:22:33:44:55 00112233445566778899aabbccddeeff
W ''bthidd.hids'' mamy zapisany mac-address naszej sparowanej myszy. W ''hcsecd.keys'' powinien znaleźć się klucz dla tego połączenia. Obecnie go nie ma, jest tylko domyślnie wypełniona pozycja jako przykład.
By to poprawić, włączamy ''write_authentication_enable'' oraz restartujemy daemony ''hcsecd'' oraz ''bthidd'':
# hccontrol -n ubt0hci write_authentication_enable 1
# service hcsecd restart
Stopping hcsecd.
Waiting for PIDS: 1498.
Starting hcsecd.
# service bthidd restart
Stopping bthidd.
Waiting for PIDS: 1553.
Starting bthidd.
# cat hcsecd.keys
98:fd:b4:77:fd:c2 07f46ddab6381cc477edf276e48d9415
00:11:22:33:44:55 00112233445566778899aabbccddeeff
Po restarcie systemu mysz powinno się bez problemu podłączyć na nowo.
===== Linki =====
* https://www.bsdforen.de/threads/howto-logitech-bluetooth-maus-m535-an-thinkpad-t470-mit-freebsd-13-1.36596/
* https://forums.freebsd.org/threads/bluetooth-pairing-is-a-complete-headache.89359/page-2
* https://www.reddit.com/r/Fedora/comments/aok1c8/fedora_29_thinkpad_bluetooth_laser_mouse_problem/
====== Archiwum - FreeBSD 10.3 ======
Procedura podłączenia myszy po bluetooth:
Dodajemy do ''/etc/rc.conf'' wpisy:
# Bluetooth
bthidd_enable="YES"
hcsecd_enable="YES"
sdpd_enable="YES"
Uruchamiany daemony:
service sdpd start
service hcsecd start
Wyszukujemy nasz interfejs bluetooth:
# hccontrol read_node_list
Name ID Num hooks
ubt0hci 00000007 3
Włączamy tryb parowania w myszy, po czym wyszukujemy urządzenie:
# hccontrol -n ubt0hci inquiry
Inquiry result, num_responses=1
Inquiry result #0
BD_ADDR: 00:1d:d8:3b:24:67
Page Scan Rep. Mode: 0x1
Page Scan Period Mode: 00
Page Scan Mode: 00
Class: 00:25:80 <<< ta klasa to mysz
Clock offset: 0xee6
Inquiry complete. Status: No error [00]
Rejestrujemy urządzenie do bthidd:
bthidcontrol -a 00:1d:d8:3b:24:67 query > /etc/bluetooth/bthidd.conf
Restartujemy hcsecd i uruchamiamy bthidd:
service hcsecd restart
service bthidd start
==== Gdyby mysz zgubiła połączenie.. ====
Jeśli mysz zgubiłaby połączenie (np. poprzez sparowanie z innym urządzeniem), aby przywrócić połączenie wykonujemy:
service bthidd stop
rm /var/db/bthidd.hids /etc/bluetooth/bthidd.conf
I parujemy ponownie poprzez ''bthidcontrol''
==== Linki =====
* Bluetooth Device Classes: https://www.question-defense.com/tools/class-of-device-bluetooth-cod-list-in-binary-and-hex