본문 바로가기

개발자/Raspberry Pi3

RASPBERRY PI 3 B+ 블루투스 스캐너 설정

반응형

 

 

1. bluez 설치

라즈베리파이에서 쓸수 있는 블루투스 라이브러리를 다음과 같은 절차로 설치한다.

 

1) 설치방법

– bluez 설치

$sudo apt-get update

$sudo apt-get install -y libusb-dev libdbus-1-dev libglib2.0-dev libudev-dev libical-dev libreadline-dev

 

pi@raspberrypi:~ $ sudo apt-get install -y libusb-dev libdbus-1-dev libglib2.0-dev libudev-dev libical-dev libreadline-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following package was automatically installed and is no longer required:
  rpi.gpio-common
Use 'sudo apt autoremove' to remove it.
The following additional packages will be installed:
  gir1.2-ical-3.0 icu-devtools libblkid-dev libdb-dev libdb5.3-dev libffi-dev libglib2.0-dev-bin libical3 libicu-dev libmount-dev libncurses-dev libpcre16-3 libpcre3-dev libpcre32-3
  libpcrecpp0v5 libselinux1-dev libsepol1-dev libusb-0.1-4
Suggested packages:
  db5.3-doc libglib2.0-doc libgdk-pixbuf2.0-bin | libgdk-pixbuf2.0-dev libxml2-utils icu-doc ncurses-doc readline-doc
The following NEW packages will be installed:
  gir1.2-ical-3.0 icu-devtools libblkid-dev libdb-dev libdb5.3-dev libdbus-1-dev libffi-dev libglib2.0-dev libglib2.0-dev-bin libical-dev libical3 libicu-dev libmount-dev libncurses-dev
  libpcre16-3 libpcre3-dev libpcre32-3 libpcrecpp0v5 libreadline-dev libselinux1-dev libsepol1-dev libudev-dev libusb-0.1-4 libusb-dev
