Wednesday, 7 August 2013

C - ioctl wlan operstate, link quality, and tx/rx status

C - ioctl wlan operstate, link quality, and tx/rx status

I borrowed from this gentleman in order to request the signal strength of
a wireless connection on my device. I would also like to use ioctl to get
the operstate and whether or not there's up/down stream information
flowing over the connection.
Basically, I'm attempting to modernize the look of this device, adding to
it real-time status icons of link operability, quality, and activity.
Originally, I was using popen() to cat and parse /proc/net/wireless and
/sys/class/net/wlan0/operstate. The only issue was that occasionally that
would fail (I assume because the OS had locked the file) so it was causing
crashes.
So, my questions are two:
One, can I use ioctl in a way similar to the one described in the link
above to monitor the operstate and connection activity? The information I
could find pertaining to this was only for ifreq, not iwreq.
Two, it occurred to me while writing this that I should probably just have
the kernel telling my application when the status of the wireless device
changes, shouldn't I? I can't imagine various desktops' system trays have
polling loops in them.
Actual Two: is there a way to have the kernel feed information into my
application about operstate, link quality, and link activity in real-time?
Thank you in advance. =)

No comments:

Post a Comment