Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Networking > Linux - Wireless Networking
User Name
Linux - Wireless Networking This forum is for the discussion of wireless networking in Linux.


  Search this Thread
Old 12-19-2008, 11:13 AM   #1
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

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
b = a - 0x100 (= a - 16^2)
here is the part of code in iwcommon.c:

/********************** STATISTICS SUBROUTINES **********************/

 * Output the link statistics, taking care of formating
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) */
		  "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)" : "");
	  /* Statistics are relative values (0 -> max) */
		  "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)" : "");
      /* 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!!!


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 08:45 PM
iwconfig and Noise level adonis1 Linux - Software 0 05-03-2005 03:34 PM
interpreting iwconfig output: signal strength, etc ahz10 Linux - Wireless Networking 1 04-11-2005 06:55 PM
/proc/net/wireless missing after kernel recompile Outabux Debian 1 07-05-2004 03:16 PM
/proc/net/wireless MarkusMan Linux - Wireless Networking 2 01-26-2004 09:56 PM > Forums > Linux Forums > Linux - Networking > Linux - Wireless Networking

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

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