[Babel-users] Odp: Bebel for hamradio frequency

Waldek sp2ong at wp.pl
Tue Jun 9 06:13:37 UTC 2015


Hi,

Sorry for my last email where was used HTML mode to send and I hop now is clear without HTML
 
I have attached below list of frequency and channels from openwrt

 
iwinfo mesh0 freq
  2.407 GHz (Channel unknown)
  2.412 GHz (Channel 1)
  2.417 GHz (Channel 2)
  2.422 GHz (Channel 3)
  2.427 GHz (Channel 4)
  2.432 GHz (Channel 5)
  2.437 GHz (Channel 6)
  2.442 GHz (Channel 7)
  2.447 GHz (Channel 8)
  2.452 GHz (Channel 9)
  2.457 GHz (Channel 10)
  2.462 GHz (Channel 11)
  2.467 GHz (Channel 12)
  2.472 GHz (Channel 13)
  2.484 GHz (Channel 14) [restricted]
  2.312 GHz (Channel 237)
  2.317 GHz (Channel 238)
  2.322 GHz (Channel 239)
  2.327 GHz (Channel 240)
  2.332 GHz (Channel 241)
  2.337 GHz (Channel 242)
  2.342 GHz (Channel 243)
  2.347 GHz (Channel 244)
  2.352 GHz (Channel 245)
  2.357 GHz (Channel 246)
* 2.362 GHz (Channel 247)
  2.367 GHz (Channel 248)
  2.372 GHz (Channel 249)
  2.377 GHz (Channel 250)
  2.382 GHz (Channel 251)
  2.387 GHz (Channel 252)
  2.392 GHz (Channel 253)
  2.397 GHz (Channel 254)
  2.402 GHz (Channel 255)

#iwinfo
mesh0     ESSID: "Hamradio"
          Access Point: A2:84:B4:B8:94:D2
          Mode: Ad-Hoc  Channel: 247 (2.362 GHz)
          Tx-Power: 28 dBm  Link Quality: 20/70
          Signal: -90 dBm  Noise: -112 dBm
          Bit Rate: 36.0 MBit/s
          Encryption: unknown
          Type: nl80211  HW Mode(s): 802.11bgn
          Hardware: 168C:002A 0777:E012 [Ubiquiti NanoStation M2]
          TX power offset: 10 dB
          Frequency offset: none
          Supports VAPs: yes  PHY name: phy0

interface.c
===============

check_interface_channel(struct interface *ifp)
{
    int channel = IF_CONF(ifp, channel);

    if(channel == IF_CHANNEL_UNKNOWN) {
        if((ifp->flags & IF_WIRED)) {
            channel = IF_CHANNEL_NONINTERFERING;
        } else {
            channel = kernel_interface_channel(ifp->name, ifp->ifindex);
            if(channel < 0)
                fprintf(stderr,
                        "Couldn't determine channel of interface %s: %s.\n",
                        ifp->name, strerror(errno));
            if(channel <= 0)
                channel = IF_CHANNEL_INTERFERING;
        }
    }

    if(ifp->channel != channel) {
        ifp->channel = channel;
        return 1;
    }
    return 0;
}

----------------------------------------------------

configuration.c
================

           if(strcmp(t, "noninterfering") == 0)
                if_conf->channel = IF_CHANNEL_NONINTERFERING;
            else if(strcmp(t, "interfering") == 0)
                if_conf->channel = IF_CHANNEL_INTERFERING;
            else {
                if_conf->channel = strtol(t, &end, 0);
                if(*end != '\0')
                    goto error;
            }

            free(t);

            if((if_conf->channel < 1 || if_conf->channel > 255) &&
               if_conf->channel != IF_CHANNEL_NONINTERFERING)
                goto error;

-------------------------------------------------------------------

kernel_netlink.c
================

static int
freq_to_chan(struct iw_freq *freq)
{
    int m = freq->m, e = freq->e;

    /* If exponent is 0, assume the channel is encoded directly in m. */
    if(e == 0 && m > 0 && m < 254)
        return m;

    if(e <= 6) {
        int mega, step, c, i;

        /* This encodes 1 MHz */
        mega = 1000000;
        for(i = 0; i < e; i++)
            mega /= 10;

        /* Channels 1 through 13 are 5 MHz apart, with channel 1 at 2412. */
        step = 5 * mega;
        c = 1 + (m - 2412 * mega + step / 2) / step;
        if(c >= 1 && c <= 13)
            return c;

        /* Channel 14 is at 2484 MHz  */
        if(c >= 14 && m < 2484 * mega + step / 2)
            return 14;

        /* 802.11a channel 36 is at 5180 MHz */
        c = 36 + (m - 5180 * mega + step / 2) / step;
        if(c >= 34 && c <= 165)
            return c;
    }
--------------------------------------------------------------------------






More information about the Babel-users mailing list