[FIX] For wifi connection dropping too easily/often

Search This thread

pdf5

Senior Member
Apr 3, 2011
167
19
london
As far as i know mate, think you need the one with two slashes. ie. /proc/calibration

Think thats how you path correctly.

Let me know if you get it working...

i did all the steps correct and did a reboot ,but seems that calibration file in /proc/calibration didnt change , is that means it is working ?:eek:

can you confirm that ?:confused:
 

Tectas

Senior Member
Jul 26, 2011
3,344
2,942
sorry but one last thing , in my position which better in my images the red or blue ?:confused:

and thats what i understood right ?

thanks in advance

Blue, red won't work, sry that I didn't say it clear enough.

Swyped because PC is under full load or to far away :)
 

Tectas

Senior Member
Jul 26, 2011
3,344
2,942
i did all the steps correct and did a reboot ,but seems that calibration file in /proc/calibration didnt change , is that means it is working ?:eek:

can you confirm that ?:confused:

What means didn't change, are the values the same as inside the script?

Swyped because PC is under full load or to far away :)
 

pdf5

Senior Member
Apr 3, 2011
167
19
london
Blue, red won't work, sry that I didn't say it clear enough.

Swyped because PC is under full load or to far away :)

please dont be sorry , so then how to write the path

What means didn't change, are the values the same as inside the script?

Swyped because PC is under full load or to far away :)

look , the values in the original calibration file in (/proc) didnot change to be like your script in (init.d folder ) as well :)
 
Last edited:

Tectas

Senior Member
Jul 26, 2011
3,344
2,942
please dont be sorry , so then how to write the path



look , the values in the original calibration file in (/proc) didnot change to be like your script in (init.d folder ) as well :)

Paste this:
busybox mount -o remount,rw /proc
as second line into the script.

Swyped because PC is under full load or to far away :)
 
Last edited:
  • Like
Reactions: pdf5

pdf5

Senior Member
Apr 3, 2011
167
19
london

Attachments

  • screenshot-1337378522016.jpg
    screenshot-1337378522016.jpg
    38 KB · Views: 278

Tectas

Senior Member
Jul 26, 2011
3,344
2,942
Close, changed my last post, proc needs to be remounted not system, sry has been a long day.

Swyped because PC is under full load or to far away :)
 
  • Like
Reactions: pdf5

Tectas

Senior Member
Jul 26, 2011
3,344
2,942
so now, should i check something to see if the method works ? :eek:

If the file contains now what it should, no, the only noticeable difference should be that your wifi connection shouldn't drop that fast (at least this is what the op promises).

Swyped because PC is under full load or to far away :)
 
  • Like
Reactions: steelbeans

Marcoevich

Senior Member
Jan 16, 2012
124
8
Looks like a good fix to me. Does it still work? Is it compatible with Fallout v4.4.0? In that case I would be happy to flash this one ;)
 

nikant

Senior Member
Jul 9, 2009
211
36
[PATCH] framework.jar for altering WiFi RSSI values in ICS

/*
* I am not responsible for bricked devices, dead SD cards,
* thermonuclear war, or you getting fired because the alarm app failed. Please
* do some research if you have any concerns before flashing it!
* YOU are choosing to make these modifications, and if
* you point the finger at me for messing up your device, I will laugh at you.
*/


A big thanks to gtg465x, kylon and others in the forum for explaining things in posts. It's their work mostly and not mine.

I'm writing this here just in case someone needs the info..

Since I had a problem with the reception of WiFi signal in a Desire S and I've been searching the forum for many days to find a solution to this that I got no responce I decided to search for the framework.jar file patch that has to be done with the /etc/calibration file change to the value of rssi_offset so that Desire S won't drop the connection so easily. Tried also to contact gtg465x but I guess he's busy.

This was done to ICE_DS 6.5 ROM

The patch goes as this:
(1. I am not a developer (used to code, not in android though)
2. I modified the values only by -10 dBm just for test you can change to -20 if you like
3. feel free to correct my wrongs)



