# we can talk to wpasupplicant with dbus since NetworkManager # seems to not like the socket interface being in use as well # add an interface to control of wpasupplicant dbus-send --system --print-reply --type=method_call --dest=fi.epitest.hostap.WPASupplicant \ /fi/epitest/hostap/WPASupplicant fi.epitest.hostap.WPASupplicant.addInterface string:"wlan0" # check an interface to control of wpasupplicant INT=`dbus-send --system --print-reply=literal --type=method_call \ --dest=fi.epitest.hostap.WPASupplicant \ /fi/epitest/hostap/WPASupplicant fi.epitest.hostap.WPASupplicant.getInterface string:"wlan0"` # tell interface to run a scan dbus-send --system --print-reply=literal --type=method_call \ --dest=fi.epitest.hostap.WPASupplicant ${INT} fi.epitest.hostap.WPASupplicant.Interface.scan # wait for results #dbus-monitor --system # get results of scan - shows BSSID of accesspoints nearby SCAN=(`dbus-send --system --print-reply=literal --type=method_call \ --dest=fi.epitest.hostap.WPASupplicant ${INT} \ fi.epitest.hostap.WPASupplicant.Interface.scanResults`) # interrogate an accesspoint e.g. acde48234567 for N in `seq 2 $(( ${#SCAN[*]} - 2))` do RESULT="`dbus-send --system --print-reply=literal --type=method_call --dest=fi.epitest.hostap.WPASupplicant \ ${SCAN[$N]} fi.epitest.hostap.WPASupplicant.BSSID.properties`" printf %s:%s:%s:%s:%s:%s \ "`echo ${SCAN[$N]} | cut -d"/" -f9-`" \ "`echo "${RESULT}" | grep " ssid" | cut -d'"' -f2`" \ "`echo "${RESULT}" | grep frequency | cut -c54-`" \ "`echo "${RESULT}" | grep capabilities | cut -c58-`" \ "`echo "${RESULT}" | grep noise | cut -c50-`" \ "`echo "${RESULT}" | grep level | cut -c50-`" echo done | sort # remove interface 0 again and wpasupplicant exits when it manages no interfaces #dbus-send --system --print-reply --type=method_call --dest=fi.epitest.hostap.WPASupplicant \ #/fi/epitest/hostap/WPASupplicant fi.epitest.hostap.WPASupplicant.removeInterface objpath:"/fi/epitest/hostap/WPASupplicant/Interfaces/2" #dbus-send --system --print-reply --dest=org.freedesktop.ModemManager \ #/org/freedesktop/ModemManager org.freedesktop.ModemManager.EnumerateDevices #dbus-send --system --print-reply --dest=org.freedesktop.ModemManager \ #/org/freedesktop/ModemManager/Modems/0 \ #org.freedesktop.ModemManager.Modem.Gsm.Network.GetSignalQuality #dbus-send --system --print-reply --dest=org.freedesktop.ModemManager \ #/org/freedesktop/ModemManager/Modems/0 \ #org.freedesktop.ModemManager.Modem.Gsm.Network.GetRegistrationInfo #dbus-send --system --print-reply --dest=org.freedesktop.ModemManager \ #/org/freedesktop/ModemManager/Modems/0 \ #org.freedesktop.DBus.Properties.GetAll string:org.freedesktop.ModemManager.Modem.Gsm.Network