Wi-Fi control

The WLAN service (wpa_pps) listens for commands on the /pps/services/wifi/control object. If we want to observe responses from the wpa_pps service, we need to force the shell to keep the file descriptor open (because this is a server object). In the following example, we use the exec command to do this, then direct the response messages to stderr. After this, we send a wnet_new command to set up a new profile:

(exec 3<>/pps/services/wifi/control && cat >&3 && cat <&3)<<END
msg::wnet_new
id::123
dat:json:{"ssid":"wifi_test","key_mgmt":"NONE"}
END

The control object might now look like this:

@control
res::wnet_new
id::123
dat::3

We can now use the netID returned in the dat attribute (i.e., 3) in further commands, such as wnet_select:

(exec 3<>/pps/services/wifi/control && cat >&3 && cat <&3)<<END
msg::wnet_select
id::124
dat::3
END

For a full description of the contents of this object, see the entry for /pps/services/wifi/control in the PPS Objects Reference.