gtg465x describes very nicely here what needs to be done http://xdaforums.com/showthread.php?p=25174730 but this is for GB ROM
Read carefully to edit your /etc/calibration file. In that post it's changed to -20, in my test to -10

but ICE_DS 6.5 is a ICS ROM

and the code in WiFiManager.smali is as follows
(the sections that need to be edited)
Code:
.field private static final MAX_RSSI:I = [COLOR="Red"]-0x37[/COLOR] [COLOR="Blue"]#changed to -0x41[/COLOR]

.field private static final MIN_RSSI:I = [COLOR="red"]-0x64[/COLOR] [COLOR="Blue"]#changed to -0x6e[/COLOR]

Code:
.method public static calculateSignalLevel(II)I
    .registers 9
    .parameter "rssi"
    .parameter "numLevels"

    .prologue
    const/4 v6, 0x5

    const/16 v5,[COLOR="Red"] -0x46[/COLOR] [COLOR="Blue"]#changed to -0x50[/COLOR]

    const/16 v4, [COLOR="red"]-0x50[/COLOR] [COLOR="Blue"]#changed to -0x5a[/COLOR]

    .line 963
    const/4 v1, 0x0

    .line 964
    .local v1, level:I
    const/4 v3, 0x4

    if-eq p1, v3, :cond_b

    if-ne p1, v6, :cond_23

    .line 965
    :cond_b
    if-lt p0, v5, :cond_13

    .line 966
    const/4 v1, 0x3

    .line 974
    :goto_e
    if-ne p1, v6, :cond_12

    add-int/lit8 v1, v1, 0x1

    .line 986
    :cond_12
    :goto_12
    return v1

    .line 967
    :cond_13
    if-ge p0, v5, :cond_19

    if-lt p0, v4, :cond_19

    .line 968
    const/4 v1, 0x2

    goto :goto_e

    .line 969
    :cond_19
    if-ge p0, v4, :cond_21

    const/16 v3, [COLOR="red"]-0x55[/COLOR] [COLOR="Blue"]#changed to -0x5f[/COLOR]

    if-lt p0, v3, :cond_21

    .line 970
    const/4 v1, 0x1

    goto :goto_e

    .line 972
    :cond_21
    const/4 v1, 0x0

    goto :goto_e

    .line 976
    :cond_23
    const/16 v3, [COLOR="red"]-0x64[/COLOR] [COLOR="Blue"]#changed to -0x6e[/COLOR]

    if-gt p0, v3, :cond_29

    .line 977
    const/4 v1, 0x0

    goto :goto_12

    .line 978
    :cond_29
    const/16 v3, [COLOR="red"]-0x37[/COLOR] [COLOR="Blue"]#changed to -0x41[/COLOR]

    if-lt p0, v3, :cond_30

    .line 979
    add-int/lit8 v1, p1, -0x1

    goto :goto_12

    .line 981
    :cond_30
    const/high16 v0, 0x4234

    .line 982
    .local v0, inputRange:F
    add-int/lit8 v3, p1, -0x1

    int-to-float v2, v3

    .line 983
    .local v2, outputRange:F
    add-int/lit8 v3, p0, 0x64

    int-to-float v3, v3

    mul-float/2addr v3, v2

    div-float/2addr v3, v0

    float-to-int v1, v3

    goto :goto_12
.end method


this translates to java as (the original values)
Code:
 public static int calculateSignalLevel(int paramInt1, int paramInt2)
  {
    if ((paramInt2 == 4) || (paramInt2 == 5))
    {
      int i;
      if (paramInt1 >= -70)
        i = 3;
      for (;;)
      {
        if (paramInt2 == 5)
          i++;
        return i;
        if ((paramInt1 < -70) && (paramInt1 >= -80))
          i = 2; else if ((paramInt1 < -80) && (paramInt1 >= -85))
          i = 1; else
          i = 0;
      }
    }
    if (paramInt1 <= -100)
      return 0;
    if (paramInt1 >= -55)
      return paramInt2 - 1;
    return (int)((paramInt2 - 1) * (paramInt1 + 100) / 45.0F);
  }