0 upgraded, 24 newly installed, 0 to remove and 19 not upgraded.
Need to get 14.8 MB of archives.
After this operation, 66.1 MB of additional disk space will be used.
Get:1 http://raspbian.raspberrypi.org/raspbian buster/main armhf libical3 armhf 3.0.4-3 [227 kB]
Get:2 http://raspbian.raspberrypi.org/raspbian buster/main armhf gir1.2-ical-3.0 armhf 3.0.4-3 [49.4 kB]
Get:3 http://raspbian.raspberrypi.org/raspbian buster/main armhf icu-devtools armhf 63.1-6 [163 kB]
Get:4 http://raspbian.raspberrypi.org/raspbian buster/main armhf libblkid-dev armhf 2.33.1-0.1 [210 kB]
Get:5 http://raspbian.raspberrypi.org/raspbian buster/main armhf libdbus-1-dev armhf 1.12.16-1 [219 kB]
Get:6 http://raspbian.raspberrypi.org/raspbian buster/main armhf libffi-dev armhf 3.2.1-9 [159 kB]
Get:7 http://raspbian.raspberrypi.org/raspbian buster/main armhf libglib2.0-dev-bin armhf 2.58.3-2 [154 kB]
Get:8 http://raspbian.raspberrypi.org/raspbian buster/main armhf libmount-dev armhf 2.33.1-0.1 [209 kB]
Get:9 http://raspbian.raspberrypi.org/raspbian buster/main armhf libpcre16-3 armhf 2:8.39-12 [234 kB]
Get:10 http://raspbian.raspberrypi.org/raspbian buster/main armhf libpcre32-3 armhf 2:8.39-12 [227 kB]
Get:11 http://raspbian.raspberrypi.org/raspbian buster/main armhf libpcrecpp0v5 armhf 2:8.39-12 [150 kB]
Get:12 http://raspbian.raspberrypi.org/raspbian buster/main armhf libpcre3-dev armhf 2:8.39-12 [564 kB]
Get:13 http://raspbian.raspberrypi.org/raspbian buster/main armhf libsepol1-dev armhf 2.8-1 [309 kB]
Get:14 http://raspbian.raspberrypi.org/raspbian buster/main armhf libselinux1-dev armhf 2.8-1+b1 [156 kB]
Get:15 http://raspbian.raspberrypi.org/raspbian buster/main armhf libglib2.0-dev armhf 2.58.3-2 [1,372 kB]
Get:16 http://raspbian.raspberrypi.org/raspbian buster/main armhf libicu-dev armhf 63.1-6 [8,841 kB]
Get:17 http://raspbian.raspberrypi.org/raspbian buster/main armhf libdb5.3-dev armhf 5.3.28+dfsg1-0.5 [631 kB]
Get:18 http://raspbian.raspberrypi.org/raspbian buster/main armhf libdb-dev armhf 5.3.1+nmu1 [2,500 B]
Get:19 http://raspbian.raspberrypi.org/raspbian buster/main armhf libical-dev armhf 3.0.4-3 [367 kB]
Get:20 http://raspbian.raspberrypi.org/raspbian buster/main armhf libncurses-dev armhf 6.1+20181013-2 [278 kB]
Get:21 http://raspbian.raspberrypi.org/raspbian buster/main armhf libreadline-dev armhf 7.0-5 [110 kB]
Get:22 http://raspbian.raspberrypi.org/raspbian buster/main armhf libudev-dev armhf 241-5+rpi1 [108 kB]
Get:23 http://raspbian.raspberrypi.org/raspbian buster/main armhf libusb-0.1-4 armhf 2:0.1.12-32 [21.6 kB]
Get:24 http://raspbian.raspberrypi.org/raspbian buster/main armhf libusb-dev armhf 2:0.1.12-32 [35.7 kB]
Fetched 14.8 MB in 55s (271 kB/s)
Selecting previously unselected package libical3:armhf.
(Reading database ... 155671 files and directories currently installed.)
Preparing to unpack .../00-libical3_3.0.4-3_armhf.deb ...
Unpacking libical3:armhf (3.0.4-3) ...
Selecting previously unselected package gir1.2-ical-3.0:armhf.
Preparing to unpack .../01-gir1.2-ical-3.0_3.0.4-3_armhf.deb ...
Unpacking gir1.2-ical-3.0:armhf (3.0.4-3) ...
Selecting previously unselected package icu-devtools.
Preparing to unpack .../02-icu-devtools_63.1-6_armhf.deb ...
Unpacking icu-devtools (63.1-6) ...
Selecting previously unselected package libblkid-dev:armhf.
Preparing to unpack .../03-libblkid-dev_2.33.1-0.1_armhf.deb ...
Unpacking libblkid-dev:armhf (2.33.1-0.1) ...
Selecting previously unselected package libdbus-1-dev:armhf.
Preparing to unpack .../04-libdbus-1-dev_1.12.16-1_armhf.deb ...
Unpacking libdbus-1-dev:armhf (1.12.16-1) ...
Selecting previously unselected package libffi-dev:armhf.
Preparing to unpack .../05-libffi-dev_3.2.1-9_armhf.deb ...
Unpacking libffi-dev:armhf (3.2.1-9) ...
Selecting previously unselected package libglib2.0-dev-bin.
Preparing to unpack .../06-libglib2.0-dev-bin_2.58.3-2_armhf.deb ...
Unpacking libglib2.0-dev-bin (2.58.3-2) ...
Selecting previously unselected package libmount-dev:armhf.
Preparing to unpack .../07-libmount-dev_2.33.1-0.1_armhf.deb ...
Unpacking libmount-dev:armhf (2.33.1-0.1) ...
Selecting previously unselected package libpcre16-3:armhf.
Preparing to unpack .../08-libpcre16-3_2%3a8.39-12_armhf.deb ...
Unpacking libpcre16-3:armhf (2:8.39-12) ...
Selecting previously unselected package libpcre32-3:armhf.
Preparing to unpack .../09-libpcre32-3_2%3a8.39-12_armhf.deb ...
Unpacking libpcre32-3:armhf (2:8.39-12) ...
Selecting previously unselected package libpcrecpp0v5:armhf.
Preparing to unpack .../10-libpcrecpp0v5_2%3a8.39-12_armhf.deb ...
Unpacking libpcrecpp0v5:armhf (2:8.39-12) ...
Selecting previously unselected package libpcre3-dev:armhf.
Preparing to unpack .../11-libpcre3-dev_2%3a8.39-12_armhf.deb ...
Unpacking libpcre3-dev:armhf (2:8.39-12) ...
Selecting previously unselected package libsepol1-dev:armhf.
Preparing to unpack .../12-libsepol1-dev_2.8-1_armhf.deb ...
Unpacking libsepol1-dev:armhf (2.8-1) ...
Selecting previously unselected package libselinux1-dev:armhf.
Preparing to unpack .../13-libselinux1-dev_2.8-1+b1_armhf.deb ...
Unpacking libselinux1-dev:armhf (2.8-1+b1) ...
Selecting previously unselected package libglib2.0-dev:armhf.
Preparing to unpack .../14-libglib2.0-dev_2.58.3-2_armhf.deb ...
Unpacking libglib2.0-dev:armhf (2.58.3-2) ...
Selecting previously unselected package libicu-dev:armhf.
Preparing to unpack .../15-libicu-dev_63.1-6_armhf.deb ...
Unpacking libicu-dev:armhf (63.1-6) ...
Selecting previously unselected package libdb5.3-dev.
Preparing to unpack .../16-libdb5.3-dev_5.3.28+dfsg1-0.5_armhf.deb ...
Unpacking libdb5.3-dev (5.3.28+dfsg1-0.5) ...
Selecting previously unselected package libdb-dev:armhf.
Preparing to unpack .../17-libdb-dev_5.3.1+nmu1_armhf.deb ...
Unpacking libdb-dev:armhf (5.3.1+nmu1) ...
Selecting previously unselected package libical-dev:armhf.
Preparing to unpack .../18-libical-dev_3.0.4-3_armhf.deb ...
Unpacking libical-dev:armhf (3.0.4-3) ...
Selecting previously unselected package libncurses-dev:armhf.
Preparing to unpack .../19-libncurses-dev_6.1+20181013-2_armhf.deb ...
Unpacking libncurses-dev:armhf (6.1+20181013-2) ...
Selecting previously unselected package libreadline-dev:armhf.
Preparing to unpack .../20-libreadline-dev_7.0-5_armhf.deb ...
Unpacking libreadline-dev:armhf (7.0-5) ...
Selecting previously unselected package libudev-dev:armhf.
Preparing to unpack .../21-libudev-dev_241-5+rpi1_armhf.deb ...
Unpacking libudev-dev:armhf (241-5+rpi1) ...
Selecting previously unselected package libusb-0.1-4:armhf.
Preparing to unpack .../22-libusb-0.1-4_2%3a0.1.12-32_armhf.deb ...
Unpacking libusb-0.1-4:armhf (2:0.1.12-32) ...
Selecting previously unselected package libusb-dev.
Preparing to unpack .../23-libusb-dev_2%3a0.1.12-32_armhf.deb ...
Unpacking libusb-dev (2:0.1.12-32) ...
Setting up libpcrecpp0v5:armhf (2:8.39-12) ...
Setting up libglib2.0-dev-bin (2.58.3-2) ...
Setting up libblkid-dev:armhf (2.33.1-0.1) ...
Setting up libncurses-dev:armhf (6.1+20181013-2) ...
Setting up libpcre16-3:armhf (2:8.39-12) ...
Setting up libsepol1-dev:armhf (2.8-1) ...
Setting up libreadline-dev:armhf (7.0-5) ...
Setting up libffi-dev:armhf (3.2.1-9) ...
Setting up libusb-0.1-4:armhf (2:0.1.12-32) ...
Setting up libdbus-1-dev:armhf (1.12.16-1) ...
Setting up libpcre32-3:armhf (2:8.39-12) ...
Setting up icu-devtools (63.1-6) ...
Setting up libudev-dev:armhf (241-5+rpi1) ...
Setting up libdb5.3-dev (5.3.28+dfsg1-0.5) ...
Setting up libical3:armhf (3.0.4-3) ...
Setting up libicu-dev:armhf (63.1-6) ...
Setting up libmount-dev:armhf (2.33.1-0.1) ...
Setting up libpcre3-dev:armhf (2:8.39-12) ...
Setting up libusb-dev (2:0.1.12-32) ...
Setting up gir1.2-ical-3.0:armhf (3.0.4-3) ...
Setting up libdb-dev:armhf (5.3.1+nmu1) ...
Setting up libselinux1-dev:armhf (2.8-1+b1) ...
Setting up libical-dev:armhf (3.0.4-3) ...
Setting up libglib2.0-dev:armhf (2.58.3-2) ...
Processing triggers for install-info (6.5.0.dfsg.1-4+b1) ...
Processing triggers for libglib2.0-0:armhf (2.58.3-2) ...
Processing triggers for libc-bin (2.28-10+rpi1) ...
Processing triggers for man-db (2.8.5-2) ...
Processing triggers for sgml-base (1.29) ...
pi@raspberrypi:~ $

 

$sudo wget www.kernel.org/pub/linux/bluetooth/bluez-5.9.tar.gz

$tar xvf bluez-5.9.tar.gz

$cd bluez-5.9/

$sudo ./configure

 

아래는 길지만 $sudo make 하기 전까지의 출력화면

 

pi@raspberrypi:~ $ sudo wget www.kernel.org/pub/linux/bluetooth/bluez-5.9.tar.gz
--2019-08-05 22:33:27--  http://www.kernel.org/pub/linux/bluetooth/bluez-5.9.tar.gz
Resolving www.kernel.org (www.kernel.org)... 147.75.46.191, 2604:1380:4080:c00::1
Connecting to www.kernel.org (www.kernel.org)|147.75.46.191|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://www.kernel.org/pub/linux/bluetooth/bluez-5.9.tar.gz [following]
--2019-08-05 22:33:28--  https://www.kernel.org/pub/linux/bluetooth/bluez-5.9.tar.gz
Connecting to www.kernel.org (www.kernel.org)|147.75.46.191|:443... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://mirrors.edge.kernel.org/pub/linux/bluetooth/bluez-5.9.tar.gz [following]
--2019-08-05 22:33:29--  https://mirrors.edge.kernel.org/pub/linux/bluetooth/bluez-5.9.tar.gz
Resolving mirrors.edge.kernel.org (mirrors.edge.kernel.org)... 147.75.95.133, 2604:1380:3000:1500::1
Connecting to mirrors.edge.kernel.org (mirrors.edge.kernel.org)|147.75.95.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1465659 (1.4M) [application/x-gzip]
Saving to: ‘bluez-5.9.tar.gz’

bluez-5.9.tar.gz                                100%[====================================================================================================>]   1.40M   991KB/s    in 1.4s

2019-08-05 22:33:32 (991 KB/s) - ‘bluez-5.9.tar.gz’ saved [1465659/1465659]

