Search Linux Wireless

Re: rtl8187 diversity

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux