The Funtoo Linux project has transitioned to "Hobby Mode" and this wiki is now read-only.
Difference between revisions of "Bluetooth"
(Created page with "== Bluetooth == Bluetooth is a wireless technology standard for exchanging data over short distances. It is using short-wavelength UHF radio waves in the ISM band from 2.4 t...") |
|||
(26 intermediate revisions by the same user not shown) | |||
Line 6: | Line 6: | ||
== Kernel configuration == | == Kernel configuration == | ||
Enable these options in your kernel: | |||
<pre> | |||
[*] Networking support ---> | [*] Networking support ---> | ||
<M> Bluetooth subsystem support ---> | <M> Bluetooth subsystem support ---> | ||
Line 24: | Line 25: | ||
<M> HCI UART driver | <M> HCI UART driver | ||
<M> RF switch subsystem support ---> | <M> RF switch subsystem support ---> | ||
</pre> | |||
== Software == | |||
<poem> | |||
Add these use-flags into your package.use: | |||
'''app-mobilephone/obexftp bluetooth''' | |||
<syntaxhighlight lang=bash> root# echo "app-mobilephone/obexftp bluetooth" >> /etc/portage/package.use </syntaxhighlight> | |||
'''dev-libs/openobex bluetooth''' | |||
<syntaxhighlight lang=bash> root# echo "dev-libs/openobex bluetooth" >> /etc/portage/package.use </syntaxhighlight> | |||
Additionally you can globally enable bluetooth use flag in your make.conf, but this is not required. Dont forget to run emerge -uDN @world if you enable bluetooth use flag globally. Add the following line into your /etc/portage/make.conf: | |||
<syntaxhighlight lang=bash> USE="bluetooth" </syntaxhighlight> | |||
Now install these packages: net-wireless/bluez, sys-fs/obexfs | |||
<syntaxhighlight lang=bash> root# emerge net-wireless/bluez </syntaxhighlight><syntaxhighlight lang=bash> root# emerge sys-fs/obexfs </syntaxhighlight> | |||
add your user to plugdev group: | |||
<syntaxhighlight lang=bash> root# gpasswd -a user plugdev </syntaxhighlight> | |||
</poem> | |||
== Bluetooth Service == | |||
add bluetooth service to default runlevel: | |||
<syntaxhighlight lang="bash"> rc-update add bluetooth default </syntaxhighlight> | |||
start bluetooth service: | |||
<syntaxhighlight lang="bash"> rc-service bluetooth start </syntaxhighlight> | |||
== Controller Setup == | |||
<poem> | |||
To connect to Bluetooth device, it needs to be: | |||
* visible (temporarily) | |||
* trusted | |||
* paired | |||
Bluetooth devices are not visible by default, therefore if you want to connect to your phone, you need to set it (temporarily) into visible mode. | |||
Execute following command as ordinary user: | |||
<syntaxhighlight lang="bash"> user# bluetoothctl </syntaxhighlight> '''Description of commands inside bluetoothctl:''' | |||
to get help: | |||
<syntaxhighlight lang="bash"> help </syntaxhighlight> | |||
List available controllers: | |||
<syntaxhighlight lang="bash"> list </syntaxhighlight> | |||
Set "power on" on your controller: | |||
<syntaxhighlight lang="bash"> power on </syntaxhighlight> | |||
Set controller into pairable mode: | |||
<syntaxhighlight lang="bash"> pairable on </syntaxhighlight> | |||
Set controller into discoverable mode: | |||
<syntaxhighlight lang="bash"> discoverable on </syntaxhighlight> | |||
Scan for devices: | |||
<syntaxhighlight lang="bash"> scan on </syntaxhighlight> * this will display DEVICE_MAC_Adrress and name of a device that is in visible mode (and in range of your Bluetooth antena) | |||
List available devices: | |||
<syntaxhighlight lang="bash"> devices </syntaxhighlight> * display devices that were "scanned" with "scan on" command | |||
Trust device: | |||
<syntaxhighlight lang="bash"> trust DEVICE_MAC_Address </syntaxhighlight> | |||
Pair device: | |||
<syntaxhighlight lang="bash"> pair DEVICE_MAC_Address </syntaxhighlight> * Confirm pairing on your BT device (smartphone...) | |||
</poem> | |||
== Obexfs == | |||
* mount Bluetooth device into your users ~/bluetooth directory | |||
<syntaxhighlight lang="bash"> user# obexfs -b DEVICE_MAC_Address ~/bluetooth </syntaxhighlight> | |||
== Scripting the whole process == | |||
*You can use bluetoothctl from inside a script, by "piping" a command into it; | |||
bluetooth_mount.sh script: | |||
<pre> | |||
#!/bin/bash | |||
echo "power on"| bluetoothctl; | |||
obexfs -b DEVICE_MAC_Address ~/bluetooth; | |||
</pre> | |||
bluetooth_unmount.sh script: | |||
<pre> | |||
#!/bin/bash | |||
fusermount -u ~/bluetooth; | |||
echo "power off"| bluetoothctl; | |||
</pre> |
Latest revision as of 12:25, November 1, 2015
Bluetooth
Bluetooth is a wireless technology standard for exchanging data over short distances. It is using short-wavelength UHF radio waves in the ISM band from 2.4 to 2.485 GHz. It was developed by Ericsson in 1994. Today it is used mostly to connect peripherals and smartphones to your computer.
Kernel configuration
Enable these options in your kernel:
[*] Networking support ---> <M> Bluetooth subsystem support ---> [*] Bluetooth Classic (BR/EDR) features <M> RFCOMM protocol support [*] RFCOMM TTY support <M> BNEP protocol support [*] Multicast filter support [*] Protocol filter support <M> CMTP protocol support <M> HIDP protocol support [*] Bluetooth Low Energy (LE) features <M> Bluetooth 6LoWPAN support [*] Export Bluetooth internals in debugfs Bluetooth device drivers ---> <M> HCI USB driver <M> HCI UART driver <M> RF switch subsystem support --->
Software
<poem> Add these use-flags into your package.use: app-mobilephone/obexftp bluetooth
root# echo "app-mobilephone/obexftp bluetooth" >> /etc/portage/package.use
dev-libs/openobex bluetooth
root# echo "dev-libs/openobex bluetooth" >> /etc/portage/package.use
Additionally you can globally enable bluetooth use flag in your make.conf, but this is not required. Dont forget to run emerge -uDN @world if you enable bluetooth use flag globally. Add the following line into your /etc/portage/make.conf:
USE="bluetooth"
Now install these packages: net-wireless/bluez, sys-fs/obexfs
root# emerge net-wireless/bluez
root# emerge sys-fs/obexfs
add your user to plugdev group:
root# gpasswd -a user plugdev
</poem>
Bluetooth Service
add bluetooth service to default runlevel:
rc-update add bluetooth default
start bluetooth service:
rc-service bluetooth start
Controller Setup
<poem> To connect to Bluetooth device, it needs to be:
- visible (temporarily)
- trusted
- paired
Bluetooth devices are not visible by default, therefore if you want to connect to your phone, you need to set it (temporarily) into visible mode. Execute following command as ordinary user:
user# bluetoothctl
Description of commands inside bluetoothctl:
to get help:
help
List available controllers:
list
Set "power on" on your controller:
power on
Set controller into pairable mode:
pairable on
Set controller into discoverable mode:
discoverable on
Scan for devices:
scan on
* this will display DEVICE_MAC_Adrress and name of a device that is in visible mode (and in range of your Bluetooth antena)
List available devices:
devices
* display devices that were "scanned" with "scan on" command
Trust device:
trust DEVICE_MAC_Address
Pair device:
pair DEVICE_MAC_Address
* Confirm pairing on your BT device (smartphone...)
</poem>
Obexfs
- mount Bluetooth device into your users ~/bluetooth directory
user# obexfs -b DEVICE_MAC_Address ~/bluetooth
Scripting the whole process
- You can use bluetoothctl from inside a script, by "piping" a command into it;
bluetooth_mount.sh script:
#!/bin/bash echo "power on"| bluetoothctl; obexfs -b DEVICE_MAC_Address ~/bluetooth;
bluetooth_unmount.sh script:
#!/bin/bash fusermount -u ~/bluetooth; echo "power off"| bluetoothctl;