pi@raspberrypi:~ $ cd bluez-5.9/
-bash: cd: bluez-5.9/: No such file or directory
pi@raspberrypi:~ $ tar xvf bluez-5.9.tar.gz
bluez-5.9/
bluez-5.9/Makefile.plugins
bluez-5.9/emulator/
bluez-5.9/emulator/bthost.h
bluez-5.9/emulator/server.c
bluez-5.9/emulator/bthost.c
bluez-5.9/emulator/b1ee.c
bluez-5.9/emulator/vhci.h
bluez-5.9/emulator/btdev.c
bluez-5.9/emulator/btdev.h
bluez-5.9/emulator/main.c
bluez-5.9/emulator/vhci.c
bluez-5.9/emulator/server.h
bluez-5.9/aclocal.m4
bluez-5.9/depcomp
bluez-5.9/INSTALL
bluez-5.9/Makefile.obexd
bluez-5.9/Makefile.tools
bluez-5.9/config.h.in
bluez-5.9/btio/
bluez-5.9/btio/btio.c
bluez-5.9/btio/btio.h
bluez-5.9/install-sh
bluez-5.9/attrib/
bluez-5.9/attrib/gatt.h
bluez-5.9/attrib/gatttool.c
bluez-5.9/attrib/gattrib.c
bluez-5.9/attrib/gatttool.h
bluez-5.9/attrib/att-database.h
bluez-5.9/attrib/interactive.c
bluez-5.9/attrib/gatt-service.c
bluez-5.9/attrib/utils.c
bluez-5.9/attrib/gatt-service.h
bluez-5.9/attrib/gatt.c
bluez-5.9/attrib/gattrib.h
bluez-5.9/attrib/att.c
bluez-5.9/attrib/att.h
bluez-5.9/missing
bluez-5.9/configure.ac
bluez-5.9/acinclude.m4
bluez-5.9/NEWS
bluez-5.9/configure
bluez-5.9/COPYING
bluez-5.9/Makefile.am
bluez-5.9/doc/
bluez-5.9/doc/sap-api.txt
bluez-5.9/doc/media-api.txt
bluez-5.9/doc/adapter-api.txt
bluez-5.9/doc/obex-agent-api.txt
bluez-5.9/doc/health-api.txt
bluez-5.9/doc/thermometer-api.txt
bluez-5.9/doc/profile-api.txt
bluez-5.9/doc/supported-features.txt
bluez-5.9/doc/obex-api.txt
bluez-5.9/doc/mgmt-api.txt
bluez-5.9/doc/device-api.txt
bluez-5.9/doc/cyclingspeed-api.txt
bluez-5.9/doc/network-api.txt
bluez-5.9/doc/proximity-api.txt
bluez-5.9/doc/assigned-numbers.txt
bluez-5.9/doc/heartrate-api.txt
bluez-5.9/doc/alert-api.txt
bluez-5.9/doc/agent-api.txt
bluez-5.9/obexd/
bluez-5.9/obexd/src/
bluez-5.9/obexd/src/obex.c
bluez-5.9/obexd/src/transport.c
bluez-5.9/obexd/src/mimetype.c
bluez-5.9/obexd/src/service.h
bluez-5.9/obexd/src/log.h
bluez-5.9/obexd/src/plugin.h
bluez-5.9/obexd/src/org.bluez.obex.service
bluez-5.9/obexd/src/map_ap.h
bluez-5.9/obexd/src/server.c
bluez-5.9/obexd/src/transport.h
bluez-5.9/obexd/src/obex.h
bluez-5.9/obexd/src/plugin.c
bluez-5.9/obexd/src/obex-priv.h
bluez-5.9/obexd/src/main.c
bluez-5.9/obexd/src/obexd.h
bluez-5.9/obexd/src/manager.h
bluez-5.9/obexd/src/service.c
bluez-5.9/obexd/src/mimetype.h
bluez-5.9/obexd/src/obex.service.in
bluez-5.9/obexd/src/manager.c
bluez-5.9/obexd/src/server.h
bluez-5.9/obexd/src/genbuiltin
bluez-5.9/obexd/src/log.c
bluez-5.9/obexd/plugins/
bluez-5.9/obexd/plugins/messages-dummy.c
bluez-5.9/obexd/plugins/bluetooth.c
bluez-5.9/obexd/plugins/ftp.h
bluez-5.9/obexd/plugins/phonebook-dummy.c
bluez-5.9/obexd/plugins/filesystem.c
bluez-5.9/obexd/plugins/mas.c
bluez-5.9/obexd/plugins/opp.c
bluez-5.9/obexd/plugins/messages.h
bluez-5.9/obexd/plugins/phonebook.h
bluez-5.9/obexd/plugins/vcard.c
bluez-5.9/obexd/plugins/vcard.h
bluez-5.9/obexd/plugins/pcsuite.c
bluez-5.9/obexd/plugins/ftp.c
bluez-5.9/obexd/plugins/filesystem.h
bluez-5.9/obexd/plugins/pbap.c
bluez-5.9/obexd/plugins/irmc.c
bluez-5.9/obexd/client/
bluez-5.9/obexd/client/map-event.h
bluez-5.9/obexd/client/bluetooth.c
bluez-5.9/obexd/client/pbap.h
bluez-5.9/obexd/client/dbus.c
bluez-5.9/obexd/client/dbus.h
bluez-5.9/obexd/client/transfer.h
bluez-5.9/obexd/client/ftp.h
bluez-5.9/obexd/client/transport.c
bluez-5.9/obexd/client/opp.h
bluez-5.9/obexd/client/mns.c
bluez-5.9/obexd/client/opp.c
bluez-5.9/obexd/client/transport.h
bluez-5.9/obexd/client/sync.h
bluez-5.9/obexd/client/ftp.c
bluez-5.9/obexd/client/map.c
bluez-5.9/obexd/client/transfer.c
bluez-5.9/obexd/client/pbap.c
bluez-5.9/obexd/client/sync.c
bluez-5.9/obexd/client/manager.h
bluez-5.9/obexd/client/session.c
bluez-5.9/obexd/client/bluetooth.h
bluez-5.9/obexd/client/session.h
bluez-5.9/obexd/client/map-event.c
bluez-5.9/obexd/client/driver.c
bluez-5.9/obexd/client/manager.c
bluez-5.9/obexd/client/map.h
bluez-5.9/obexd/client/driver.h
bluez-5.9/src/
bluez-5.9/src/sdp-client.c
bluez-5.9/src/sdpd-database.c
bluez-5.9/src/service.h
bluez-5.9/src/attrib-server.c
bluez-5.9/src/sdpd-server.c
bluez-5.9/src/log.h
bluez-5.9/src/plugin.h
bluez-5.9/src/systemd.h
bluez-5.9/src/sdp-client.h
bluez-5.9/src/shared/
bluez-5.9/src/shared/tester.h
bluez-5.9/src/shared/hciemu.h
bluez-5.9/src/shared/util.h
bluez-5.9/src/shared/pcap.c
bluez-5.9/src/shared/tester.c
bluez-5.9/src/shared/btsnoop.c
bluez-5.9/src/shared/btsnoop.h
bluez-5.9/src/shared/mgmt.h
bluez-5.9/src/shared/pcap.h
bluez-5.9/src/shared/util.c
bluez-5.9/src/shared/mgmt.c
bluez-5.9/src/shared/hciemu.c
bluez-5.9/src/main.conf
bluez-5.9/src/oui.c
bluez-5.9/src/adapter.h
bluez-5.9/src/bluetooth.service.in
bluez-5.9/src/systemd.c
bluez-5.9/src/agent.c
bluez-5.9/src/storage.c
bluez-5.9/src/profile.h
bluez-5.9/src/plugin.c
bluez-5.9/src/profile.c
bluez-5.9/src/rfkill.c
bluez-5.9/src/adapter.c
bluez-5.9/src/sdpd-request.c
bluez-5.9/src/device.c
bluez-5.9/src/eir.h
bluez-5.9/src/uinput.h
bluez-5.9/src/org.bluez.service
bluez-5.9/src/storage.h
bluez-5.9/src/textfile.c
bluez-5.9/src/oui.h
bluez-5.9/src/glib-helper.c
bluez-5.9/src/bluetoothd.8.in
bluez-5.9/src/dbus-common.h
bluez-5.9/src/device.h
bluez-5.9/src/main.c
bluez-5.9/src/hcid.h
bluez-5.9/src/attio.h
bluez-5.9/src/sdpd-service.c
bluez-5.9/src/service.c
bluez-5.9/src/dbus-common.c
bluez-5.9/src/sdp-xml.c
bluez-5.9/src/sdpd.h
bluez-5.9/src/bluetooth.ver
bluez-5.9/src/textfile.h
bluez-5.9/src/bluetooth.conf
bluez-5.9/src/error.h
bluez-5.9/src/agent.h
bluez-5.9/src/attrib-server.h
bluez-5.9/src/sdp-xml.h
bluez-5.9/src/eir.c
bluez-5.9/src/error.c
bluez-5.9/src/genbuiltin
bluez-5.9/src/glib-helper.h
bluez-5.9/src/log.c
bluez-5.9/profiles/
bluez-5.9/profiles/cups/
bluez-5.9/profiles/cups/cups.h
bluez-5.9/profiles/cups/spp.c
bluez-5.9/profiles/cups/hcrp.c
bluez-5.9/profiles/cups/sdp.c
bluez-5.9/profiles/cups/main.c
bluez-5.9/profiles/proximity/
bluez-5.9/profiles/proximity/monitor.c
bluez-5.9/profiles/proximity/reporter.h
bluez-5.9/profiles/proximity/proximity.conf
bluez-5.9/profiles/proximity/linkloss.c
bluez-5.9/profiles/proximity/linkloss.h
bluez-5.9/profiles/proximity/reporter.c
bluez-5.9/profiles/proximity/main.c
bluez-5.9/profiles/proximity/manager.h
bluez-5.9/profiles/proximity/immalert.h
bluez-5.9/profiles/proximity/manager.c
bluez-5.9/profiles/proximity/monitor.h
bluez-5.9/profiles/proximity/immalert.c
bluez-5.9/profiles/deviceinfo/
bluez-5.9/profiles/deviceinfo/deviceinfo.c
bluez-5.9/profiles/network/
bluez-5.9/profiles/network/connection.c
bluez-5.9/profiles/network/server.c
bluez-5.9/profiles/network/common.h
bluez-5.9/profiles/network/connection.h
bluez-5.9/profiles/network/common.c
bluez-5.9/profiles/network/manager.c
bluez-5.9/profiles/network/server.h
bluez-5.9/profiles/network/network.conf
bluez-5.9/profiles/iap/
bluez-5.9/profiles/iap/main.c
bluez-5.9/profiles/health/
bluez-5.9/profiles/health/hdp_main.c
bluez-5.9/profiles/health/mcap_internal.h
bluez-5.9/profiles/health/hdp.h
bluez-5.9/profiles/health/mcap.h
bluez-5.9/profiles/health/hdp_util.c
bluez-5.9/profiles/health/mcap_sync.c
bluez-5.9/profiles/health/hdp_manager.c
bluez-5.9/profiles/health/mcap.c
bluez-5.9/profiles/health/hdp_manager.h
bluez-5.9/profiles/health/mcap_lib.h
bluez-5.9/profiles/health/hdp.c
bluez-5.9/profiles/health/hdp_util.h
bluez-5.9/profiles/health/hdp_types.h
bluez-5.9/profiles/scanparam/
bluez-5.9/profiles/scanparam/scan.c
bluez-5.9/profiles/alert/
bluez-5.9/profiles/alert/server.c
bluez-5.9/profiles/input/
bluez-5.9/profiles/input/uhid_copy.h
bluez-5.9/profiles/input/suspend-dummy.c
bluez-5.9/profiles/input/server.c
bluez-5.9/profiles/input/suspend.h
bluez-5.9/profiles/input/device.c
bluez-5.9/profiles/input/hog.c
bluez-5.9/profiles/input/input.conf
bluez-5.9/profiles/input/device.h
bluez-5.9/profiles/input/manager.c
bluez-5.9/profiles/input/server.h
bluez-5.9/profiles/gatt/
bluez-5.9/profiles/gatt/gas.c
bluez-5.9/profiles/audio/
bluez-5.9/profiles/audio/player.h
bluez-5.9/profiles/audio/media.c
bluez-5.9/profiles/audio/source.c
bluez-5.9/profiles/audio/transport.c
bluez-5.9/profiles/audio/sink.h
bluez-5.9/profiles/audio/a2dp.h
bluez-5.9/profiles/audio/media.h
bluez-5.9/profiles/audio/a2dp.c
bluez-5.9/profiles/audio/transport.h
bluez-5.9/profiles/audio/control.c
bluez-5.9/profiles/audio/avrcp.h
bluez-5.9/profiles/audio/avctp.c
bluez-5.9/profiles/audio/a2dp-codecs.h
bluez-5.9/profiles/audio/avrcp.c
bluez-5.9/profiles/audio/source.h
bluez-5.9/profiles/audio/avdtp.h
bluez-5.9/profiles/audio/player.c
bluez-5.9/profiles/audio/sink.c
bluez-5.9/profiles/audio/avctp.h
bluez-5.9/profiles/audio/avdtp.c
bluez-5.9/profiles/audio/control.h
bluez-5.9/profiles/heartrate/
bluez-5.9/profiles/heartrate/heartrate.c
bluez-5.9/profiles/cyclingspeed/
bluez-5.9/profiles/cyclingspeed/cyclingspeed.c
bluez-5.9/profiles/time/
bluez-5.9/profiles/time/server.c
bluez-5.9/profiles/thermometer/
bluez-5.9/profiles/thermometer/thermometer.c
bluez-5.9/profiles/sap/
bluez-5.9/profiles/sap/sap-u8500.c
bluez-5.9/profiles/sap/server.c
bluez-5.9/profiles/sap/main.c
bluez-5.9/profiles/sap/manager.h
bluez-5.9/profiles/sap/sap-dummy.c
bluez-5.9/profiles/sap/sap.h
bluez-5.9/profiles/sap/manager.c
bluez-5.9/profiles/sap/server.h
bluez-5.9/config.guess
bluez-5.9/ChangeLog
bluez-5.9/gdbus/
bluez-5.9/gdbus/polkit.c
bluez-5.9/gdbus/gdbus.h
bluez-5.9/gdbus/object.c
bluez-5.9/gdbus/mainloop.c
bluez-5.9/gdbus/watch.c
bluez-5.9/gdbus/client.c
bluez-5.9/Makefile.in
bluez-5.9/plugins/
bluez-5.9/plugins/wiimote.c
bluez-5.9/plugins/autopair.c
bluez-5.9/plugins/neard.c
bluez-5.9/plugins/hostname.c
bluez-5.9/plugins/external-dummy.c
bluez-5.9/plugins/policy.c
bluez-5.9/plugins/gatt-example.c
bluez-5.9/ltmain.sh
bluez-5.9/compile
bluez-5.9/AUTHORS
bluez-5.9/monitor/
bluez-5.9/monitor/sdp.h
bluez-5.9/monitor/vendor.h
bluez-5.9/monitor/packet.c
bluez-5.9/monitor/bt.h
bluez-5.9/monitor/lmp.c
bluez-5.9/monitor/mainloop.c
bluez-5.9/monitor/ll.c
bluez-5.9/monitor/lmp.h
bluez-5.9/monitor/display.c
bluez-5.9/monitor/hcidump.h
bluez-5.9/monitor/ll.h
bluez-5.9/monitor/btsnoop.c
bluez-5.9/monitor/control.c
bluez-5.9/monitor/sdp.c
bluez-5.9/monitor/uuid.c
bluez-5.9/monitor/btsnoop.h
bluez-5.9/monitor/crc.h
bluez-5.9/monitor/packet.h
bluez-5.9/monitor/crc.c
bluez-5.9/monitor/main.c
bluez-5.9/monitor/hcidump.c
bluez-5.9/monitor/uuid.h
bluez-5.9/monitor/mainloop.h
bluez-5.9/monitor/l2cap.h
bluez-5.9/monitor/l2cap.c
bluez-5.9/monitor/vendor.c
bluez-5.9/monitor/display.h
bluez-5.9/monitor/control.h
bluez-5.9/client/
bluez-5.9/client/display.c
bluez-5.9/client/agent.c
bluez-5.9/client/main.c
bluez-5.9/client/agent.h
bluez-5.9/client/display.h
bluez-5.9/gobex/
bluez-5.9/gobex/gobex-packet.c
bluez-5.9/gobex/gobex-apparam.h
bluez-5.9/gobex/gobex.h
bluez-5.9/gobex/gobex-defs.h
bluez-5.9/gobex/gobex-header.h
bluez-5.9/gobex/gobex-debug.h
bluez-5.9/gobex/gobex-apparam.c
bluez-5.9/gobex/gobex-packet.h
bluez-5.9/gobex/gobex-header.c
bluez-5.9/gobex/gobex-defs.c
bluez-5.9/gobex/gobex.c
bluez-5.9/gobex/gobex-transfer.c
bluez-5.9/lib/
bluez-5.9/lib/sdp.h
bluez-5.9/lib/bluetooth.c
bluez-5.9/lib/bnep.h
bluez-5.9/lib/hci.c
bluez-5.9/lib/a2mp.h
bluez-5.9/lib/cmtp.h
bluez-5.9/lib/sdp_lib.h
bluez-5.9/lib/sdp.c
bluez-5.9/lib/uuid.c
bluez-5.9/lib/bluez.pc.in
bluez-5.9/lib/mgmt.h
bluez-5.9/lib/bluetooth.h
bluez-5.9/lib/uuid.h
bluez-5.9/lib/amp.h
bluez-5.9/lib/hci.h
bluez-5.9/lib/hci_lib.h
bluez-5.9/lib/l2cap.h
bluez-5.9/lib/rfcomm.h
bluez-5.9/lib/hidp.h
bluez-5.9/lib/sco.h
bluez-5.9/tools/
bluez-5.9/tools/hciattach.1
bluez-5.9/tools/sdptool.1
bluez-5.9/tools/bccmd.1
bluez-5.9/tools/hciattach_tialt.c
bluez-5.9/tools/csr_bcsp.c
bluez-5.9/tools/ciptool.c
bluez-5.9/tools/hcitool.c
bluez-5.9/tools/obex-server-tool.c
bluez-5.9/tools/hid2hci.1
bluez-5.9/tools/hid2hci.c
bluez-5.9/tools/hcieventmask.c
bluez-5.9/tools/gap-tester.c
bluez-5.9/tools/hciattach_qualcomm.c
bluez-5.9/tools/mpris-player.c
bluez-5.9/tools/ubcsp.c
bluez-5.9/tools/btiotest.c
bluez-5.9/tools/rfcomm.c
bluez-5.9/tools/bluetooth-player.c
bluez-5.9/tools/avtest.c
bluez-5.9/tools/mgmt-tester.c
bluez-5.9/tools/csr_hci.c
bluez-5.9/tools/hciattach_ti.c
bluez-5.9/tools/btsnoop.c
bluez-5.9/tools/scotest.c
bluez-5.9/tools/l2ping.1
bluez-5.9/tools/btinfo.c
bluez-5.9/tools/parser/
bluez-5.9/tools/parser/sdp.h
bluez-5.9/tools/parser/obex.c
bluez-5.9/tools/parser/lmp.c
bluez-5.9/tools/parser/bpa.c
bluez-5.9/tools/parser/smp.c
bluez-5.9/tools/parser/rfcomm.c
bluez-5.9/tools/parser/hci.c
bluez-5.9/tools/parser/cmtp.c
bluez-5.9/tools/parser/tcpip.c
bluez-5.9/tools/parser/hcrp.c
bluez-5.9/tools/parser/sdp.c
bluez-5.9/tools/parser/parser.h
bluez-5.9/tools/parser/sap.c
bluez-5.9/tools/parser/parser.c
bluez-5.9/tools/parser/hidp.c
bluez-5.9/tools/parser/ericsson.c
bluez-5.9/tools/parser/capi.c
bluez-5.9/tools/parser/avctp.c
bluez-5.9/tools/parser/avrcp.c
bluez-5.9/tools/parser/l2cap.h
bluez-5.9/tools/parser/l2cap.c
bluez-5.9/tools/parser/ppp.c
bluez-5.9/tools/parser/bnep.c
bluez-5.9/tools/parser/att.c
bluez-5.9/tools/parser/rfcomm.h
bluez-5.9/tools/parser/avdtp.c
bluez-5.9/tools/parser/amp.c
bluez-5.9/tools/parser/csr.c
bluez-5.9/tools/rfcomm.1
bluez-5.9/tools/hciconfig.1
bluez-5.9/tools/hcisecfilter.c
bluez-5.9/tools/l2cap-tester.c
bluez-5.9/tools/sdptool.c
bluez-5.9/tools/ciptool.1
bluez-5.9/tools/hcidump.1
bluez-5.9/tools/btmgmt.c
bluez-5.9/tools/ubcsp.h
bluez-5.9/tools/hciattach_st.c
bluez-5.9/tools/rctest.1
bluez-5.9/tools/hciattach.h
bluez-5.9/tools/avinfo.c
bluez-5.9/tools/btattach.c
bluez-5.9/tools/hwdb.c
bluez-5.9/tools/hid2hci.rules
bluez-5.9/tools/magic.btsnoop
bluez-5.9/tools/l2test.c
bluez-5.9/tools/hcidump.c
bluez-5.9/tools/hcitool.1
bluez-5.9/tools/hciattach_intel.c
bluez-5.9/tools/bdaddr.c
bluez-5.9/tools/l2ping.c
bluez-5.9/tools/csr_usb.c
bluez-5.9/tools/csr_3wire.c
bluez-5.9/tools/bccmd.c
bluez-5.9/tools/hciattach_ath3k.c
bluez-5.9/tools/hciconfig.c
bluez-5.9/tools/rctest.c
bluez-5.9/tools/csr_h4.c
bluez-5.9/tools/csr.h
bluez-5.9/tools/obex-client-tool.c
bluez-5.9/tools/sco-tester.c
bluez-5.9/tools/csr.c
bluez-5.9/tools/hciattach.c
bluez-5.9/COPYING.LIB
bluez-5.9/TODO
bluez-5.9/unit/
bluez-5.9/unit/test-gdbus-client.c
bluez-5.9/unit/test-uuid.c
bluez-5.9/unit/test-gobex-packet.c
bluez-5.9/unit/util.h
bluez-5.9/unit/test-gobex-header.c
bluez-5.9/unit/test-crc.c
bluez-5.9/unit/test-gobex.c
bluez-5.9/unit/test-textfile.c
bluez-5.9/unit/test-gobex-transfer.c
bluez-5.9/unit/test-mgmt.c
bluez-5.9/unit/test-gobex-apparam.c
bluez-5.9/unit/test-eir.c
bluez-5.9/unit/util.c
bluez-5.9/unit/test-sdp.c
bluez-5.9/unit/test-lib.c
bluez-5.9/README
bluez-5.9/config.sub
bluez-5.9/test/
bluez-5.9/test/service-did.xml
bluez-5.9/test/test-health-sink
bluez-5.9/test/test-health
bluez-5.9/test/test-adapter
bluez-5.9/test/test-device
bluez-5.9/test/test-cyclingspeed
bluez-5.9/test/test-proximity
bluez-5.9/test/simple-service
bluez-5.9/test/monitor-bluetooth
bluez-5.9/test/dbusdef.py
bluez-5.9/test/test-nap
bluez-5.9/test/test-profile
bluez-5.9/test/test-discovery
bluez-5.9/test/test-manager
bluez-5.9/test/test-heartrate
bluez-5.9/test/list-devices
bluez-5.9/test/test-alert
bluez-5.9/test/test-sap-server
bluez-5.9/test/simple-agent
bluez-5.9/test/service-opp.xml
bluez-5.9/test/simple-endpoint
bluez-5.9/test/service-ftp.xml
bluez-5.9/test/service-record.dtd
bluez-5.9/test/service-spp.xml
bluez-5.9/test/test-hfp
bluez-5.9/test/test-network
bluez-5.9/test/bluezutils.py
bluez-5.9/test/sap_client.py
bluez-5.9/test/test-thermometer
bluez-5.9/test/simple-player
pi@raspberrypi:~ $ sudo ./configure
sudo: ./configure: command not found
pi@raspberrypi:~ $ cd bluez-5.9/
pi@raspberrypi:~/bluez-5.9 $ sudo ./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking how to create a pax tar archive... gnutar
checking for style of include used by make... GNU
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking dependency style of gcc... gcc3
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking minix/config.h usability... no
checking minix/config.h presence... no
checking for minix/config.h... no
checking whether it is safe to define __EXTENSIONS__... yes
checking whether make supports nested variables... (cached) yes
checking whether to enable maintainer-specific portions of Makefiles... no
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for C/C++ restrict keyword... __restrict
checking for gcc... (cached) gcc
checking whether we are using the GNU C compiler... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking for gcc option to accept ISO C89... (cached) none needed
checking dependency style of gcc... (cached) gcc3
checking whether gcc and cc understand -c and -o together... yes
checking whether gcc accepts -fPIE... yes
checking build system type... armv7l-unknown-linux-gnueabihf
checking host system type... armv7l-unknown-linux-gnueabihf
checking how to print strings... printf
checking for a sed that does not truncate output... /bin/sed
checking for fgrep... /bin/grep -F
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking how to convert armv7l-unknown-linux-gnueabihf file names to armv7l-unknown-linux-gnueabihf format... func_convert_file_noop
checking how to convert armv7l-unknown-linux-gnueabihf file names to toolchain format... func_convert_file_noop
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for ar... ar
checking for archiver @FILE support... @
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking for sysroot... no
checking for mt... mt
checking if mt is a manifest tool... no
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC -DPIC
checking if gcc PIC flag -fPIC -DPIC works... yes
checking if gcc static flag -static works... yes
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/usr/bin/ld) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no
checking for signalfd... yes
checking for clock_gettime in -lrt... yes
checking for pthread_create in -lpthread... yes
checking for dlopen in -ldl... yes
checking for GLIB... yes
checking for DBUS... yes
checking D-Bus configuration directory... /etc
checking D-Bus system bus services dir... /usr/share/dbus-1/system-services
checking D-Bus session bus services dir... /usr/share/dbus-1/services
checking for UDEV... yes
checking for udev_hwdb_new in -ludev... yes
checking udev directory... /lib/udev
checking for ICAL... yes
checking readline/readline.h usability... yes
checking readline/readline.h presence... yes
checking for readline/readline.h... yes
checking systemd system unit dir... /lib/systemd/system
checking systemd user unit dir... /usr/lib/systemd/user
configure: creating ./config.status
config.status: creating Makefile
config.status: creating src/bluetoothd.8
config.status: creating lib/bluez.pc
config.status: creating config.h
config.status: executing depfiles commands
config.status: executing libtool commands
pi@raspberrypi:~/bluez-5.9 $

 

