Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which API provides wireless networks notifications in linux?

I'd like to fire some callback every time my network card sends new info about the available networks. I don't really mind if I need to poll the information myself either. I just don't want to rely on spawning "iwlist scan last" every second, but that's exactly the information I need (network name + channel + encryption type).

Is there a library that implements a function like that? (or are there some ioctl calls to do that?)

I'm only interested in an ndiswrapper module if that matters.

like image 909
viraptor Avatar asked Jan 26 '26 22:01

viraptor


1 Answers

If NetworkManager is running, it is accessible via its DBUS API -- see the WirelessNetworkAppeared and WirelessNetworkDisappeared events.

Otherwise, you'll have to deal with wext yourself (this is what NM uses underneath), you'd be interested in the IWEVREGISTERED and IWEVEXPIRED events coming over the NETLINK_ROUTE interface.

like image 148
ephemient Avatar answered Jan 28 '26 15:01

ephemient



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!