[packages] upx: update to 3.08
[packages.git] / net / wavemon / patches / 000-upstream-negative.patch
1 From: Gerrit Renker <gerrit@erg.abdn.ac.uk>
2 Date: Sat, 12 Mar 2011 19:00:32 +0000 (+0100)
3 Subject: Info screen: fix a bug in the random level code
4 X-Git-Url: http://eden-feed.erg.abdn.ac.uk/cgi-bin/gitweb.cgi?p=wavemon.git;a=commitdiff_plain;h=cc8235c4b4ab30898fd60f3ad71b7899cf1bdd66
5
6 Info screen: fix a bug in the random level code
7
8 The link quality was not converted back correctly, causing negative
9 values, which then overran the maximum value.
10 ---
11
12 diff --git a/iw_if.c b/iw_if.c
13 index ae5950a..2008c14 100644
14 --- a/iw_if.c
15 +++ b/iw_if.c
16 @@ -369,7 +369,6 @@ static int rand_wave(float *rlvl, float *step, float *rlvl_next, float range)
17  static void iw_getstat_random(struct iw_stat *iw)
18  {
19         static float rnd_sig, snext, sstep = 1.0, rnd_noise, nnext, nstep = 1.0;
20 -       uint8_t smin = dbm_to_u8(conf.sig_min), smax = dbm_to_u8(conf.sig_max);
21  
22         rand_wave(&rnd_sig, &sstep, &snext, conf.sig_max - conf.sig_min);
23         rand_wave(&rnd_noise, &nstep, &nnext, conf.noise_max - conf.noise_min);
24 @@ -377,11 +376,12 @@ static void iw_getstat_random(struct iw_stat *iw)
25         if (iw->range.max_qual.qual == 0)
26                 iw->range.max_qual.qual = WAVE_RAND_QUAL_MAX;
27  
28 -       iw->stat.qual.level     = smin + rnd_sig;
29 -       iw->stat.qual.noise     = dbm_to_u8(conf.noise_min) + rnd_noise;
30 -       iw->stat.qual.qual      = map_range(iw->stat.qual.level, smin, smax,
31 -                                           0, iw->range.max_qual.qual);
32 +       iw->stat.qual.level     = dbm_to_u8(conf.sig_min + rnd_sig);
33 +       iw->stat.qual.noise     = dbm_to_u8(conf.noise_min + rnd_noise);
34         iw->stat.qual.updated   = IW_QUAL_DBM;
35 +       iw->stat.qual.qual      = map_range(conf.sig_min + rnd_sig,
36 +                                           conf.sig_min, conf.sig_max,
37 +                                           0, iw->range.max_qual.qual);
38  }
39  
40  static void iw_getstat_real(struct iw_statistics *stat)