Skip to content

Bluetooth

블루투스(영어: Bluetooth)는 1994년에 에릭슨이 최초로 개발한 개인 근거리 무선 통신을 위한 산업 표준이다. 1999년 5월 20일에 공식적으로 발표되었다. 블루투스라는 이름은 덴마크의 국왕 헤럴드 블라트란트를 영어식으로 바꾼것이다. 제안을 한 사람은 Jim Kardach인데, 계기는 소설가 프란스 G. 벵 트손의 바이킹이라는 소설과 헤럴드 블라트란트의 관한 역사 소설 'The Long Ships'를 읽고 있어서 제안했다. 헤럴드 블라트란트가 스칸디나비아를 통일한것처럼 무선통신도 블루투스로 통일하자는 의미인 것이다. 1998년에는 'Bluetooth Special Interest Group'이라는 블루투스에 관한 동맹이 결성되면서 에릭슨을 비롯한 인텔, 레노버, 마이크로소프트, 애플, 노키아, 도시바, IBM이 참여하였다. 블루투스는 다양한 기기들이 안전하고 저렴한 비용으로 전 세계적으로 이용할 수 있는 무선 주파수를 이용해 서로 통신할 수 있게 한다. 또한, 블루투스는 IEEE 802.15.1 규격을 사용하는 블루투스는 PANs의 산업 표준중 하나이다. 블루투스는 ISM 대역인 2.45GHz를 사용한다. 버전 1.1과 1.2의 경우 속도가 723.1kbps에 달하며, 버전 2.0의 경우 EDR을 특징으로 하는데, 이를 통해 2.1Mbps의 속도를 낼 수 있다. 블루투스는 유선 USB를 대체하는 개념이며, 와이파이는 이더넷을 대체하는 개념이다. 암호화에는 SAFER을 사용한다. 장치끼리 믿음직한 연결을 성립하려면 키워드를 이용한 페어링이 이루어지는데, 이 과정이 없는 경우도 있다.

Categories

Libraries

Hardwares

Pairing vs Connecting

높은 수준에서 항상 "연결 (Connecting)"을 사용하여 장치에 연결하지만 먼저 장치를 "페어링 (Pairing)"해야 할 수도 있습니다.

블루투스 페어링은 보안 절차입니다. 통신을 암호화할 수 있는 일련의 공유 보안 키와 페어링하여 두 장치를 준비하는 일회성 프로비저닝 단계입니다.

블루투스 저에너지 (Bluetooth Low Energy)장치 는 3가지 보안 수준을 가질 수 있습니다. 가장 낮은 보안 수준은 페어링이 필요하지 않으며 그 다음 2개 수준은 페어링이 필요합니다.

No Pairing을 사용하기로 선택한 장치는 가장 단순하지만 분명히 보안이 없습니다. 통신은 암호화되지 않으며 다른 장치는 연결할 수 있습니다.

사용할 수 있는 두 가지 페어링 방법은 연결 시 동일한 수준의 보안을 제공합니다. 그러나 페어링 절차 자체에서는 두 가지 방법 중 하나가 다른 것보다 더 안전합니다. 패스키 페어링 (Passkey Pairing)은 두 절차 중 가장 안전하며 6자리 숫자를 입력해야 합니다. 이는 machine-in-the-middle(MITM) 공격으로부터 보호합니다. Just Works Pairing은 안전하지 않지만 아무 것도 입력할 필요가 없으므로 사용이 매우 간단합니다.

페어링이 설정되면 매번 페어링을 설정할 필요 없이 연결할 수 있습니다.

페어링 옵션에 대한 자세한 설명은 이 곳에서 확인할 수 있습니다.

Service

다음과 같이 서비스 상태를 확인할 수 있다.

$ service bluetooth status

출력은 다음과 같다:

● bluetooth.service - Bluetooth service
     Loaded: loaded (/lib/systemd/system/bluetooth.service; enabled; vendor preset: enabled)
     Active: active (running) since Thu 2022-07-28 08:42:16 KST; 14min ago
       Docs: man:bluetoothd(8)
   Main PID: 1235 (bluetoothd)
     Status: "Running"
      Tasks: 1 (limit: 18403)
     Memory: 1.8M
     CGroup: /system.slice/bluetooth.service
             └─1235 /usr/lib/bluetooth/bluetoothd

