LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking > Linux - Wireless Networking
User Name
Password
Linux - Wireless Networking This forum is for the discussion of wireless networking in Linux.

Notices



Reply
 
Search this Thread
Old 12-19-2008, 12:13 PM   #1
christyyim
Member
 
Registered: Oct 2008
Location: earth
Distribution: Ubuntu 'Gutsy Gibbon'
Posts: 32

Rep: Reputation: 15
Relationship between the signal level get from iwconfig and /proc/net/wireless?


I now currently working on a project to perform network switching according to the received signal strength. From the manual of iwconfig, the explanation for signal level is

Quote:
Received signal strength (RSSI - how strong the received signal is). May be arbitrary units or dBm, iwconfig uses driver meta information to interpret the raw value given by /proc/net/wireless and display the proper unit or maximum value (using 8 bit arithmetic). In Ad-Hoc mode, this may be undefined and you should use iwspy.
but how they interpret? For example, when the signal strength value(=a)i get from /proc/net/wireless is 202, the signal level(=b) in iwconfig is -54dbm. When i look into the source code of iwcommon.c, i found out that the logic behind is
Code:
b = a - 0x100 (= a - 16^2)
here is the part of code in iwcommon.c:

Code:
/********************** STATISTICS SUBROUTINES **********************/

/*------------------------------------------------------------------*/
/*
 * Output the link statistics, taking care of formating
 */
void
print_stats(FILE *	stream,
	    iwqual *	qual,
	    iwrange *	range,
	    int		has_range)
{
  /* Just do it */
  if(has_range && (qual->level != 0))
    {
      /* If the statistics are in dBm */
      if(qual->level > range->max_qual.level)
	{
	  /* Statistics are in dBm (absolute power measurement) */
	  fprintf(stream,
		  "Quality:%d/%d  Signal level:%d dBm  Noise level:%d dBm%s\n",
		  qual->qual, range->max_qual.qual,
		  qual->level - 0x100, qual->noise - 0x100,
		  (qual->updated & 0x7) ? " (updated)" : "");
	}
      else
	{
	  /* Statistics are relative values (0 -> max) */
	  fprintf(stream,
		  "Quality:%d/%d  Signal level:%d/%d  Noise level:%d/%d%s\n",
		  qual->qual, range->max_qual.qual,
		  qual->level, range->max_qual.level,
		  qual->noise, range->max_qual.noise,
		  (qual->updated & 0x7) ? " (updated)" : "");
	}
    }
  else
    {
      /* We can't read the range, so we don't know... */
      fprintf(stream, "Quality:%d  Signal level:%d  Noise level:%d%s\n",
	      qual->qual, qual->level, qual->noise,
	      (qual->updated & 0x7) ? " (updated)" : "");
    }
}
can anyone please explain to me the logic behind these code? I cannot figure out how they come out with this conversion. Besides that, where the raw value given in /proc/net/wireless come from?

Thanks a lot!!!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Find - battery life, CPU Usage,Wireless Signal Level , Congestion Level md_imranullah Programming 2 05-20-2008 09:45 PM
iwconfig and Noise level adonis1 Linux - Software 0 05-03-2005 04:34 PM
interpreting iwconfig output: signal strength, etc ahz10 Linux - Wireless Networking 1 04-11-2005 07:55 PM
/proc/net/wireless missing after kernel recompile Outabux Debian 1 07-05-2004 04:16 PM
/proc/net/wireless MarkusMan Linux - Wireless Networking 2 01-26-2004 10:56 PM


All times are GMT -5. The time now is 03:14 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration