This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
wiki:bluez_4 [2017/10/22 01:03] 1.241.172.144 [Installation of BlueZ] |
wiki:bluez_4 [2017/10/23 10:49] (current) 1.241.172.144 [BlueZ 4 D-Bus API] |
||
---|---|---|---|
Line 170: | Line 170: | ||
- | =====Configuring BlueZ===== | + | =====설치된 BlueZ의 설정===== |
====Config Files==== | ====Config Files==== | ||
- | /etc/init/bluetooth.conf - bluetooth daemon init\\ | + | **/etc/init/bluetooth.conf** - bluetooth daemon init |
- | /etc/bluetooth/main.conf - main bluetooth daemon config\\ | + | |
- | *name of device (when discoverable)\\ | + | |
- | /etc/bluetooth/input.conf - configuration of the input service\\ | + | |
- | /etc/bluetooth/audio.conf - configuration of the audio service (SCO routing: PCM or HCI)\\ | + | |
- | /etc/bluetooth/network.conf - configuration of the network service (link encryption)\\ | + | |
- | /etc/bluetooth/rfcomm.conf - configuration of rfcomm layer\\ | + | |
- | /etc/bluetooth/serial.conf - configuration of serial (DUN tty, UID)\\ | + | |
+ | buildroot로 만든 rootfs에는 이의 폴더와 파일은 존재하지 않는다.\\ | ||
+ | 폴더만 나중에 새로 생성한다 | ||
+ | |||
+ | **/etc/bluetooth/main.conf** - main bluetooth daemon config | ||
+ | *name of device (when discoverable) | ||
+ | 존재는 하지만 실제 사용되는지는 알 수 없다.\\ | ||
+ | 실제로 여기의 변수를 수정하여도 적용되는 것 같지 않다.\\ | ||
+ | 변화가 전혀 없다. | ||
+ | |||
+ | **/etc/bluetooth/input.conf** - configuration of the input service | ||
+ | |||
+ | buildroot로 만든 rootfs에는 이의 폴더와 파일은 존재하지 않는다. | ||
+ | |||
+ | **/etc/bluetooth/audio.conf** - configuration of the audio service (SCO routing: PCM or HCI) | ||
+ | |||
+ | buildroot로 만든 rootfs에는 이의 폴더와 파일은 존재하지 않는다. | ||
+ | |||
+ | **/etc/bluetooth/network.conf** - configuration of the network service (link encryption) | ||
+ | |||
+ | buildroot로 만든 rootfs에는 이의 폴더와 파일은 존재하지 않는다. | ||
+ | |||
+ | **/etc/bluetooth/rfcomm.conf** - configuration of rfcomm layer | ||
+ | |||
+ | 존재는 하지만 실제 사용되는지는 알 수 없다.\\ | ||
+ | 실제로 여기의 변수를 수정하여도 적용되는 것 같지 않다.\\ | ||
+ | 변화가 전혀 없다. | ||
+ | |||
+ | **/etc/bluetooth/serial.conf** - configuration of serial (DUN tty, UID) | ||
+ | |||
+ | buildroot로 만든 rootfs에는 이의 폴더와 파일은 존재하지 않는다. | ||
====Boot Script==== | ====Boot Script==== | ||
Line 249: | Line 272: | ||
* https://code.google.com/archive/p/bluez-tools/ | * https://code.google.com/archive/p/bluez-tools/ | ||
+ | =====D-Bus Message Bus System===== | ||
+ | The BlueZ stack uses the [[https://www.freedesktop.org/wiki/Software/dbus/|D-Bus message bus system]] which is a simple way for applications to talk to one another. | ||
+ | ====BlueZ 4 D-Bus API==== | ||
+ | The BlueZ 4 D-Bus API is defined in [[https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/doc/network-api.txt?id=4.101|doc/network-api.txt]]. Some example usage using **dbus-send**: | ||
- | D-Bus Message Bus System | + | * First you need to get the path to the bluetooth controller you wish to use. We will assign it to a shell env variable and export it for future use: |
- | The BlueZ stack uses the D-Bus message bus system which is a simple way for applications to talk to one another. | + | export BTADAPTER=`dbus-send --system --dest=org.bluez --print-reply / org.bluez.Manager.DefaultAdapter | tail -1 | sed 's/^.*"\(.*\)".*$/\1/'` |
- | BlueZ 4 D-Bus API | + | * To introspect with you can use something like: |
- | The BlueZ 4 D-Bus API is defined in doc/network-api.txt. Some example usage using dbus-send: | + | # dbus-send --system --dest=org.bluez --print-reply $BTADAPTER org.freedesktop.DBus.Introspectable.Introspect |
- | First you need to get the path to the bluetooth controller you wish to use. We will assign it to a shell env variable and export it for future use: | + | * To make your controller discoverable: |
- | export BTADAPTER=`dbus-send --system --dest=org.bluez --print-reply / org.bluez.Manager.DefaultAdapter | tail -1 | sed 's/^.*"\(.*\)".*$/\1/'` | + | |
- | To introspect with you can use something like: | + | |
- | # dbus-send --system --dest=org.bluez --print-reply $BTADAPTER org.freedesktop.DBus.Introspectable.Introspect | + | |
- | To make your controller discoverable: | + | |
- | # dbus-send --system --dest=org.bluez --print-reply $BTADAPTER org.bluez.Adapter.SetProperty string:Discoverable variant:boolean:true | + | |
- | To disable discovery: | + | |
- | # dbus-send --system --dest=org.bluez --print-reply $BTADAPTER org.bluez.Adapter.SetProperty string:Discoverable variant:boolean:false | + | |
- | To list paired devices: | + | |
- | # dbus-send --system --dest=org.bluez --print-reply $BTADAPTER org.bluez.Adapter.ListDevices | + | |
- | To trust a device: | + | |
- | dbus-send --system --dest=org.bluez --print-reply $BTADAPTER/dev_54_46_6B_01_7B_2B org.bluez.Device.SetProperty string:Trusted variant:boolean:true | + | |
- | To connect to an HID device (must pair first and can see the path above): | + | |
- | # dbus-send --system --dest=org.bluez --print-reply $BTADAPTER/dev_54_46_6B_01_7B_2B org.bluez.Input.Connect | + | |
- | [ 2710.946655] Bluetooth: HIDP (Human Interface Emulation) ver 1.2 | + | |
- | [ 2710.952642] Bluetooth: HIDP socket layer initialized | + | |
- | method return sender=:1.3 -> dest=:1.13 reply_serial=2 | + | |
- | root@ventana:~# [ 2711.352289] hid-generic 0005:0A5C:8502.0001: unknown main item tag 0x0 | + | |
- | [ 2711.359234] input: Bluetooth FAVI as /devices/soc0/soc.0/2100000.aips-bus/2184000.usb/ci_hdrc.0/usb1/1-1/1-1:1.0/bluetooth/hci0/hci0:42/0005:0A5C:8502.0001/input/input1 | + | |
- | [ 2711.374829] hid-generic 0005:0A5C:8502.0001: input: BLUETOOTH HID v1.1b Keyboard [Bluetooth FAVI] on 00:15:83:3d:0a:57 | + | |
- | evtest /dev/input/event1 | + | |
+ | # dbus-send --system --dest=org.bluez --print-reply $BTADAPTER org.bluez.Adapter.SetProperty string:Discoverable variant:boolean:true | ||
+ | * To disable discovery: | ||
+ | # dbus-send --system --dest=org.bluez --print-reply $BTADAPTER org.bluez.Adapter.SetProperty string:Discoverable variant:boolean:false | ||
+ | * To list paired devices: | ||
+ | |||
+ | # dbus-send --system --dest=org.bluez --print-reply $BTADAPTER org.bluez.Adapter.ListDevices | ||
+ | |||
+ | * To trust a device: | ||
+ | dbus-send --system --dest=org.bluez --print-reply $BTADAPTER/dev_54_46_6B_01_7B_2B org.bluez.Device.SetProperty string:Trusted variant:boolean:true | ||
+ | |||
+ | * To connect to an HID device (must pair first and can see the path above): | ||
+ | |||
+ | # dbus-send --system --dest=org.bluez --print-reply $BTADAPTER/dev_54_46_6B_01_7B_2B org.bluez.Input.Connect | ||
+ | [ 2710.946655] Bluetooth: HIDP (Human Interface Emulation) ver 1.2 | ||
+ | [ 2710.952642] Bluetooth: HIDP socket layer initialized | ||
+ | method return sender=:1.3 -> dest=:1.13 reply_serial=2 | ||
+ | root@ventana:~# [ 2711.352289] hid-generic 0005:0A5C:8502.0001: unknown main item tag 0x0 | ||
+ | [ 2711.359234] input: Bluetooth FAVI as /devices/soc0/soc.0/2100000.aips-bus/2184000.usb/ci_hdrc.0/usb1/1-1/1- | ||
+ | 1:1.0/bluetooth/hci0/hci0:42/0005:0A5C:8502.0001/input/input1 | ||
+ | [ 2711.374829] hid-generic 0005:0A5C:8502.0001: input: BLUETOOTH HID v1.1b Keyboard [Bluetooth FAVI] on | ||
+ | 00:15:83:3d:0a:57 | ||
+ | evtest /dev/input/event1 | ||
+ | |||
+ | =====Bluetooth Profiles===== | ||
+ | |||
+ | In order to use Bluetooth a device must be compatible with a subset of Bluetooth profiles for specific services. These profiles sit on top of the Bluetooth Core specification and protocols. | ||
+ | |||
+ | The way a device uses Bluetooth technology depends on its profile capabilities. The profiles provide standards which manufacturers follow to allow devices to be compatible. | ||
+ | |||
+ | A full list of profiles can be found [[https://en.wikipedia.org/wiki/List_of_Bluetooth_profiles|here]] however here are some common ones are described in detail in the sections below | ||
+ | |||
+ | |||
+ | [[PAN]] | ||
Line 373: | Line 413: | ||
\\ | \\ | ||
https://www.linuxquestions.org/questions/slackware-14/bluetooth-not-working-slackware-14-0-rc4-and-bluez-4-99-a-4175427292-print/ | https://www.linuxquestions.org/questions/slackware-14/bluetooth-not-working-slackware-14-0-rc4-and-bluez-4-99-a-4175427292-print/ | ||
+ | \\ | ||
+ | https://forums.gentoo.org/viewtopic-t-923578-start-0.html | ||
\\ | \\ | ||