Is there any implementation or library that I can use to calculate the SNR (Signal noise ratio) of a wifi signal on a linux machine which is connected via an ad-hoc network?
I guess you can include <linux/wireless.h> and see what ioctl() returns on a SIOCGIWSPY.
The struct iw_quality will contain some of the information you are looking for: http://www.cs.fsu.edu/~baker/devices/lxr/http/source/linux/include/linux/wireless.h?v=2.6.11.8#L504
This is what iwlist does internally.
You can use iwlist command like this:
iwlist scan
It will produce some output like this:
wlan0 Scan completed :
Cell 01 - Address: XX:XX:XX:XX:XX:XX
Channel:11
Frequency:2.462 GHz (Channel 11)
Quality=59/70 Signal level=-51 dBm
Encryption key:on
...
May be you are interested in the reported "Quality".
Related
I am trying to obtain the wifi rssi results at a very high rate and using the following command:
while true
do
date -Ins
/sbin/iw dev wlp3s0 station dump | grep signal
done
Question: I wanted to understand how to read the output.
Does signal simply display the strongest signal and the signal from two antennas ?
Does the second line simply give a running average? Please advise.
2019-04-08T12:09:23,618290169-07:00
signal: -49 [-49, -53] dBm
signal avg: -48 [-48, -52] dBm
2019-04-08T12:09:23,619857247-07:00
signal: -49 [-49, -53] dBm
signal avg: -48 [-48, -52] dBm
Could someone please take a look at the question. I am essentially trying to understand if the signal parameters displayed correspond to the two antennas. I searched all existing documentation including the source code of the IW utility, there is nothing conclusive that I am able to see to confirm my observation.
iw dev wlp3s0 station dump returns the statistics about the connected devices.
The question does not provide the full printout, but it looks like you are getting the signal quality for 2 separate connected devices, and nothing about antennas. There should be a line Station <mac address>, which should tell you which connected device the stats are for.
I have a raspberry pi, a WLAN stick (Ralink Technology, Corp. RT5370) in monitor mode and tcpdump (+tshark) installed.
Now I want to read link layer packages from a WLAN wristband device that patients in a retirement home use. This device sends link layer data every second in order to be detected by access points using fingerprinting. The content of this packages is not important, only the RSSI values and the MAC of the device is needed.
With my rPi now I wants to detect when a patient is neat to its own flat door in order to open it automatically. For this, the Pi needs to receives this LLC packages so that I can use the associated RSSI value to calculate the distance.
Using Wireshark and Windows (Airpcap) I can read these LLC packages without problems. The output is for example:
35748 152.953461000 00:00:00_00:00:00 57:01:ff:00:00:00 LLC 62 I, N(R)=0, N(S)=0; DSAP NULL LSAP Individual, SSAP 0x1e Command
If I do the same thing on raspbian using tcpdump or tshark, I don't receive data at all.
tcpdump (command is sudo tcpdump llc -i wlan1) returns
tcpdump: 'llc' supported only on raw ATM
Looks like my linux/driver is not able to pass link layer data to tcpdump. How can I enable it?
Thank you for any hint
UPDATE
Thanks to Guy Harris I found a solution
sudo tcpdump -e -i wlan1 type data
returns all LLC packages and the -e value adds all types of mac. Output is something like this where TA is the MAC of the device. I parsed it using python line by line to get the data I needed
02:56:21.346146 11.0 Mb/s 2462 MHz 11b -53dB signal antenna 1 RA:01:40:96:00:00:03 (oui Unknown) TA:00:18:8e:40:62:03 (oui Unknown) DA:00:00:00:00:00:00 (oui Ethernet) SA:00:00:00:00:00:00 (oui Ethernet) LLC, dsap Null (0x00) Individual, ssap OSI (0xfe) Response, ctrl 0x0b: Unnumbered, 0b, Flags [Response], length 24
BR
Stefan
tcpdump: 'llc' supported only on raw ATM
First of all, the filter comes after all the command-line flags, including -i, so, if you're going to be capturing on wlan1 with a filter, what you want is
sudo tcpdump -i wlan1 {filter}
That's how tcpdump works - the filter comes after all the command-line flags and the arguments to those flags, including -i, -r, etc.
Second of all, "llc" means something very specific - from the "pcap-filter" man page (with older versions of libpcap and tcpdump, it's in the tcpdump man page, but the filter expressions aren't understood by tcpdump, they're understood by libpcap, the library tcpdump uses to capture and to read capture files):
llc True if the packet is an ATM packet, for SunATM on Solaris, and
is an LLC-encapsulated packet.
On 802.11, all 802.11 data frames have an 802.2 LLC header, so you want
tcpdump -i wlan1 type data
which will filter out management and control frames (which don't have 802.2 LLC headers).
When I run:
iwconfig wlan0 | grep -i quality
on my Raspberry Pi, with a wifi card installed, it reports back to me with:
Link Quality=99/100 Signal level=48/100 Noise level=0/100
How can I get iwconfig or some other network tool to report the signal level back to me in dBm instead of an arbitrary fraction?
It's a matter of the Network Interface Card or of the relatives Drivers.
To workaround you can use this simple formula I to do the conversion.
dbm=(fraction_of_total/2)-100
Of course is an approximation and results may vary from chipset to chipset but is how I solved.
You can alternatively find the correct Drivers if you know the wifi card is capable RSSI sampling. But that's usually not easy.
I'd like to modify LIRC to output non-modulated signal (without 36-39 kHz modulation). I'm looking at irsend.c, but fail to see the hardware control code. It must have been somewhere in lirc main files. Any hints?
In my case the solution was already in the driver. The modified driver for raspberry pi (lirc_rpi) takes a few parameters, among them softcarrier.
So if you do:
sudo modprobe lirc_rpi softcarrier=0
the carrier wave will be eliminated.
I have a Dell Latitude E6410, which uses an Intel Ultimate N-6300 Wireless card. iwconfig does not show the Noise level of the wireless interface , wlan0. Does anyone know the reason for that?
precise#ubuntu:~/Desktop/Work/transmitter$ iwconfig
lo no wireless extensions.
mon0 IEEE 802.11abgn Mode:Monitor Tx-Power=15 dBm
Retry long limit:7 RTS thr:off Fragment thr:off
Power Management:off
wlan0 IEEE 802.11abgn ESSID:"AirPennNet"
Mode:Managed Frequency:2.412 GHz Access Point: D8:C7:C8:D7:A6:C1
Bit Rate=130 Mb/s Tx-Power=15 dBm
Retry long limit:7 RTS thr:off Fragment thr:off
Power Management:on
Link Quality=65/70 Signal level=-45 dBm
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:800 Invalid misc:540 Missed beacon:0
eth0 no wireless extensions.
I tried to use cat /proc/net/wireless and got these results
Inter-| sta-| Quality | Discarded packets | Missed | WE
face | tus | link level noise | nwid crypt frag retry misc | beacon | 22
wlan0: 0000 64. -46. -256 0 0 0 818 566 0
Is -256 the noise level? How do i interpret this in dBm?
The answer lies within your driver and wireless card support.
I have a similar Dell Latitude model but with an Intel(R) Centrino(R) Advanced-N 6200 AGN wireless card. After issuing the iwconfig command, the output also revealed something similar - the Noise parameter was missing (this was done while in connection to an access point, of course).
Not happy with that, I got out another wireless card (Winstron NeWeb AR9170+AR9104 802.11abgn - basically a Proxim Wireless 802.11a/b/g/n Wi-Fi USB dongle) and issued the same command. The output was still the same, the Noise parameter was not there!
This wasn't what I had expected since I knew very well that we had used the same Wi-Fi dongle to detect the noise level associated with access points using a proprietary software by Fluke Network called the AirMagnet WiFi Analyzer PRO. I even tried downloading and re-compiling the Linux Wireless Tools package from Jean Tourrilhes' but similar output was shown as before.
The next step I did was to verify again that the WiFi dongle actually does show the WiFi noise levels under the AirMagnet WiFi Analyzer software. Sure enough, it does (as depicted in the attached image below).
The blue column with the header 'N' refers to the noise level. Mind you, the WiFi dongle also came along with a proprietary driver when we bought the AirMagnet software along with it.
Having done that, I decided to see what it would show for our internal WiFi card (Intel(R) Centrino(R) Advanced-N 6200 AGN). Here are the results:
All of them are displaying values of -100! So, I believe it all has something to do with the driver/card capabilities.