There is also another section in WiFiManager.smali called calculateSignalLevel(III)I
Code:
.method public static calculateSignalLevel(III)I
    .registers 7
    .parameter "rssi"
    .parameter "numLevels"
    .parameter "frequency"

    .prologue
    const/16 v3, -0x41

    const/16 v2, -0x46

    .line 2027
    const/16 v1, 0x1324

    if-le p2, v1, :cond_22

    .line 2028
    const/4 v0, 0x0

    .line 2029
    .local v0, level:I
    if-lt p0, v3, :cond_12

    .line 2030
    const/4 v0, 0x3

    .line 2038
    :goto_c
    const/4 v1, 0x5

    if-ne p1, v1, :cond_11

    add-int/lit8 v0, v0, 0x1

    .line 2041
    .end local v0           #level:I
    :cond_11
    :goto_11
    return v0

    .line 2031
    .restart local v0       #level:I
    :cond_12
    if-ge p0, v3, :cond_18

    if-lt p0, v2, :cond_18

    .line 2032
    const/4 v0, 0x2

    goto :goto_c

    .line 2033
    :cond_18
    if-ge p0, v2, :cond_20

    const/16 v1, -0x4b

    if-lt p0, v1, :cond_20

    .line 2034
    const/4 v0, 0x1

    goto :goto_c

    .line 2036
    :cond_20
    const/4 v0, 0x0

    goto :goto_c

    .line 2041
    .end local v0           #level:I
    :cond_22
    invoke-static {p0, p1}, Landroid/net/wifi/WifiManager;->calculateSignalLevel(II)I

    move-result v0

    goto :goto_11
.end method

which reads as:

Code:
  public static int calculateSignalLevel(int paramInt1, int paramInt2, int paramInt3)
  {
    if (paramInt3 > 4900)
    {
      int i;
      if (paramInt1 >= -65)
        i = 3;
      for (;;)
      {
        if (paramInt2 == 5)
          i++;
        return i;
        if ((paramInt1 < -65) && (paramInt1 >= -70))
          i = 2; else if ((paramInt1 < -70) && (paramInt1 >= -75))
          i = 1; else
          i = 0;
      }
    }
    return calculateSignalLevel(paramInt1, paramInt2);
  }

but I have the believe (which I may well be wrong) that has to do something about WiMax (if (paramInt3 > 4900)) so I didn't touch that.
 
Last edited:

broucker

Senior Member
Nov 14, 2010
231
12
london
Fellows! is there a wifi fix for 4.0.4 stock (the official dev android for this phone)? got to mention that i've rooted it.
 

