Search This Blog

Monday, May 31, 2010

Solid ModemManager backend

Hi there, after two days of hard working now we have a real ModemManager backend for solid. The first patches I created implement MM support too tied to GsmNetworkInterface class, which means you had to instantiate a NetworkManager class to use ModemManager, that is not necessary anymore. The bad news is that the translate team has a couple of .desktop files to translate besides the source code.

This night was long, I spent several hours trying to fix a difficult to trace bug. I inspected the program and it should work but somehow the kded module crashed when instantiating a ModemGsmNetworkInterface class, in fact it instantiated the class but when it tried to use one of its methods the program crashed. The problem was that ModemGsmNetworkInterface inherited from ModemInterface and declared a d_ptr pointer, which it should not, only ModemInterface class should declare d_ptr. That problem fixed I found an infinite loop in the program hehe, that was easy to fix. After that I had to fight with the signal and slots strings to make them match. If you see a lot of "No such slot" (or signal) messages in ~/.xsession-errors you know what I am talking about. This time I saw other messages too, like "incompatible signal and slot types" (because of full nested namespace names in some places but not in other) and "impossible to connect" (because the slot's object was null). After some try and error rounds I fixed that too and finally my Plasma NM is working again. Only one bug remains: when removing the modem from USB port the kded module crashes because the ModemGsmNetworkinterface object becomes invalid and the program does not detect that. I will fix that next weekend, now I need rest and I also have other work to do during the week. Keeping this pace I think I can finish the patch by the end of the month.

Monday, May 24, 2010

Plasma NM: more updates

My first MM implementation to solid added the MM dbus interface to GsmNetworkInterface class, MM can run independently from NM, then it is more logical to implement solid MM as a separated backend, that is what I started to do last Saturday. Well, the work is much more complex than I have thought. I spent the whole Saturday reorganizing the code, creating new files, and eliminating some namespaces. The solid interface is ready (I think), now I need to reorganize the NM backend and make everything work again. If the first implementation was an old car I may say I am pimping my code hehe, I completely dismantled the code, now I am reassembling everything together with a nice look. Probably tomorrow I will try to finish the backend.

Last Friday I did some experiments with using html-like tables to implement interface details using a single Plasma::Label, that simplifies the code and, most important, reduces memory usage. I almost succeed, the result is this:

Another advantage of using html tables is that now we can select which detail to show per interface type. In the current implementation the entries Operator, Signal Quality and Access Technology are only shown for Gsm connections. Monolithic Knm uses a similar code to showing tooltips for the interfaces. One other thing Knm does is let the user select which detail and in which order to present them, that is more flexible than what I have implemented so far. I plan to port that code to Plasma NM in the future as more I progress in MM implementation the more information will be added to interface details, so it would be good to select which detail I want to see. One more thing to the TODO list.

Sometimes I get very stubborn to finish one thing. If you look at the screenshot above you can see the access technology and signal quality beside the connection name at the right side of Plasma NM. I thought I could do that in a couple of hours at most, what naive of me. Yesterday morning I started to dig the code finding how Plasma NM does that for wireless connections. Man, it looks like a labirint, only today morning I finally have got everything working, well almost everything, there are some edges to polish. What took me so much time was the fact the wireless component gets the signal strength througth org.kded.networkmanagement (a kded module), so I had to implemented one interface for org.kded.networkmanagement too, more precisely org.kded.networkmanagement.GsmInterfaceConnection. The implementation adds 13 new files to the source code :-/ and charnges several other files. Well, at least now I can see the signal quality and access technology without having to open the interface details window :-) Yes!!!

Thursday, May 20, 2010

Solid, ModemManager and Plasma Applet

I talked to Sebas yesterday and we finally got plasma applet running on my notebook. I have discontinued my patch for monolithic knm and today I have finished to port my changes to plasma applet, here is the result:

I removed the "Access Technology" combox from my old patch because I need to find a better place to add it. I have also fixed some bugs in plasma applet since yesterday:

  • in my notebook the window did not resize to accomodate the traffic graph when I clicked on interface details, now it does.
  • the mac address were only shown for wired and wireless connections, now it works for any kind of connections which have MAC address (ppp0 for instance does not have).
  • if someone selects "Show more" and plasma-desktop closes (crash or restart), next time plasma-desktop run (without logging out), it would show all wireless AP around, which is not the initial state for the widget on the right side. The initial state shows manually added or activated connections only. Now it works as expected if plasma-desktop restarts.

I plan to add separated tabs for each connection type (wired, wireless, gsm, etc), like monolithic knm does. In plasma applet there is only one details tab, which is filled with connection information as needed. If some information is not relevant (operator name for wired connection for instance) or is not available it will take space in the details window and cause plasma applet's window size to increase unnecessarily.

Another thing I want to implement is notifications. Monolithic knm already have notifications working, but it seems plasma applet does not implement them.

Monday, May 17, 2010

Solid and ModemManager (update)

This weekend I added some more info in the Mobile Broadband tab in knm:

The * indicates the current configuration and the line below it shows the actual access technology used. As you can see my operator has no 3G network here where I live. Other two operators have 3G here, I used to use of them but since they limit my speed to 128 kbps after 1 GB of data I switched to my current operator, which also limits me after 1 GB, but in 200 kbps and the bill is about $14 cheaper. "Unlimited" plans are very common here in Brazil, so I can download everything I want at 200 kbps maximum for about $33.50 (expensive but I do not have better alternatives). Usually the speed is around 100 kbps, it only reaches 230-240 kbps (modem maximum in 2G mode) after midnight (vampiristic 2G I may say hehe). The other configurations are:

I have also updated the patches and documentation in both and

Before someone from usability team criticises the screenshot above, I only did that to test my changes in solid. Knm already has some code that allowed me to add my test code so I did it. That screen will get much more ugly until I finish my changes in solid, after that I plan to move some things (like the preference technology combo box above) to a better place.

As some people asked me, my changes to solid can be used in networkmanagement plasma applet too or any oher KDE program. I hope to finish my patch to solid by Akademy date since I am going to Akademy this year.

Friday, May 14, 2010

Solid and ModemManager

Hi all,

This is my first post on planetkde. For those who do not know me, I live in Brazil (Minas Gerais state), I am also member of KDE-MG and use KDE since 1997. Although I have been using KDE (now KDE SC) for so long it was only last year I started to contribute more to KDE SC bug fixing and source code.

Last month, during Akademy-br, I started to work on implementing some features in knetworkmanager (knm). I use 3G Internet on traveling and miss some things, such as signal quality indicator (3G here in Brazil can be very unstable), statistics about speed, round-trip time (ping), and a way to force knm to use only HSDPA. Of course those things must be implemented in NetworkManager, or more recently in ModemManager, so that knm can make use of them. Some of those features are already implemented in ModemManager but to use them in knm solid, our hardware independent layer, must support them too.

I have implemented the first part of ModemManager support in solid and have some things working (signal quality indicator and network operator name to name the most important ones). The patch for solid and knm are in

Adds preliminary ModemManager support to solid
Adds support to show signal quality and cellular operator name in tooltip.

For those who like screenshots, here they are:

Well, the operator " 31"  (there is a space before the 31 number) is right according to my 3G modem (Sony MD300), I have checked it using the chat command. The wierd thing is that I can scan for all networks around and only my operator has this wierd name. My cell phone picks the correct name tough (TIM MG 37).

Today I have finished to implement dbus interfaces org.freedesktop.ModemManager and org.freedesktop.ModemManager.Modem.Gsm.Network, there are several other to implement according to the specification. I think the work will be done to be included in KDE SC 4.6.0 next year, so wish me luck :-)