Since my previous message, I have learned that another way to provide a PIN to a device is to create a pincodes file here (where 00.11.22.33.44.55 is the address of the bluetooth adapter): /var/lib/bluetooth/00:11:22:33:44:55/pincodes with a line for each device specifying the device address and PIN code to use, eg 00:22:33:44:55:66 0000
when this file exists, passkey-agent is not necessary. Does anyone know how to use a pincodes file and avoid specifying the device address, and use the same PIN for all devices? On Thu, Oct 29, 2009 at 10:25 AM, Dan Brown <[email protected]> wrote: > problem: > There is currently no program included with bluez-utils which can > provide a PIN code to a bluetooth device. This is an issue for devices > like a "handsfree" mic/speaker combination that have limited input and > display capabilities. (Although it is NOT an issue for cell phone type > devices that have keypads and screens.) > > system: > 8.09.1, version for brcm 2.4, with bluez-utils v. 3.36 and its > dependencies installed > > symptom: > when attempting to pair a device with OpenWRT, syslog shows this: > Oct 29 09:18:31 hostname daemon.info hcid[833]: link_key_request > (sba=00:11:22:33:44:55, dba=00:22:33:44:55:66) > Oct 29 09:18:31 hostname daemon.info hcid[833]: pin_code_request > (sba=00:11:22:33:44:55, dba=00:22:33:44:55:66) > which means that the device is requesting a PIN code from OpenWRT, but > OpenWRT does not respond properly. > > proposed solution: > enable the creation of bluez-util package's passkey-agent program, > whose source code is part of the standard bluez-util package's test > tools. The installation of this program was disabled by florian (cc'd > on this thread) in May 2008 (see > https://dev.openwrt.org/changeset/11222/packages/utils/bluez-utils/Makefile). > There are two notes about enabling passkey-agent: > 1) passkey-agent.c needs to be patched to make the if-else blocks > explicitly marked with {} characters. without this patch, it does not > send the appropriate information to register itself as a passkey agent > with hcid, and syslog fills up with messages like this one: > Oct 29 08:58:09 <host> daemon.err hcid[<pid>]: register_passkey_agent > called without any adapter info! > 2) the bluez-utils package Makefile needs to be patched to enable the > compilation of passkey-agent. However, I wasn't able to figure out how > to enable ONLY passkey-agent, and not the entire suite of test tools. > So I manually specified the programs to install, based on the previous > behavior with the addition of passkey-agent. The passkey-agent program > is approximately 9kb. > > alternate solution: > for systems that are able to install and run python, the pyagent > program can be installed and provide a similar PIN code service over > dbus. See https://forum.openwrt.org/viewtopic.php?id=20580 > > test: > I tested these patches on my own system, as described above. I was > able to pair with a device. The entry in syslog that indicated success > was this: > Oct 29 09:40:21 <host> daemon.info hcid[<pid>]: Default passkey agent > (:1.1, /org/bluez/passkey_agent_<pid>) registered > > > Signed-off-by: Dan Brown <[email protected]> > > 2 patches follow: > -------------------------------------------------- > --- a/test/passkey-agent.c > +++ b/test/passkey-agent.c > @@ -223,12 +223,13 @@ > return -1; > } > > - if (use_default) > + if (use_default) { > dbus_message_append_args(msg, DBUS_TYPE_STRING, &agent_path, > DBUS_TYPE_INVALID); > - else > + } else { > dbus_message_append_args(msg, DBUS_TYPE_STRING, &agent_path, > DBUS_TYPE_STRING, &address, DBUS_TYPE_INVALID); > + } > > dbus_error_init(&err); > > -------------------------------------------------- > --- Makefile > +++ Makefile > @@ -41,6 +41,7 @@ > --enable-network \ > --enable-usb \ > --enable-input \ > + --enable-test \ > --disable-audio \ > --with-bluez="$(STAGING_DIR)/usr/include" \ > --with-usb=yes \ > @@ -58,9 +59,16 @@ > > define Package/bluez-utils/install > $(INSTALL_DIR) $(1)/usr/bin > - $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/bin/ > + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ciptool $(1)/usr/bin/ > + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/hcitool $(1)/usr/bin/ > + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/l2ping $(1)/usr/bin/ > + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/rfcomm $(1)/usr/bin/ > + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/sdptool $(1)/usr/bin/ > $(INSTALL_DIR) $(1)/usr/sbin > - $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/* $(1)/usr/sbin/ > + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/hciattach $(1)/usr/sbin/ > + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/hciconfig $(1)/usr/sbin/ > + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/hcid $(1)/usr/sbin/ > + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/../test/passkey-agent $(1)/usr/sbin/ > $(INSTALL_DIR) $(1)/etc/bluetooth > $(CP) $(PKG_INSTALL_DIR)/../hcid/hcid.conf $(1)/etc/bluetooth/ > $(CP) $(PKG_INSTALL_DIR)/../rfcomm/rfcomm.conf $(1)/etc/bluetooth/ > -------------------------------------------------- > _______________________________________________ openwrt-devel mailing list [email protected] https://lists.openwrt.org/mailman/listinfo/openwrt-devel