여기까지 하고나서

 

$sudo make 를 실행한다.

 

한참 걸린다. 한 10분 정도 컴파일 한다. 각 C언어 파일에 대해 링크가 가능한 오브젝트 파일을 만든다고 생각하시면 된다. 아래 명령어가 바로 실행파일을 만드는 명령이다.

 

$sudo make install

 

이게 맞나? 중간에 pc가 리셋~ㅠ.ㅠ

 

pi@raspberrypi:~/bluez-5.9 $ sudo make install
make --no-print-directory install-am
 /bin/mkdir -p '/usr/local/bin'
  /bin/bash ./libtool   --mode=install /usr/bin/install -c client/bluetoothctl monitor/btmon tools/hciattach tools/hciconfig tools/hcitool tools/hcidump tools/rfcomm tools/rctest tools/l2test tools/l2ping tools/sdptool tools/ciptool tools/bccmd '/usr/local/bin'
libtool: install: /usr/bin/install -c client/bluetoothctl /usr/local/bin/bluetoothctl
libtool: install: /usr/bin/install -c monitor/btmon /usr/local/bin/btmon
libtool: install: /usr/bin/install -c tools/hciattach /usr/local/bin/hciattach
libtool: install: /usr/bin/install -c tools/hciconfig /usr/local/bin/hciconfig
libtool: install: /usr/bin/install -c tools/hcitool /usr/local/bin/hcitool
libtool: install: /usr/bin/install -c tools/hcidump /usr/local/bin/hcidump
libtool: install: /usr/bin/install -c tools/rfcomm /usr/local/bin/rfcomm
libtool: install: /usr/bin/install -c tools/rctest /usr/local/bin/rctest
libtool: install: /usr/bin/install -c tools/l2test /usr/local/bin/l2test
libtool: install: /usr/bin/install -c tools/l2ping /usr/local/bin/l2ping
libtool: install: /usr/bin/install -c tools/sdptool /usr/local/bin/sdptool
libtool: install: /usr/bin/install -c tools/ciptool /usr/local/bin/ciptool
libtool: install: /usr/bin/install -c tools/bccmd /usr/local/bin/bccmd
 /bin/mkdir -p '/usr/local/libexec/bluetooth'
  /bin/bash ./libtool   --mode=install /usr/bin/install -c src/bluetoothd obexd/src/obexd '/usr/local/libexec/bluetooth'
