libs/iwinfo: return bitrate in kilobits to properly handle .5 rates
[project/luci.git] / libs / iwinfo / src / iwinfo_wl.c
index 8387b9f..8519dbc 100644 (file)
@@ -139,7 +139,7 @@ int wl_get_bitrate(const char *ifname, int *buf)
        int rate = 0;
 
        if( !(ret = wl_ioctl(ifname, WLC_GET_RATE, &rate, sizeof(rate))) && (rate > 0))
-               *buf = rate / 2;
+               *buf = ((rate / 2) * 1000) + ((rate & 1) ? 500 : 0);
 
        return ret;
 }