diff --git a/arch/sim/src/sim/sim_wifidriver.c b/arch/sim/src/sim/sim_wifidriver.c index e391e5807c97e..1261d22d5a5e9 100644 --- a/arch/sim/src/sim/sim_wifidriver.c +++ b/arch/sim/src/sim/sim_wifidriver.c @@ -56,7 +56,7 @@ #define HOSTAPD_CTRL_PATH " -p /var/run/simwifi/hostapd " #define HOSTAPD_CLI "/usr/bin/sudo /usr/sbin/hostapd_cli " -#define SIMWIFI_FILE "tools/simwifi/sim_wifi.sh " +#define SIMWIFI_FILE "/usr/bin/sim_wifi.sh " #define WPA_SET_NETWORK(wifidev, fmt, args...) \ set_cmd(wifidev,"set_network %d "fmt, (wifidev)->network_id, ##args) @@ -1360,8 +1360,8 @@ static int wifidriver_set_mode(struct sim_netdev_s *wifidev, /* Start the sta config, including wpa_supplicant and udhcpc. */ ret = host_system(NULL, 0, - "/usr/bin/sudo %s/"SIMWIFI_FILE" start_sta %s", - TOPDIR, wifidev->host_ifname); + "/usr/bin/sudo "SIMWIFI_FILE" start_sta %s", + wifidev->host_ifname); if (ret == 0) { /* Check the network number, if no network, should add new network. @@ -1389,8 +1389,8 @@ static int wifidriver_set_mode(struct sim_netdev_s *wifidev, /* Start the hostapd. */ ret = host_system(NULL, 0, - "/usr/bin/sudo %s/"SIMWIFI_FILE" start_ap %s", - TOPDIR, wifidev->host_ifname); + "/usr/bin/sudo "SIMWIFI_FILE" start_ap %s", + wifidev->host_ifname); break; default: diff --git a/tools/simwifi/sim_wifi.sh b/tools/simwifi/sim_wifi.sh index 4088bbb160788..6162d75a055fe 100755 --- a/tools/simwifi/sim_wifi.sh +++ b/tools/simwifi/sim_wifi.sh @@ -23,6 +23,7 @@ NUTTX_BR_IF="nuttx0" RUN_DIR="/var/run/simwifi" +LINK_DIR="/usr/bin" CUR_DIR="" DBG_LEVEL=1 @@ -509,6 +510,8 @@ init() init_env + ln -s $CUR_DIR/sim_wifi.sh $LINK_DIR/sim_wifi.sh + echo "defwan:$1" > $DEFCONF_FILE [ -n "$1" -a -n "$(ifconfig | grep $1)" ] && start_bridge $1 @@ -527,6 +530,8 @@ clean() recovery_to_init + rm $LINK_DIR/sim_wifi.sh + cur_mode=$(get_var mode $DEFCONF_FILE) [ "$cur_mode" = "hwsim" ] && modprobe -r mac80211_hwsim