You are not logged in.

#1 2012-08-29 03:30:34

Registered: 2009-08-03
Posts: 146

Blueman DUN + NetworkManager — SOLVED!

I do not know where to post what I have discovered, so let it be here.

People using GPRS or 3G Bluetooth modems, including me, already know that since 2011, NetworkManager does not work well with Blueman.
The common problem is the modem device being registered by Blueman + ModemManager, but not showing up in NetworkManager`s main menu.
So today I decided to try and correct this bug myself.

Let`s take a look at NetworkManager`s internals.
Shut it down and relaunch it with --no-daemon and --log-level=DEBUG options.
Now try to connect the modem via Blueman. Choose it from the device list and select «Dial-Up Networking» (DUN) from the context menu.
We see a pop-up message saying that our modem has been registered, and we can actually connect to it in NetworkManager.
However, we open the menu and see no new devices added. Why?

Well, it`s time to look at NM`s logs:

NetworkManager[7532]: <info> ignoring modem 'rfcomm0' (no associated Bluetooth device)

To understand what happened, we are to see what function tells us that everything is bad.
Here it is:

static void
modem_added (NMModemManager *modem_manager,
			 NMModem *modem,
			 const char *driver,
			 gpointer user_data)
	NMManager *self = NM_MANAGER (user_data);
	NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (self);
	NMDevice *replace_device, *device = NULL;
	const char *ip_iface;
	GSList *iter;

	ip_iface = nm_modem_get_iface (modem);

	replace_device = find_device_by_ip_iface (NM_MANAGER (user_data), ip_iface);
	if (replace_device) {
		priv->devices = remove_one_device (NM_MANAGER (user_data),

	/* Give Bluetooth DUN devices first chance to claim the modem */
	for (iter = priv->devices; iter; iter = g_slist_next (iter)) {
		if (nm_device_get_device_type (iter->data) == NM_DEVICE_TYPE_BT) {
			if (nm_device_bt_modem_added (NM_DEVICE_BT (iter->data), modem, driver))

	/* If it was a Bluetooth modem and no bluetooth device claimed it, ignore
	 * it.  The rfcomm port (and thus the modem) gets created automatically
	 * by the Bluetooth code during the connection process.
	if (driver && !strcmp(driver, "bluetooth")) {
		nm_log_info (LOGD_MB, "ignoring modem '%s' (no associated Bluetooth device)", ip_iface);

	/* Make the new modem device */
	device = nm_device_modem_new (modem, driver);
	if (device)
		add_device (self, device);

And now, the most interesting part!
Let`s look closer at IF statement:

	if (driver && !strcmp(driver, "bluetooth")) {
		nm_log_info (LOGD_MB, "ignoring modem '%s' (no associated Bluetooth device)", ip_iface);

so, it evaluates to true when driver string is not empty, and EQUALS «bluetooth» (in case of equal strings, strcmp() always returns zero), while apparently it should not.

Hence that, the bug is resolved by just removing ! before strcmp() call, and recompiling NetworkManager.

Thank you for your attention.
Hope this fix will make it to the next release of NM smile


Board footer

Powered by FluxBB