13627105546 opened a new pull request, #17867: URL: https://github.com/apache/nuttx/pull/17867
*Note: Please adhere to [Contributing Guidelines](https://github.com/apache/nuttx/blob/master/CONTRIBUTING.md).* ## Summary This PR refactors the Wi-Fi implementation for the simulator (`arch/sim`) to support different Wi-Fi backends and introduces a new simulated Wi-Fi mode based on BSS files. The changes include: 1. **Refactoring**: Renamed `arch/sim/src/sim/sim_wifidriver.c` to `arch/sim/src/sim/sim_wifihost.c` and introduced `arch/sim/src/sim/sim_wifihost.h`. This separates the logic that maps NuttX Wi-Fi operations to the host OS (Host Mode) from the generic simulation network driver. 2. **New Feature (Pseudo Mode)**: Added support for a "Pseudo" Wi-Fi simulation mode (`CONFIG_SIM_WIFIDEV_PSEUDO`). This mode uses the `drivers/net/wifi_sim.c` driver to simulate Wi-Fi operations (scanning, connecting) based on a configured BSS file, without relying on the host machine's physical Wi-Fi adapter. 3. **Configuration**: Added a Kconfig choice in `arch/sim/Kconfig` to select between: * `CONFIG_SIM_WIFIDEV_HOST`: Use the host's real Wi-Fi devices (legacy behavior). * `CONFIG_SIM_WIFIDEV_PSEUDO`: Use the simulated Wi-Fi devices based on the bss file. ## Impact * **Users**: Users of the NuttX simulator can now test the Wi-Fi stack and applications without needing a physical Wi-Fi interface on the host machine or root privileges to access it. * **Build**: Adds new Kconfig options for the simulator. No impact on other architectures. * **Compatibility**: Backward compatible. The default behavior can be configured to match the previous implementation (Host Mode). ## Testing Verified on Ubuntu 22.04 LTS (Host) with the `sim:wifi` configuration. 1. **Build Verification**: * Configured with `tools/configure.sh sim:wifi`. * Selected `CONFIG_SIM_WIFIDEV_PSEUDO` in `make menuconfig`. * Built successfully with `make`. 2. **Runtime Verification**: * Ran the simulator: `./nuttx`. * Verified network device initialization in NSH. * Tested Wi-Fi commands (e.g., `ifconfig`, `wapi`) to ensure the simulated driver responds correctly. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
