...
WPS Hardware Key Press in BPI
Steps handled when the WPS button is pushed from the target BPI board:
1. Listen until the user pushes the WPS button. Thus an interrupt occurs with the event - "code 529 (KEY_WPS_BUTTON), value 1". This is identified from the evtest of gpio pins.
2. Once the button is being pressed, the key press is intimated to OneWifi by the running binary, "/usr/bin/onewifi_component_test_app".
3. The binary, "/usr/bin/onewifi_component_test_app", requires 2 inputs:
One - wps (the event)
Two - 0/1/2 (2G/5G/6G)
By this way, the communication occurs from the hardware key press to the OneWifi and the flow (functionality) executes as normal.
The script is as follows:
modprobe gpio_keys
EVENT_DEVICE="/dev/input/event0" # Confirmed from evtest
VAP_INDEX_2G=0 # Virtual AP index for OneWifi
VAP_INDEX_5G=1 # Virtual AP index for OneWifi
VAP_INDEX_6G=2 # Virtual AP index for OneWifi
LOGFILE="/tmp/wps_trigger.log"
echo "Listening for WPS button press on $EVENT_DEVICE..." | tee -a $LOGFILE
# Read event stream and trigger WPS when KEY_WPS_BUTTON (529) is detected
evtest "$EVENT_DEVICE" | while read line; do
if echo "$line" | grep -q "code 529 (KEY_WPS_BUTTON), value 1"; then
echo "✅ WPS Button Pressed! Triggering OneWifi WPS for 2G, 5G and 6G..." | tee -a $LOGFILE
# Kill any existing interactive session before triggering WPS
pkill -f onewifi_component_test_app
# Run WPS command and log output
echo "Executing: echo 'wps $VAP_INDEX' | /usr/bin/onewifi_component_test_app" | tee -a $LOGFILE
echo "wps $VAP_INDEX_2G" | /usr/bin/onewifi_component_test_app >> $LOGFILE 2>&1
echo "wps $VAP_INDEX_5G" | /usr/bin/onewifi_component_test_app >> $LOGFILE 2>&1
echo "wps $VAP_INDEX_6G" | /usr/bin/onewifi_component_test_app >> $LOGFILE 2>&1
The Hardware key press is handled as a separate utility under broadband-utils repo:
https://github.com/rdkcentral/broadband-utils
In this implementation, Netlink sockets are handling the WPS Key press event and further functionality is carried out by rbus API's which intimates OneWifi to carry out the WPS operation.
The recipe is present under:
meta-cmf-bananapi/meta-rdk-mtk-bpir4/recipes-common/rdk-wps-monitor/rdk-wps-monitor.bb sleep 5 # Prevent multiple triggers within 5 seconds
fi
done