bluetooth
Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
| Nächste Überarbeitung | Vorhergehende Überarbeitung | ||
| bluetooth [2012-02-11 21:10:40] – Externe Bearbeitung 127.0.0.1 | bluetooth [2025-08-10 01:35:10] (aktuell) – manfred | ||
|---|---|---|---|
| Zeile 1: | Zeile 1: | ||
| + | ====== Bluetooth ====== | ||
| + | |||
| + | * [[http:// | ||
| + | * [[https:// | ||
| + | |||
| + | |||
| + | ===== Bluetooth-Installation (Ubuntu 14.04) ===== | ||
| + | |||
| + | Installation " | ||
| + | # aptitude install bluez bluez-utils bluez-hcidump | ||
| + | |||
| + | Installation in " | ||
| + | # apt install bluez bluez-tools bluez-hcidump | ||
| + | |||
| + | # service bluetooth restart | ||
| + | # hcitool dev | ||
| + | # hciconfig --all | ||
| + | # hcitool scan | ||
| + | |||
| + | |||
| + | === / | ||
| + | |||
| + | Für die Installation einer Bluetooth-Lautsprecher-Box habe ich diese Datei vollkommen unberührt gelassen. | ||
| + | |||
| + | options { | ||
| + | autoinit yes; | ||
| + | security auto; | ||
| + | pairing multi; | ||
| + | passkey " | ||
| + | } | ||
| + | | ||
| + | device { | ||
| + | name " | ||
| + | class 0x00100; | ||
| + | iscan enable; pscan enable; | ||
| + | discovto 0; | ||
| + | lm accept; | ||
| + | lp rswitch, | ||
| + | } | ||
| + | |||
| + | Das Passwort bzw. der PIN wird hier eingegeben: **'' | ||
| + | |||
| + | bei einem Mobiltelefon: | ||
| + | |||
| + | |||
| + | ==== bei jedem Start deaktivieren ==== | ||
| + | |||
| + | |||
| + | === / | ||
| + | |||
| + | rfkill block bluetooth | ||
| + | |||
| + | |||
| + | ===== Bluetooth-Gerät anpingen ===== | ||
| + | |||
| + | scan-Programm installieren: | ||
| + | > aptitude install bluez-hcidump | ||
| + | |||
| + | den Scan durchfuhren (für den scannen muss das Geraet kurzzeitig sichtbar sein): | ||
| + | > hcitool scan | ||
| + | Scanning ... | ||
| + | 3C: | ||
| + | |||
| + | Die MAC-Adresse sollte man sich jetzt notieren. | ||
| + | |||
| + | Ping installieren: | ||
| + | > aptitude install bluez | ||
| + | |||
| + | den Ping durchführen (die Bluetooth-Sichtbarkeit ist zur Sicherheit wieder abgeschaltet worden): | ||
| + | > l2ping -c 4 -r 3C: | ||
| + | Can't connect: Connection refused | ||
| + | |||
| + | pingt das Gerät an, wenn es nicht in der Nähe ist, dann sieht das so aus: | ||
| + | > l2ping -c 4 -r 3C: | ||
| + | Can't connect: Host is down | ||
| + | |||
| + | ein Skript, mit dem man die Anwesenheit eines bekannten Bluetooth-Gerätes ermitteln kann: | ||
| + | > vi / | ||
| + | < | ||
| + | #!/bin/bash | ||
| + | |||
| + | |||
| + | # | ||
| + | BLUEZMAC=" | ||
| + | # | ||
| + | LOGDATEI="/ | ||
| + | |||
| + | # | ||
| + | |||
| + | WEG=" Host is down" | ||
| + | DA=" Connection refused" | ||
| + | |||
| + | # | ||
| + | ### Bluetooth-Scan | ||
| + | |||
| + | # hcitool scan | ||
| + | #Scanning ... | ||
| + | # F4: | ||
| + | |||
| + | # | ||
| + | |||
| + | if [ -r " | ||
| + | STATUS=" | ||
| + | else | ||
| + | STATUS=" | ||
| + | fi | ||
| + | |||
| + | ERGEBNIS=" | ||
| + | ZEITPUNKT=" | ||
| + | |||
| + | if [ " | ||
| + | if [ " | ||
| + | echo "ist da: ${ZEITPUNKT}" | ||
| + | fi | ||
| + | elif [ " | ||
| + | if [ " | ||
| + | echo "ist weg: ${ZEITPUNKT}" | ||
| + | fi | ||
| + | fi | ||
| + | </ | ||
| + | |||
| + | ===== Bluetooth per ALSA ===== | ||
| + | |||
| + | nach Bluetooth-Gerät suchen, und MAC-Adresse notieren: | ||
| + | # hcitool scan | ||
| + | Scanning ... | ||
| + | 00: | ||
| + | |||
| + | |||
| + | === .asoundrc === | ||
| + | |||
| + | Konfigurationsdatei (mit der gescannten Bluetooth-MAC-Adresse) erstellen: | ||
| + | pcm.btbox { | ||
| + | type bluetooth | ||
| + | device 00: | ||
| + | profile " | ||
| + | } | ||
| + | | ||
| + | pcm.!default { | ||
| + | type plug | ||
| + | slave.pcm " | ||
| + | } | ||
| + | |||
| + | |||
| + | === Probe === | ||
| + | |||
| + | Tonausgabe mit einer WAVE-Datei testen: | ||
| + | # aplay -D btbox / | ||
| + | |||
| + | |||
| + | ==== Audio-Ausgabe umschalten ==== | ||
| + | |||
| + | __**Wenn man seine Musik über das Bluetooth-Gerät hören will, | ||
| + | dann stellt man die Ausgabe seines Musikplayers auf "'' | ||
| + | und sonst stellt man die Ausgabe auf "'' | ||
| + | |||
| + | |||
| + | ===== Beispiel mit Debian 11.5 + Cinnamon ===== | ||
| + | |||
| + | > bluetoothctl help | ||
| + | |||
| + | > bluetoothctl list | ||
| + | Controller 58: | ||
| + | |||
| + | > bluetoothctl scan on | ||
| + | Discovery started | ||
| + | [CHG] Controller 58: | ||
| + | [NEW] Device CC: | ||
| + | [NEW] Device 14: | ||
| + | [CHG] Device 4C: | ||
| + | [CHG] Device 4C: | ||
| + | [CHG] Device 4C: | ||
| + | [CHG] Device 4C: | ||
| + | [CHG] Device 4C: | ||
| + | [CHG] Device 4C: | ||
| + | 01 10 39 80 76 71 47 | ||
| + | |||
| + | > bluetoothctl pair 4C: | ||
| + | Attempting to pair with 4C: | ||
| + | [CHG] Device 4C: | ||
| + | [NEW] Primary Service (Handle 0x2d5d) | ||
| + | / | ||
| + | 0000febe-0000-1000-8000-00805f9b34fb | ||
| + | Bose Corporation | ||
| + | ... | ||
| + | [CHG] Device 4C: | ||
| + | [CHG] Device 4C: | ||
| + | [CHG] Device 4C: | ||
| + | Pairing successful | ||
| + | |||
| + | > bluetoothctl connect 4C: | ||
| + | Attempting to connect to 4C: | ||
| + | Connection successful | ||
| + | [CHG] Device CC: | ||
| + | [CHG] Device CC: | ||
| + | |||
| + | > bluetoothctl info 4C: | ||
| + | Device 4C: | ||
| + | Name: Bose Frames | ||
| + | Alias: Bose Frames | ||
| + | Class: 0x00240418 | ||
| + | Icon: audio-card | ||
| + | Paired: yes | ||
| + | Trusted: yes | ||
| + | Blocked: no | ||
| + | Connected: yes | ||
| + | LegacyPairing: | ||
| + | |||
