linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Larry Finger <Larry.Finger@lwfinger.net>
To: Ivan Kuten <ivan.kuten@promwad.com>
Cc: "eugene.sobol" <eugene.sobol@promwad.com>,
	linux-wireless@vger.kernel.org, hintak.leung@gmail.com
Subject: Re: rtl8187 diversity
Date: Wed, 08 Apr 2009 16:07:08 -0500	[thread overview]
Message-ID: <49DD11FC.6090506@lwfinger.net> (raw)
In-Reply-To: <1e0576e9ab550ccec84402b8b0805633@promwad.com>

Ivan Kuten wrote:
> 
> Hello Larry, thanks for comments! Surely Eugene will fix patch issues and 
> resubmit patch inline. Actually in its current stage this patch just show
> an 
> diversity idea and will be cleaned-up for submission with Signed-off-by.
> Currently the question was about correctness of calculation of signal
> quality
> and making decision when switching between antennas should be done. Anyway
> it will be easier to say about this when patch will be inline.
> 
> Btw, USB_DEVICE is already added: http://lkml.org/lkml/2008/11/17/39

I think there is a logic error in the following:

+void sw_antenna_diversity_timer_callback(struct rtl8187_priv *priv)
+{
+    static int tick_without_switch = 0;
+    static int old_value = 0;
+    int average = 0;
+    int i;
+    for ( i = 0; i < VAL_ARRAY_SIZE; ++i)
+    {
+        average += priv->ant_diversity.agc_array[i];
+    }
+    average /= VAL_ARRAY_SIZE;
+    average /= 10; // cut 1 chipher
+    printk("%d->%d\n", old_value, average);
+
+    int sub = average - old_value;
+    if (sub < 0)
+        sub *= -1;
+    if (average > old_value)
+    {
+        priv->ant_diversity.switch_to ^= 1;
+        queue_delayed_work(priv->hw->workqueue, &priv->antenna_work,
+                                    msecs_to_jiffies(ANTENNA_SWITCH_TIMER_PERIOD));
+    }
+    old_value = average;

The AGC value is inversely proportional to the signal strength. I think you need
to select the antenna with the smaller, not the larger, value for the average.

Larry


  reply	other threads:[~2009-04-08 21:07 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-08 12:30 rtl8187 diversity eugene.sobol
2009-04-08 18:04 ` Larry Finger
2009-04-08 19:43   ` Ivan Kuten
2009-04-08 21:07     ` Larry Finger [this message]
2009-04-08 23:36   ` Hin-Tak Leung
  -- strict thread matches above, loose matches on Subject: below --
2009-04-22 16:53 Eugene Sobol
2009-04-22 19:35 ` Larry Finger
2009-04-22 23:28 ` Hin-Tak Leung
2009-03-30 12:38 Ivan Kuten
2009-03-30 19:08 ` Hin-Tak Leung
2009-03-31  9:35   ` Ivan Kuten
2009-03-31 22:26     ` Hin-Tak Leung

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=49DD11FC.6090506@lwfinger.net \
    --to=larry.finger@lwfinger.net \
    --cc=eugene.sobol@promwad.com \
    --cc=hintak.leung@gmail.com \
    --cc=ivan.kuten@promwad.com \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).