Jul 28 08:42:15 yourname-13UD70P systemd[1]: Starting Bluetooth service...
Jul 28 08:42:15 yourname-13UD70P bluetoothd[1235]: Bluetooth daemon 5.53
Jul 28 08:42:16 yourname-13UD70P systemd[1]: Started Bluetooth service.
Jul 28 08:42:16 yourname-13UD70P bluetoothd[1235]: Starting SDP server
Jul 28 08:42:16 yourname-13UD70P bluetoothd[1235]: Bluetooth management interface 1.21 initialized
Jul 28 08:42:16 yourname-13UD70P bluetoothd[1235]: Failed to set mode: Blocked through rfkill (0x12)
Jul 28 08:42:18 yourname-13UD70P bluetoothd[1235]: Failed to set mode: Blocked through rfkill (0x12)
Jul 28 08:42:27 yourname-13UD70P bluetoothd[1235]: Endpoint registered: sender=:1.106 path=/MediaEndpoint/A2DPSink/sbc
Jul 28 08:42:27 yourname-13UD70P bluetoothd[1235]: Endpoint registered: sender=:1.106 path=/MediaEndpoint/A2DPSource/sbc

또는 systemctl을 사용한다면:

$ systemctl status bluetooth.service
 bluetooth.service - Bluetooth service
     Loaded: loaded (/lib/systemd/system/bluetooth.service; enabled; vendor preset: enabled)
     Active: active (running) since Tue 2022-09-20 08:36:59 KST; 3 days ago
       Docs: man:bluetoothd(8)
   Main PID: 1009 (bluetoothd)
     Status: "Running"
      Tasks: 1 (limit: 18399)
     Memory: 2.8M
     CGroup: /system.slice/bluetooth.service
             └─1009 /usr/lib/bluetooth/bluetoothd

Sep 21 18:32:37 yourname-13UD70P bluetoothd[1009]: bt_uhid_send: Invalid argument (22)
Sep 21 18:32:37 yourname-13UD70P bluetoothd[1009]: bt_uhid_send: Invalid argument (22)
Sep 21 18:32:37 yourname-13UD70P bluetoothd[1009]: bt_uhid_send: Invalid argument (22)
Sep 21 18:38:13 yourname-13UD70P bluetoothd[1009]: Pair device timed out for hci0
Sep 22 15:39:34 yourname-13UD70P bluetoothd[1009]: Failed to set mode: Blocked through rfkill (0x12)
Sep 22 15:42:19 yourname-13UD70P bluetoothd[1009]: Pair device timed out for hci0
Sep 22 15:47:14 yourname-13UD70P bluetoothd[1009]: Unable pair since another pairing is in progress
Sep 22 15:47:39 yourname-13UD70P bluetoothd[1009]: Unable pair since another pairing is in progress
Sep 23 09:30:17 yourname-13UD70P bluetoothd[1009]: Endpoint registered: sender=:1.107 path=/MediaEndpoint/A2DPSink/sbc
Sep 23 09:30:17 yourname-13UD70P bluetoothd[1009]: Endpoint registered: sender=:1.107 path=/MediaEndpoint/A2DPSource/sbc

블루투스 관련 로그 열람

journalctl -u bluetooth.service

블루투스 RAW 데이터 읽는 방법

FAQ

Bluetooth MAC Address는 고유한가?

답변은 아래와 같다.

A Bluetooth MAC is designed to be unique, and is traceable to the chip manufacturer. Todays market is flushed with millions of Chinese chip manufacturers that do no follow FCC restrictions and do have matching MAC.

번역하자면...

블루투스의 MAC은 유니크하게 디자인 되며 칩 제조사를 추적할 수 있다. 하지만(오늘날) 시장의 수많은 중국의 칩 제조사는 더이상 더이상 FCC 제한을 따르지 않는 MAC을 사용한다.

요약하면, 원칙적으로 MAC Address는 고유해야 하지만, 그렇지 못하다.

Ubuntu 에서 블루투스 스피커 연결했는데 소리가 재생되지 않는 경우

Ubuntu#블루투스 스피커 연결했는데 소리가 재생되지 않는 경우 항목을 참조.

Favorite site

References


  1. Bluetooth_background.pdf