Re: [PATCH] Fix for Blueman modem being ignored
- From: Nick Peskett <networkmanager peskett co uk>
- To: Aleksander Morgado <aleksander lanedo com>
- Cc: networkmanager-list gnome org
- Subject: Re: [PATCH] Fix for Blueman modem being ignored
- Date: Tue, 23 Oct 2012 11:15:55 +0100
On 23/10/2012 10:33, Aleksander Morgado wrote:
Currently when a modem device registered by Blueman is connected,
NetworkManager reports that there is no associated bluetooth device.
The if statement responsible for this ought to be reporting an error and
returning if the driver is named, but not named "bluetooth".
Unfortunately, the true result of strcmp(), zero, has been flipped,
meaning only the device name "bluetooth" isn't acceptable as a bluetooth
device.
The solution to this was found by Andrew Guskoff, he describes it here;
https://bbs.archlinux.org/viewtopic.php?id=147880
I picked it up from the Ubuntu/ Arch Linux bug report;
https://bugs.launchpad.net/ubuntu/+source/network-manager/+bug/583728
This fixes the problem for me with NetworkManager 0.9.4 (Ubuntu 12.04)
and a Nokia N900 phone, Andrew (obviously) and another user who reported
trying it on the log.
I've attached a patch I created against a checkout from the
NetworkManager git repository.
The current logic in the code is the proper one as far as I can tell.
The logic goes like:
(1) A new modem is notified to NM.
(2) NM tries to match the new modem with the current list of NMDeviceBt
objects. The NMDeviceBt associated with the new modem should grab the modem:
/* 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))
return;
}
}
(3) If no bluetooth device (NMDeviceBt) grabbed the modem, and the
modem comes from a bluetooth device (it reports a "bluetooth" driver),
then we ignore it:
/* 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);
return;
}
(4) Otherwise, we pick the modem as if it was a non-bluetooth device.
/* Make the new modem device */
device = nm_device_modem_new (modem, driver);
if (device)
add_device (self, device);
So the thing here is to see why the bluetooth device didn't grab the
modem. Forcing the modem to be treated as a non-bluetooth device is not
really the fix.
Have to say, I currently have the same issue when trying Bluetooth DUN
devices. In my case it's because noone creates bluetooth-specific
settings in NetworkManager, but I'm assuming it's because of some
missing implementation in gnome-control-center (I'm using GNOME3 here).
Is this also your case? Or are you using the network-manager-applet?
Ah, I see. Thanks for the explanation.
The device was added using the Blueman applet (1.23) that comes with
Xubuntu 12.04. I said Ubuntu earlier, but forgot this was my netbook.
This applet is the only way to connect DUN, nothing appears in the
NetworkManager applet until the patch is applied and the DUN has been
connected.
I take it that while adding the unclaimed device as-is has worked for
the people who've had the problem so far, it might cause problems if a
some sort of non-modem device got through to this point.
If this is the case could memcmp(ip_iface, "rfcomm", 6) also be added to
the condition? This might allow generic unclaimed bluetooth modems to
still work.
Cheers,
Nick
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]