libtool: install: /usr/bin/install -c src/bluetoothd /usr/local/libexec/bluetooth/bluetoothd
libtool: install: /usr/bin/install -c obexd/src/obexd /usr/local/libexec/bluetooth/obexd
 /bin/mkdir -p '/usr/local/lib/cups/backend'
  /bin/bash ./libtool   --mode=install /usr/bin/install -c profiles/cups/bluetooth '/usr/local/lib/cups/backend'
libtool: install: /usr/bin/install -c profiles/cups/bluetooth /usr/local/lib/cups/backend/bluetooth
 /bin/mkdir -p '/etc/dbus-1/system.d'
 /usr/bin/install -c -m 644 src/bluetooth.conf '/etc/dbus-1/system.d'
 /bin/mkdir -p '/usr/share/dbus-1/services'
 /usr/bin/install -c -m 644 obexd/src/org.bluez.obex.service '/usr/share/dbus-1/services'
 /bin/mkdir -p '/usr/share/dbus-1/system-services'
 /usr/bin/install -c -m 644 src/org.bluez.service '/usr/share/dbus-1/system-services'
 /bin/mkdir -p '/usr/local/share/man/man1'
 /usr/bin/install -c -m 644 tools/hciattach.1 tools/hciconfig.1 tools/hcitool.1 tools/hcidump.1 tools/rfcomm.1 tools/rctest.1 tools/l2ping.1 tools/sdptool.1 tools/ciptool.1 tools/bccmd.1 tools/hid2hci.1 '/usr/local/share/man/man1'
 /bin/mkdir -p '/usr/local/share/man/man8'
 /usr/bin/install -c -m 644 src/bluetoothd.8 '/usr/local/share/man/man8'
 /bin/mkdir -p '/lib/udev/rules.d'
 /usr/bin/install -c -m 644 tools/97-hid2hci.rules '/lib/udev/rules.d'
 /bin/mkdir -p '/lib/systemd/system'
 /usr/bin/install -c -m 644 src/bluetooth.service '/lib/systemd/system'
 /bin/mkdir -p '/usr/lib/systemd/user'
 /usr/bin/install -c -m 644 obexd/src/obex.service '/usr/lib/systemd/user'
 /bin/mkdir -p '/lib/udev'
  /bin/bash ./libtool   --mode=install /usr/bin/install -c tools/hid2hci '/lib/udev'
libtool: install: /usr/bin/install -c tools/hid2hci /lib/udev/hid2hci
pi@raspberrypi:~/bluez-5.9 $

 

 

– 파이썬용 pybluez 설치

 

$cd

$sudo apt-get install libbluetooth-dev

$sudo apt-get install python3-pip

$sudo pip3 install pybluez

 

위 명령을 실행한 화면 출력 결과는 아래와 같다.

 

pi@raspberrypi:~ $ sudo apt-get install libbluetooth-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following package was automatically installed and is no longer required:
  rpi.gpio-common
Use 'sudo apt autoremove' to remove it.
The following NEW packages will be installed:
  libbluetooth-dev
0 upgraded, 1 newly installed, 0 to remove and 19 not upgraded.
Need to get 190 kB of archives.
After this operation, 524 kB of additional disk space will be used.
Get:1 http://archive.raspberrypi.org/debian buster/main armhf libbluetooth-dev armhf 5.50-1+rpt1 [190 kB]
Fetched 190 kB in 1s (132 kB/s)
Selecting previously unselected package libbluetooth-dev:armhf.
(Reading database ... 157187 files and directories currently installed.)
Preparing to unpack .../libbluetooth-dev_5.50-1+rpt1_armhf.deb ...
Unpacking libbluetooth-dev:armhf (5.50-1+rpt1) ...
Setting up libbluetooth-dev:armhf (5.50-1+rpt1) ...
pi@raspberrypi:~ $ sudo apt-get install python3-pip
Reading package lists... Done
Building dependency tree
Reading state information... Done
python3-pip is already the newest version (18.1-5+rpt1).
The following package was automatically installed and is no longer required:
  rpi.gpio-common
Use 'sudo apt autoremove' to remove it.
0 upgraded, 0 newly installed, 0 to remove and 19 not upgraded.
pi@raspberrypi:~ $ sudo pip3 install pybluez
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting pybluez
  Downloading https://files.pythonhosted.org/packages/c1/98/3149481d508bee174335be6725880f00d297afebe75c15e917af8f6fe169/PyBluez-0.22.zip (109kB)
    100% |████████████████████████████████| 112kB 775kB/s
