<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="zh-Hant-TW">
	<id>https://tommy0804.ddns.net/index.php?action=history&amp;feed=atom&amp;title=Bluetooth_keyboard_auto_connect</id>
	<title>Bluetooth keyboard auto connect - 修訂紀錄</title>
	<link rel="self" type="application/atom+xml" href="https://tommy0804.ddns.net/index.php?action=history&amp;feed=atom&amp;title=Bluetooth_keyboard_auto_connect"/>
	<link rel="alternate" type="text/html" href="https://tommy0804.ddns.net/index.php?title=Bluetooth_keyboard_auto_connect&amp;action=history"/>
	<updated>2026-08-21T16:32:37Z</updated>
	<subtitle>本wiki上此頁面的修訂紀錄</subtitle>
	<generator>MediaWiki 1.43.9</generator>
	<entry>
		<id>https://tommy0804.ddns.net/index.php?title=Bluetooth_keyboard_auto_connect&amp;diff=529&amp;oldid=prev</id>
		<title>Tommy：​Refactor: add Category:Projects</title>
		<link rel="alternate" type="text/html" href="https://tommy0804.ddns.net/index.php?title=Bluetooth_keyboard_auto_connect&amp;diff=529&amp;oldid=prev"/>
		<updated>2026-08-21T05:17:45Z</updated>

		<summary type="html">&lt;p&gt;Refactor: add [[Category:Projects]]&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;zh-Hant-TW&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;←上個修訂&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;2026年8月21日 (五) 13:17的版本&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l59&quot;&gt;第59行：&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;第59行：&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;*[https://wiki.archlinux.org/index.php/bluetooth_keyboard Bluetooth keyboard]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;*[https://wiki.archlinux.org/index.php/bluetooth_keyboard Bluetooth keyboard]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;*[http://www.correlatedcontent.com/blog/bluetooth-keyboard-on-the-raspberry-pi/ Bluetooth Keyboard on the Raspberry Pi]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;*[http://www.correlatedcontent.com/blog/bluetooth-keyboard-on-the-raspberry-pi/ Bluetooth Keyboard on the Raspberry Pi]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[Category:Projects]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Tommy</name></author>
	</entry>
	<entry>
		<id>https://tommy0804.ddns.net/index.php?title=Bluetooth_keyboard_auto_connect&amp;diff=90&amp;oldid=prev</id>
		<title>Tommy：​已建立頁面，內容為 &quot;== Find keyboard &amp; device MAC == &lt;pre&gt; #hcitool scan Scanning ...     23:E4:87:4C:B3:A1       Wireless Keyboard  # hcitool dev Devices:    hci0   06:05:04:03:02:01 &lt;…&quot;</title>
		<link rel="alternate" type="text/html" href="https://tommy0804.ddns.net/index.php?title=Bluetooth_keyboard_auto_connect&amp;diff=90&amp;oldid=prev"/>
		<updated>2018-08-23T02:34:07Z</updated>

		<summary type="html">&lt;p&gt;已建立頁面，內容為 &amp;quot;== Find keyboard &amp;amp; device MAC == &amp;lt;pre&amp;gt; #hcitool scan Scanning ...     23:E4:87:4C:B3:A1       Wireless Keyboard  # hcitool dev Devices:    hci0   06:05:04:03:02:01 &amp;lt;…&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新頁面&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== Find keyboard &amp;amp; device MAC ==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#hcitool scan&lt;br /&gt;
Scanning ...&lt;br /&gt;
    23:E4:87:4C:B3:A1       Wireless Keyboard&lt;br /&gt;
&lt;br /&gt;
# hcitool dev&lt;br /&gt;
Devices:&lt;br /&gt;
   hci0   06:05:04:03:02:01&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Paring ==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#bluez-simple-agent hci0 23:E4:87:4C:B3:A1&lt;br /&gt;
&lt;br /&gt;
If everything goes well, you will be prompted to type a passkey with your keyboard:&lt;br /&gt;
DisplayPasskey (/org/bluez/14656/hci0/dev_23_E4_87_4C_B3_A1, 936319)&lt;br /&gt;
Your passkey is the number at the end of the line. Don’t forget to press ‘Enter’ after typing the passcode! Now your device is paired with the Raspberry Pi.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Trusting &amp;amp; Connecting ==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
The final stage is making sure that the raspberry will automatically connect to the keyboard when it is turned on. This is called ‘trusting’ and is invoked by this command:&lt;br /&gt;
#bluez-test-device trusted 23:E4:87:4C:B3:A1 yes&lt;br /&gt;
&lt;br /&gt;
After trusing it, all you need to do is connect to it:&lt;br /&gt;
#bluez-test-input connect 23:E4:87:4C:B3:A1 yes&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Automative connecting with systemd ==&lt;br /&gt;
==== /etc/btkbd.conf ====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Config file for btkbd.service&lt;br /&gt;
# change when required (e.g. keyboard hardware changes, more hci devices are connected)&lt;br /&gt;
BTKBDMAC = 6C:5D:63:22:0B:05&lt;br /&gt;
HCIDEVICE = 00:1A:7D:DA:71:13&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== /etc/systemd/system/btkbd.service ====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description=systemd Unit to automatically start a Bluetooth keyboard&lt;br /&gt;
Documentation=https://wiki.archlinux.org/index.php/Bluetooth_Keyboard&lt;br /&gt;
Requires=dbus-org.bluez.service&lt;br /&gt;
After=dbus-bluez.org.service&lt;br /&gt;
ConditionPathExists=/etc/btkbd.conf&lt;br /&gt;
ConditionPathExists=/usr/bin/hcitool&lt;br /&gt;
ConditionPathExists=/usr/sbin/hciconfig&lt;br /&gt;
&lt;br /&gt;
[Service]&lt;br /&gt;
Type=oneshot&lt;br /&gt;
EnvironmentFile=/etc/btkbd.conf&lt;br /&gt;
ExecStart=-/usr/sbin/hciconfig ${HCIDEVICE} up&lt;br /&gt;
# ignore errors on connect, spurious problems with bt? so start next command with -&lt;br /&gt;
ExecStart=-/usr/bin/hcitool cc ${BTKBDMAC}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== reference ==&lt;br /&gt;
*[https://wiki.archlinux.org/index.php/bluetooth_keyboard Bluetooth keyboard]&lt;br /&gt;
*[http://www.correlatedcontent.com/blog/bluetooth-keyboard-on-the-raspberry-pi/ Bluetooth Keyboard on the Raspberry Pi]&lt;/div&gt;</summary>
		<author><name>Tommy</name></author>
	</entry>
</feed>