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/23 10:16] 1.241.172.144 [Config Files] |
wiki:bluez_4 [2017/10/23 10:49] (current) 1.241.172.144 [BlueZ 4 D-Bus API] |
||
---|---|---|---|
Line 174: | Line 174: | ||
====Config Files==== | ====Config Files==== | ||
- | /etc/init/bluetooth.conf - bluetooth daemon init | + | **/etc/init/bluetooth.conf** - bluetooth daemon init |
buildroot로 만든 rootfs에는 이의 폴더와 파일은 존재하지 않는다.\\ | buildroot로 만든 rootfs에는 이의 폴더와 파일은 존재하지 않는다.\\ | ||
폴더만 나중에 새로 생성한다 | 폴더만 나중에 새로 생성한다 | ||
- | /etc/bluetooth/main.conf - main bluetooth daemon config | + | **/etc/bluetooth/main.conf** - main bluetooth daemon config |
*name of device (when discoverable) | *name of device (when discoverable) | ||
존재는 하지만 실제 사용되는지는 알 수 없다.\\ | 존재는 하지만 실제 사용되는지는 알 수 없다.\\ | ||
Line 185: | Line 185: | ||
변화가 전혀 없다. | 변화가 전혀 없다. | ||
- | /etc/bluetooth/input.conf - configuration of the input service | + | **/etc/bluetooth/input.conf** - configuration of the input service |
buildroot로 만든 rootfs에는 이의 폴더와 파일은 존재하지 않는다. | buildroot로 만든 rootfs에는 이의 폴더와 파일은 존재하지 않는다. | ||
- | /etc/bluetooth/audio.conf - configuration of the audio service (SCO routing: PCM or HCI) | + | **/etc/bluetooth/audio.conf** - configuration of the audio service (SCO routing: PCM or HCI) |
buildroot로 만든 rootfs에는 이의 폴더와 파일은 존재하지 않는다. | buildroot로 만든 rootfs에는 이의 폴더와 파일은 존재하지 않는다. | ||
- | /etc/bluetooth/network.conf - configuration of the network service (link encryption) | + | **/etc/bluetooth/network.conf** - configuration of the network service (link encryption) |
buildroot로 만든 rootfs에는 이의 폴더와 파일은 존재하지 않는다. | buildroot로 만든 rootfs에는 이의 폴더와 파일은 존재하지 않는다. | ||
- | /etc/bluetooth/rfcomm.conf - configuration of rfcomm layer | + | **/etc/bluetooth/rfcomm.conf** - configuration of rfcomm layer |
존재는 하지만 실제 사용되는지는 알 수 없다.\\ | 존재는 하지만 실제 사용되는지는 알 수 없다.\\ | ||
Line 203: | Line 203: | ||
변화가 전혀 없다. | 변화가 전혀 없다. | ||
- | /etc/bluetooth/serial.conf - configuration of serial (DUN tty, UID) | + | **/etc/bluetooth/serial.conf** - configuration of serial (DUN tty, UID) |
buildroot로 만든 rootfs에는 이의 폴더와 파일은 존재하지 않는다. | buildroot로 만든 rootfs에는 이의 폴더와 파일은 존재하지 않는다. | ||
Line 272: | 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 |
+ | |||
+ | * 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 | ||
+ | |||
+ | =====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 | ||
- | 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: | ||
- | 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 | ||
[[PAN]] | [[PAN]] |