Building wheels for collected packages: pybluez
  Running setup.py bdist_wheel for pybluez ... done
  Stored in directory: /root/.cache/pip/wheels/e1/0c/0e/2d49f6281421e48d31af681559baef6b3ffa82d54f12115ce3
Successfully built pybluez
Installing collected packages: pybluez
Successfully installed pybluez-0.22
pi@raspberrypi:~ $

 

 

2) 블루투스 동작 확인

 

다음과 같이 hciconfig 명령을 입력하여 보면 RUNNING 이라고 뜨는것을 확인할수 있다.

 

$hciconfig

hci0: Type: Primary Bus: UART

BD Address: B8:27:EB:40:07:6F ACL MTU: 1021:8 SCO MTU: 64:1

UP RUNNING

RX bytes:752 acl:0 sco:0 events:47 errors:0

TX bytes:2733 acl:0 sco:0 commands:47 errors:0

 

– RUNNING아 아니라면 sudo hciconfig hci0 up 를 입력하여 RUNNING상태로 바꾼다.

 

참고로 아래 화면은 USB Beacon 동글을 라즈베리파이에 연결한 상태의 화면이다. 그래서 hci0 와 hci1 두 개의 비콘이 UART 와 USB 로 잡힌 것을 볼 수 있다. 

 

pi@raspberrypi:~ $ hciconfig
hci1:   Type: BR/EDR  Bus: UART
        BD Address: B8:27:EB:1E:B1:2A  ACL MTU: 1021:8  SCO MTU: 64:1
        UP RUNNING
        RX bytes:708 acl:0 sco:0 events:38 errors:0
        TX bytes:448 acl:0 sco:0 commands:38 errors:0

hci0:   Type: BR/EDR  Bus: USB
        BD Address: 00:1A:7D:DA:71:04  ACL MTU: 310:10  SCO MTU: 64:8
        UP RUNNING PSCAN
        RX bytes:1226 acl:0 sco:0 events:73 errors:0
        TX bytes:2071 acl:0 sco:0 commands:73 errors:0

pi@raspberrypi:~ $

 

3) 파이썬용 비콘스캐너 설치

 

개발전에 비콘값을 제대로 받을수 있는지 테스트하기 위해 오픈소스로 되어 있는 비콘스캐너를 아래와 같이 다운로드 받아 테스트해보았다.

비콘값을 제대로 받는다면 UUID, RSSI등의 값이 출력되는것을 볼수있다.

$sudo apt-get install python-bluez

$sudo apt-get install git

$git clone https://github.com/switchdoclabs/iBeacon-Scanner-

$cd iBeacon-Scanner-/

$sudo python testblescan.py

 

여기까지 하고 나서 아래 테스트를 진행하면 잘 되는 데 나 같은 경우에는 잘 되지가 않아서 ble USB 동글을 꽃아야 되고, 라즈베리파이3 B+ 자체 BLE 로는 실행이 되지 않았다. 여하튼 여기까지 테스트 완료.

 

아래는 위 명령어 $sudo python testblescan.py 실행화면이다. 

 

pi@raspberrypi:~/iBeacon-Scanner- $ sudo python testblescan.py
ble thread started
----------
71:d0:84:ba:01:c5,00fc0ab151e54d0af8330abbe7f61005,2832,55810,-66,-89
fd:cb:70:a9:f4:9b,1f4ae6a0003740204101271071580001,255,925,-61,-71
71:d0:84:ba:01:c5,00fc0ab151e54d0af8330abbe7f61005,2832,55810,-66,-92
c2:01:19:00:02:7d,e2c56db5dffb48d2b060d0f5a71096e0,40001,19437,-59,-60
fd:cb:70:a9:f4:9b,1f4ae6a0003740204101271071580001,255,925,-61,-62
c2:01:19:00:02:7d,e2c56db5dffb48d2b060d0f5a71096e0,40001,19437,-59,-66
71:d0:84:ba:01:c5,00fc0ab151e54d0af8330abbe7f61005,2832,55810,-66,-89
c2:01:19:00:02:7d,e2c56db5dffb48d2b060d0f5a71096e0,40001,19437,-59,-60
71:d0:84:ba:01:c5,00fc0ab151e54d0af8330abbe7f61005,2832,55810,-66,-92
----------
fd:cb:70:a9:f4:9b,1f4ae6a0003740204101271071580001,255,925,-61,-65
c2:01:19:00:02:7d,e2c56db5dffb48d2b060d0f5a71096e0,40001,19437,-59,-66
c2:01:19:00:02:7d,e2c56db5dffb48d2b060d0f5a71096e0,40001,19437,-59,-62
71:d0:84:ba:01:c5,00fc0ab151e54d0af8330abbe7f61005,2832,55810,-66,-89
fd:cb:70:a9:f4:9b,1f4ae6a0003740204101271071580001,255,925,-61,-62
71:d0:84:ba:01:c5,00fc0ab151e54d0af8330abbe7f61005,2832,55810,-66,-88
c2:01:19:00:02:7d,e2c56db5dffb48d2b060d0f5a71096e0,40001,19437,-59,-62
c2:01:19:00:02:7d,e2c56db5dffb48d2b060d0f5a71096e0,40001,19437,-59,-62
fd:cb:70:a9:f4:9b,1f4ae6a0003740204101271071580001,255,925,-61,-61
c2:01:19:00:02:7d,e2c56db5dffb48d2b060d0f5a71096e0,40001,19437,-59,-66
----------
71:d0:84:ba:01:c5,00fc0ab151e54d0af8330abbe7f61005,2832,55810,-66,-92
c2:01:19:00:02:7d,e2c56db5dffb48d2b060d0f5a71096e0,40001,19437,-59,-62
71:d0:84:ba:01:c5,00fc0ab151e54d0af8330abbe7f61005,2832,55810,-66,-87
fd:cb:70:a9:f4:9b,1f4ae6a0003740204101271071580001,255,925,-61,-71
71:d0:84:ba:01:c5,00fc0ab151e54d0af8330abbe7f61005,2832,55810,-66,-87
c2:01:19:00:02:7d,e2c56db5dffb48d2b060d0f5a71096e0,40001,19437,-59,-62
71:d0:84:ba:01:c5,00fc0ab151e54d0af8330abbe7f61005,2832,55810,-66,-87
71:d0:84:ba:01:c5,00fc0ab151e54d0af8330abbe7f61005,2832,55810,-66,-87
71:d0:84:ba:01:c5,00fc0ab151e54d0af8330abbe7f61005,2832,55810,-66,-87
c2:01:19:00:02:7d,e2c56db5dffb48d2b060d0f5a71096e0,40001,19437,-59,-62

 

참고 자료

+ RASPBERRY PI 블루투스 설정  http://blog.moramcnt.com/?p=1427

 

 

 

 

 

 

 

 

반응형

더욱 좋은 정보를 제공하겠습니다.~ ^^