Changeset 9454


Ignore:
Timestamp:
04/29/08 17:30:26 (5 years ago)
Author:
BrainSlayer
Message:

add frequency get function

Location:
src/router/shared
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/router/shared/wl.c

    r9307 r9454  
    331331int 
    332332wifi_getchannel (char *ifname) 
     333{ 
     334  struct iwreq wrq; 
     335  float freq; 
     336  int channel; 
     337  strncpy (wrq.ifr_name, ifname, IFNAMSIZ); 
     338  ioctl (getsocket (), SIOCGIWFREQ, &wrq); 
     339 
     340  int i; 
     341  freq = (float) wrq.u.freq.m; 
     342  for (i = 0; i < wrq.u.freq.e; i++) 
     343    freq *= 10; 
     344  freq /= 1000000; 
     345  cprintf ("wifi channel %f\n", freq); 
     346  channel = ieee80211_mhz2ieee (freq); 
     347 
     348  return channel; 
     349} 
     350 
     351int 
     352wifi_getfreq (char *ifname) 
    333353{ 
    334354  struct iwreq wrq; 
  • src/router/shared/wlutils.h

    r9289 r9454  
    7878u_int ieee80211_mhz2ieee(u_int freq); 
    7979 
     80int wifi_getchannel (char *ifname); 
     81int wifi_getfreq (char *ifname); 
     82 
    8083#endif 
    8184/* 
Note: See TracChangeset for help on using the changeset viewer.