Tethering needs support from both Bluedevil and Plasma NM, and they must cooperate to a certain degree to register the connection in NetworkManager. After some research and some answers from the NetworkManager's guys we finally got the information we needed. Most of the needed code went to Plasma NM and Solid, the Bluedevil part was already almost done.
To keep the story short here is the screenshot of a tethering connection in Plasma NM:
Things to notice:
- I am using a bluetooth icon for the network interface, which is logical since NetworkManager identifies it as bluetooth. The only problem is that it can get mixed up with the Bluedevil icon in systray. Maybe someone can create a different icon, volunteers? ;-)
- The "Unknown" word in connection name refers to the unknown access technology used. It seems ModemManager is not able to get that information, I will try to figure out if there is another way to get that. Update: ModemManager works with bluetooth devices, the problem is that Plasma NM assumed that ModemManager's objects always existed when there was a NetworkManager object associated to it, which is not true for bluetooth devices. Bluetooth devices always have a NetworkManager object associated to them but the ModemManager object only exists if the org.bluez.Serial.Connect method has been called. The consequence is that Plasma NM is not notified (via Qt's signals) when there is a change in the bluetooth's ModemManager object properties. I will try to fix that in the future. Update2: problem fixed :-)
Here some other things to notice:
- System Name works for a serial (ppp) connection! :-) This was an old bug in Plasma NM, the usual NM method to get the interface name returns the serial device (/dev/ttyACM0, /dev/ttyUSB0, etc). The traffic graph also did not work for the same reason. I added a hack to force Plasma NM to always use ppp0 as interface name for all serial devices (Dial-up modem, Gsm/Cdma phones, Bluetooth). Well, now I do not need the hack because NM-0.8.2 can give me that information. Unfortunately the support for that is going to be available only in KDE SC 4.7.0.
- For the same reason access technology is not reported, neither are the operator's name and the signal quality. The "Enable" status also comes from ModemManager, if there is no way to get those information I will remove them from interface details in the future. Update: problem source detected, just need some time to fix it. Update2: problem fixed :-)
- Yes, mobile broadband in Brazil can be very slow in some places, actually in most cities, even in some neighborhoods in big cities. There are places where it is indeed fast, usually in big cities and some fortunate cities, that is not my case :-/ Here where I live I can get a little above 260 kbps in 3G (220 kbps in 2G) at best for a 300 kbps plan. I do not even bother to get get a faster plan because most operator's networks cannot keep up to the speed and the ones which do are expensive enough to make them not viable :-/
What is still missing:
- Cdma phones's bluetooth support (in both Solid and Plasma NM).
- PAN (bluetooth's Personal Area Network) support for both Gsm and Cdma phones. Those two is going to take time since my phone is not compatible with Cdma nor PAN. Update: PAN implemented for Gsm phones :-) Actually the service that the phone must support is NAP (Network Access Point) and not PAN. Or PAN always comes with NAP, I am not sure.
- Without the bluetooth patch to Solid's NetworkManager backend that is going to be in 4.7.0 Plasma NM will recognise bluetooth interfaces as gsm. The consequence is that Plasma NM mixes Gsm and Bluetooth connections but NM refuses to use pure Gsm connections with Bluetooth interfaces. With the patch in place Plasma NM can distinguish between Gsm and Bluetooth connections. For instance, I have registered one Bluetooth and one Gsm connection in Plasma NM, but only the Bluetooth one is shown in the screenshots above.
- Update: Another consequence is that no gsm connection detail (operator's name, signal quality, access technology) is available without the Solid's patch.
- No, for now there is no way to use the same registered connection with the same phone connected through USB and Bluetooth. You have to create one connection to be used when the phone is connected through USB and another connection when the phone is connected through Bluetooth.
- When the bluetooth controller is active and there is a bluetooth connection registered the bluetooth interface is always shown, even when phone's bluetooth is disabled. That is the way NM works.
- Some lines of code in Bluedevil to call Plasma NM to register a bluetooth connection when a bluetooth device has just been paired.
- More testing.
For the braves who wants to try the Solid patch:
- Get the patch against 4.6.2 here: http://git.reviewboard.kde.org/r/101172
- Recompile kdelibs and kde-workspace. Recompiling kdelibs is needed because of the ABI changes in Solid. I had some crashes in kded4 until I recompile kdelibs.
- Recompile Plasma NM:
- git clone git://anongit.kde.org/netwokmanagement
- mkdir networkmanagement/build
- cd networkmanagement/build
- cmake -DCMAKE_INSTALL_PREFIX=/usr ..
- make
- make install
Update: Bluedevil 1.2 is going to support launching networkmanagement_configshell to create the bluetooth connection, so you will not need to use any command line. All Plasma NM released since 0.9.0 support bluetooth tethering:
If you still wants to lauch it yourself follow these instructions:
If you still wants to lauch it yourself follow these instructions:
- Execute: $(kde4-config --path exe --locate networkmanagement_configshell) create --type bluetooth --specific-args "00:11:22:33:44:55 dun" . Pay attention to the quotes (") in "00:11:22:33:44:55 dun", they are required.
- Change 00:11:22:33:44:55 to your phone's bluetooth hardware address. You can get it in Bluedevil. Update: Change dun for nap if you want that service.
- In a few seconds Plasma NM's Mobile Connection Wizard window should appear and you can finish registering the connection.
- After that you can go the Plasma NM window and the connection should be there. Just click on it to connect to the Internet.
You can edit/delete the bluetooth connection in Plasma NM even without the Solid's patch.