Top Liked Posts

  • There are no posts matching your filters.
  • 10
    I don't even have this phone, but I'm tired of hearing you guys complain about your wifi dropping :p. HTC programmed the Desire S to drop wifi connections if the signal falls below -88db. I'm not sure why they did that because -88db is a perfectly usable signal. With this fix, your wifi connection won't drop until the signal falls below -108db.

    You need to be running a custom deodexed ROM to apply this fix.

    Flash through Clockwork Recovery.

    Let me know if it works for you!


    If you appreciate my work, donations of any amount are very much appreciated.
    2
    [PATCH] framework.jar for altering WiFi RSSI values in ICS

    /*
    * I am not responsible for bricked devices, dead SD cards,
    * thermonuclear war, or you getting fired because the alarm app failed. Please
    * do some research if you have any concerns before flashing it!
    * YOU are choosing to make these modifications, and if
    * you point the finger at me for messing up your device, I will laugh at you.
    */


    A big thanks to gtg465x, kylon and others in the forum for explaining things in posts. It's their work mostly and not mine.

    I'm writing this here just in case someone needs the info..

    Since I had a problem with the reception of WiFi signal in a Desire S and I've been searching the forum for many days to find a solution to this that I got no responce I decided to search for the framework.jar file patch that has to be done with the /etc/calibration file change to the value of rssi_offset so that Desire S won't drop the connection so easily. Tried also to contact gtg465x but I guess he's busy.

    This was done to ICE_DS 6.5 ROM

    The patch goes as this:
    (1. I am not a developer (used to code, not in android though)
    2. I modified the values only by -10 dBm just for test you can change to -20 if you like
    3. feel free to correct my wrongs)



    gtg465x describes very nicely here what needs to be done http://xdaforums.com/showthread.php?p=25174730 but this is for GB ROM
    Read carefully to edit your /etc/calibration file. In that post it's changed to -20, in my test to -10

    but ICE_DS 6.5 is a ICS ROM

    and the code in WiFiManager.smali is as follows
    (the sections that need to be edited)
    Code:
    .field private static final MAX_RSSI:I = [COLOR="Red"]-0x37[/COLOR] [COLOR="Blue"]#changed to -0x41[/COLOR]
    
    .field private static final MIN_RSSI:I = [COLOR="red"]-0x64[/COLOR] [COLOR="Blue"]#changed to -0x6e[/COLOR]

    Code:
    .method public static calculateSignalLevel(II)I
        .registers 9
        .parameter "rssi"
        .parameter "numLevels"
    
        .prologue
        const/4 v6, 0x5
    
        const/16 v5,[COLOR="Red"] -0x46[/COLOR] [COLOR="Blue"]#changed to -0x50[/COLOR]
    
        const/16 v4, [COLOR="red"]-0x50[/COLOR] [COLOR="Blue"]#changed to -0x5a[/COLOR]
    
        .line 963
        const/4 v1, 0x0
    
        .line 964
        .local v1, level:I
        const/4 v3, 0x4
    
        if-eq p1, v3, :cond_b
    
        if-ne p1, v6, :cond_23
    
        .line 965
        :cond_b
        if-lt p0, v5, :cond_13
    
        .line 966
        const/4 v1, 0x3
    
        .line 974
        :goto_e
        if-ne p1, v6, :cond_12
    
        add-int/lit8 v1, v1, 0x1
    
        .line 986
        :cond_12
        :goto_12
        return v1
    
        .line 967
        :cond_13
        if-ge p0, v5, :cond_19
    
        if-lt p0, v4, :cond_19
    
        .line 968
        const/4 v1, 0x2
    
        goto :goto_e
    
        .line 969
        :cond_19
        if-ge p0, v4, :cond_21
    
        const/16 v3, [COLOR="red"]-0x55[/COLOR] [COLOR="Blue"]#changed to -0x5f[/COLOR]
    
        if-lt p0, v3, :cond_21
    
        .line 970
        const/4 v1, 0x1
    
        goto :goto_e
    
        .line 972
        :cond_21
        const/4 v1, 0x0
    
        goto :goto_e
    
        .line 976
        :cond_23
        const/16 v3, [COLOR="red"]-0x64[/COLOR] [COLOR="Blue"]#changed to -0x6e[/COLOR]
    
        if-gt p0, v3, :cond_29
    
        .line 977
        const/4 v1, 0x0
    
        goto :goto_12
    
        .line 978
        :cond_29
        const/16 v3, [COLOR="red"]-0x37[/COLOR] [COLOR="Blue"]#changed to -0x41[/COLOR]
    
        if-lt p0, v3, :cond_30
    
        .line 979
        add-int/lit8 v1, p1, -0x1
    
        goto :goto_12
    
        .line 981
        :cond_30
        const/high16 v0, 0x4234
    
        .line 982
        .local v0, inputRange:F
        add-int/lit8 v3, p1, -0x1
    
        int-to-float v2, v3
    
        .line 983
        .local v2, outputRange:F
        add-int/lit8 v3, p0, 0x64
    
        int-to-float v3, v3
    
        mul-float/2addr v3, v2
    
        div-float/2addr v3, v0
    
        float-to-int v1, v3
    
        goto :goto_12
    .end method


    this translates to java as (the original values)
    Code:
     public static int calculateSignalLevel(int paramInt1, int paramInt2)
      {
        if ((paramInt2 == 4) || (paramInt2 == 5))
        {
          int i;
          if (paramInt1 >= -70)
            i = 3;
          for (;;)
          {
            if (paramInt2 == 5)
              i++;
            return i;
            if ((paramInt1 < -70) && (paramInt1 >= -80))
              i = 2; else if ((paramInt1 < -80) && (paramInt1 >= -85))
              i = 1; else
              i = 0;
          }
        }
        if (paramInt1 <= -100)
          return 0;
        if (paramInt1 >= -55)
          return paramInt2 - 1;
        return (int)((paramInt2 - 1) * (paramInt1 + 100) / 45.0F);
      }


    There is also another section in WiFiManager.smali called calculateSignalLevel(III)I
    Code:
    .method public static calculateSignalLevel(III)I
        .registers 7
        .parameter "rssi"
        .parameter "numLevels"
        .parameter "frequency"
    
        .prologue
        const/16 v3, -0x41
    
        const/16 v2, -0x46
    
        .line 2027
        const/16 v1, 0x1324
    
        if-le p2, v1, :cond_22
    
        .line 2028
        const/4 v0, 0x0
    
        .line 2029
        .local v0, level:I
        if-lt p0, v3, :cond_12
    
        .line 2030
        const/4 v0, 0x3
    
        .line 2038
        :goto_c
        const/4 v1, 0x5
    
        if-ne p1, v1, :cond_11
    
        add-int/lit8 v0, v0, 0x1
    
        .line 2041
        .end local v0           #level:I
        :cond_11
        :goto_11
        return v0
    
        .line 2031
        .restart local v0       #level:I
        :cond_12
        if-ge p0, v3, :cond_18
    
        if-lt p0, v2, :cond_18
    
        .line 2032
        const/4 v0, 0x2
    
        goto :goto_c
    
        .line 2033
        :cond_18
        if-ge p0, v2, :cond_20
    
        const/16 v1, -0x4b
    
        if-lt p0, v1, :cond_20
    
        .line 2034
        const/4 v0, 0x1
    
        goto :goto_c
    
        .line 2036
        :cond_20
        const/4 v0, 0x0
    
        goto :goto_c
    
        .line 2041
        .end local v0           #level:I
        :cond_22
        invoke-static {p0, p1}, Landroid/net/wifi/WifiManager;->calculateSignalLevel(II)I
    
        move-result v0
    
        goto :goto_11
    .end method

    which reads as:

    Code:
      public static int calculateSignalLevel(int paramInt1, int paramInt2, int paramInt3)
      {
        if (paramInt3 > 4900)
        {
          int i;
          if (paramInt1 >= -65)
            i = 3;
          for (;;)
          {
            if (paramInt2 == 5)
              i++;
            return i;
            if ((paramInt1 < -65) && (paramInt1 >= -70))
              i = 2; else if ((paramInt1 < -70) && (paramInt1 >= -75))
              i = 1; else
              i = 0;
          }
        }
        return calculateSignalLevel(paramInt1, paramInt2);
      }

    but I have the believe (which I may well be wrong) that has to do something about WiMax (if (paramInt3 > 4900)) so I didn't touch that.
    2
    Ok, checked the file and it's possible but a bit hard using init.rc.
    Another way, download the attached file, extract it, open the extracted file and replace the PATHTOCALIBRATIONFILE with the correct path inclusive filename, afterwards copy it to your /etc/init.d folder and set the correct permissions (r-xr-xr-x or 555 or everyone execute and read), this will write at startup the fitting values to the calibration file.
    2
    Grab Root Browser its free

    Sent from my Desire S using XDA
    1
    Small update... noticed that I didn't set the permissions right on one of the files. May want to grab v2.

    On another note, where is everyone? Dev community for this phone needs to wake up!