root@Edison:~# configure_edison --wifi Configure Edison: WiFi Connection Scanning: 1 seconds left 0 : Rescan for networks 1 : Exit WiFi Setup 2 : Manually input a hidden SSID 3 : AnotheWiFi01 4 : AnotheWiFi02 5 : AnotheWiFi03 6 : AnotheWiFi04 7 : myWiFi Enter 0 to rescan for networks. Enter 1 to exit. Enter 2 to input a hidden network SSID. Enter a number between 3 to 7 to choose one of the listed network SSIDs: 7 Is myWiFi correct? [Y or N]: Y Password must be between 8 and 63 characters. What is the network password?: *************************************************************** Initiating connection to myWiFi. Please wait... Attempting to enable network access, please check 'wpa_cli status' after a minute to confirm. Done. Please connect your laptop or PC to the same network as this device and go to http://xxx.xxx.xxx.xxx or http://Edison.local in your browser. root@Edison:~#
root@Edison:~# vi /etc/wpa_supplicant/wpa_cli-actions.sh #!/bin/sh # # This script file is passed as parameter to wpa_cli, started as a daemon, # so that the wpa_supplicant events are sent to this script # and actions executed, like : # - start DHCP client when STA is connected. # - stop DHCP client when STA is disconnected. # - start DHCP client when P2P-GC is connected. # - stop DHCP server when P2P-GO is disconnected. # # This script skips events if connmand (connman.service) is started # Indeed, it is considered that the Wifi connection is managed through # connmand and not wpa_cli # IFNAME=$1 CMD=$2 kill_daemon() { NAME=$1 PF=$2 if [ ! -r $PF ]; then return fi PID=`cat $PF` if [ $PID -gt 0 ]; then if ps | grep $NAME | grep $PID; then kill $PID fi fi if [ -r $PF ]; then # file can be removed by the deamon when killed rm $PF fi } echo "event $CMD received from wpa_supplicant" # if Connman is started, ignore wpa_supplicant # STA connection event because the DHCP connection # is triggerd by Connman if [ `systemctl is-active connman` == "active" ] ; then if [ "$CMD" = "CONNECTED" ] || [ "$CMD" = "DISCONNECTED" ] ; then echo "event $CMD ignored because Connman is started" exit 0 fi fi if [ "$CMD" = "CONNECTED" ]; then kill_daemon udhcpc /var/run/udhcpc-$IFNAME.pid #udhcpc -i $IFNAME -p /var/run/udhcpc-$IFNAME.pid -S ifconfig $IFNAMExxx.xxx.xxx.xxxnetmaskzzz.zzz.zzz.zzz route add default gwyyy.yyy.yyy.yyy fi if [ "$CMD" = "DISCONNECTED" ]; then kill_daemon udhcpc /var/run/udhcpc-$IFNAME.pid ifconfig $IFNAME 0.0.0.0 fi if [ "$CMD" = "P2P-GROUP-STARTED" ]; then GIFNAME=$3 if [ "$4" = "GO" ]; then kill_daemon udhcpc /var/run/udhcpc-$GIFNAME.pid ifconfig $GIFNAME xxx.xxx.xxx.xxx up cp /etc/wpa_supplicant/udhcpd-p2p.conf /etc/wpa_supplicant/udhcpd-p2p-itf.conf sed -i "s/INTERFACE/$GIFNAME/" /etc/wpa_supplicant/udhcpd-p2p-itf.conf udhcpd /etc/wpa_supplicant/udhcpd-p2p-itf.conf fi if [ "$4" = "client" ]; then kill_daemon udhcpc /var/run/udhcpc-$GIFNAME.pid kill_daemon udhcpd /var/run/udhcpd-$GIFNAME.pid udhcpc -i $GIFNAME -p /var/run/udhcpc-$GIFNAME.pid fi fi if [ "$CMD" = "P2P-GROUP-REMOVED" ]; then GIFNAME=$3 if [ "$4" = "GO" ]; then kill_daemon udhcpd /var/run/udhcpd-$GIFNAME.pid ifconfig $GIFNAME 0.0.0.0 fi if [ "$4" = "client" ]; then kill_daemon udhcpc /var/run/udhcpc-$GIFNAME.pid ifconfig $GIFNAME 0.0.0.0 fi fi root@Edison:~#
0 件のコメント:
コメントを投稿