So what about 3G on sholes?

So a lot of people are probably wondering why I haven't updated in awhile. I actually am hoping to start updating this blog more often but with shorter blog posts in order to try and keep up with all of the crazy stuff I'm up to lately!

Well I'll get right into it!

Sholes 3G

So my main focus right now has been trying to fix the sholes 3G bug. I have recently modified some of the NetworkStateTracker code and submitted it to the Cyanogen Gerrit for review.

So what does this fix do? Well essentially it's laid out below:

     public void addDefaultRoute() {
         if (mInterfaceName != null) {
             if (DBG) {
                 Log.d(TAG, "addDefaultRoute for " + mNetworkInfo.getTypeName() +
                         " (" + mInterfaceName + "), GatewayAddr=" + mDefaultGatewayAddr +
                         ", CachedGatewayAddr=" + mCachedGatewayAddr);
             if (mDefaultGatewayAddr != 0) {
+                NetworkUtils.addHostRoute(mInterfaceName, mDefaultGatewayAddr);
                 NetworkUtils.setDefaultRoute(mInterfaceName, mDefaultGatewayAddr);
             } else if (mCachedGatewayAddr != 0) {
                  * We don't have a default gateway set, so check if we have one cached due to
                  * a previous suspension.  If we do, then restore that one
-                NetworkUtils.setDefaultRoute(mInterfaceName, mCachedGatewayAddr);
+                if (DBG) {
+                    Log.d(TAG, "addDefaultRoute: no default gateway, attempting to use cached gateway");
+                }
+                int r1 = NetworkUtils.addHostRoute(mInterfaceName, mCachedGatewayAddr);
+                int r2 = NetworkUtils.setDefaultRoute(mInterfaceName, mCachedGatewayAddr);
+                if (r1 < 0 || r2 < 0) {
+                    // something went wrong... restart the network
+                    if (DBG) {
+                        Log.d(TAG, "addDefaultRoute: something went terribly wrong... restart the network");
+                    }
+                    teardown();
+                    reconnect();
+                }
              * Clear our cached value regardless of which of the above two situations
              * were hit.
             mCachedGatewayAddr = 0;
-            NetworkUtils.addHostRoute(mInterfaceName, mDefaultGatewayAddr);
-            NetworkUtils.setDefaultRoute(mInterfaceName, mDefaultGatewayAddr);
     public void removeDefaultRoute() {
         if (mInterfaceName != null) {
             if (DBG) {
                 Log.d(TAG, "removeDefaultRoute for " + mNetworkInfo.getTypeName() + " (" +
                         mInterfaceName + ")");

There's a few things happening there. First, we make sure that the settings for the original default route are where they're supposed to be. After the merger of 2.3.4, apparently an extra addHostRoute as well as an addDefaultRoute were appended to the end of the method, so we fix that.

Secondly, we set up a fallback which calls teardown() and reconnect() in the event of a cached route restore failing. This isn't necessarily the most elegant way to fix this, but from what I can tell, Motorola's RIL is attempting to handle routing on its own, so without an updated RIL for sholes, we may be stuck with this solution.

On another note, it was brought to my attention recently that we were actually building for sholes as if it were a GSM device, so that's been modified to reflect that it is actually CDMA, though I haven't noticed any difference.

The good news? In my testing I haven't seen any data connectivity problems anymore yet, but that's just me, so we'll hope for the best.

Wrap-up and a look of things to come!

As mentioned above, I hope to start doing more blog posts but to make them shorter so as to more easily keep up with all of the things I will be doing over the summer months! Here's a brief list of topics I intend to cover coming up as well as what I'm presently working on:

  • More work on sholes! Including:
    • modifying/verifying the 3g fix
    • fixing some camera issues
    • fixing some video issues
    • bluetooth audio fixes
    • rewriting audio library (applies to CM4DX)
  • More work on CM4DX (mostly contingent on first finishing the audio library)
  • Nook Color fun!
  • Some fun personal projects including:
    • TicTanDroid - a dumb tic-tac-toe game I made years ago that i'm porting to android for the lulz
    • Legends Framework - a game framework designed to be open and extensible for the creation of games similar to the traditional Legend of Zelda-style games.
    • Legends of Volexia - a game based on the Legends Framework designed for android
  • Anything else that happens to pop into my mind!

I'll talk to you next time! If any of the above topics sound the most interesting to you, mention it in the comments and I'll take that into consideration for my next write-up!


Sholes 3g has a potential fix, waiting on more extensive testing via the nightlies.

Blog posts will be shorter and more succinct in their topics from now on. Read above for a list of topics I'll be covering in upcoming posts.


blog/2011-05-25/sholes_3g_and_other_topics.txt · Last modified: 2014/05/13 12:36 (external edit)

Hosted on Microsoft Azure Powered by PHP Driven by DokuWiki RSS Feed

© 2011 Austen Dicken |