[{"content":" Introduction Although the Raspberry Pi 4B has relatively strong performance, its network interface is not excellent, only suitable as a 100Mbps wireless router. Deploying OpenWrt via Docker allows the Raspberry Pi to function as a router while hosting other services. Note: This setup is more about tinkering than practical use, and using Docker for multiple services might cause instability in the wireless soft router.\nPreparations Raspberry Pi SD Card Raspberry Pi os (make sure your Raspberry Pi os is working properly) 1. Enable Ethernet Card Promiscuous Mode $sudo nano /etc/network/interfaces # Modify to (add) the following content # interfaces(5) file used by ifup(8) and ifdown(8) # Include files from /etc/network/interfaces.d: source /etc/network/interfaces.d/* auto eth0 allow-hotplug eth0 iface eth0 inet dhcp up ip link set eth0 promisc on 2. Set Up Wireless Hotspot (AP) Create a hotspot via the graphical interface and set a static IPv4 address to 192.168.0.254.\n3. Install and Configure Docker sudo apt update -y sudo apt install docker.io -y sudo systemctl enable docker sudo systemctl start docker # Add the current user to the Docker user group sudo gpasswd -a $USER docker newgrp docker sudo modprobe veth 4. Create Docker Network docker network create -d macvlan --subnet=192.168.0.0/24 --gateway=192.168.0.253 -o parent=wlan0 macwan docker network create -d macvlan --subnet=x.x.x.x/24 --gateway=x.x.x.x -o parent=eth0 macwan Note: The subnet and gateway for the macwan network must match your router\u0026rsquo;s subnet.\n5. Create Container docker run --restart always --name openwrt -d --network maclan --privileged --ip 192.168.0.1 \u0026#34;registry.cn-shanghai.aliyuncs.com/suling/openwrt:rpi4\u0026#34; /sbin/init The container image address is for the Chinese version of OpenWrt. You can change it to the official openWrt. 6. Modify Docker Network Configuration # Enter the container docker exec -it openwrt /bin/sh # vi /etc/config/network Modify to the following:\nconfig interface \u0026#39;lan\u0026#39; option type \u0026#39;bridge\u0026#39; option ifname \u0026#39;eth0\u0026#39; option proto \u0026#39;static\u0026#39; option ipaddr \u0026#39;192.168.0.1\u0026#39; option netmask \u0026#39;255.255.255.0\u0026#39; option ip6assign \u0026#39;60\u0026#39; After modification, restart the network:\n/etc/init.d/network restart 7. Connect macwan to Container (Host) docker network connect macwan openwrt 8. Access OpenWrt Console Connect another device to the Raspberry Pi AP and enter 192.168.0.1 in the browser to access the OpenWrt console. If you cannot access it, check if your device\u0026rsquo;s IP is in the same subnet as the Raspberry Pi AP. If not, enter it manually.\nAfter accessing, add the WAN network interface:\nSelect the interface to include as eth1.\nSave and apply the changes, and the devices connected to the Raspberry Pi AP should now be online!\n","externalUrl":null,"permalink":"/pages/raspberrypi_docker_wifi/","section":"All Pages","summary":"Introduction Although the Raspberry Pi 4B has relatively strong performance, its network interface is not excellent, only suitable as a 100Mbps wireless router. Deploying OpenWrt via Docker allows the Raspberry Pi to function as a router while hosting other services. Note: This setup is more about tinkering than practical use, and using Docker for multiple services might cause instability in the wireless soft router.\n","title":"Running OpenWrt on Raspberry Pi 4B via Docker for Wireless Routing","type":"pages"},{"content":" Introduction Recently, while working on a project using Qt, I noticed that even after setting the working directory for QProcess, it still couldn’t find the file, resulting in a failed startup. After researching online and reading the official documentation, I gained a clearer understanding of this issue.\nHere’s the summary:\nOn Windows, when the QProcess class searches for an external program, it always looks in the current working directory of the parent process, not the directory set by setWorkingDirectory(). Only when the external program is launched does the parent process switch to the directory specified by setWorkingDirectory(). This behavior differs from Unix systems. Pay close attention to the official documentation. Environment Windows 11 Qt Creator 16.0.0 Qt 6.8.2 (MSVC 2022, x86_64) Preparing the External Program For testing purposes, I prepared a helloworld.exe program. This is a console application that prints \u0026ldquo;helloworld!\u0026rdquo; to the console upon startup and generates a helloworld.txt file in the startup directory (to verify if the working directory takes effect).\nI placed this program in the D: directory to ensure everything was set up correctly:\nIncorrect Usage Here’s the code (I used startDetached() to directly display the output; using start() wouldn’t show the program’s output immediately):\nCopy QObject *parent = nullptr; QProcess *process = new QProcess(parent); // Wrong usage QString program = \u0026#34;helloworld.exe\u0026#34;; QStringList arguments; arguments \u0026lt;\u0026lt; \u0026#34;run\u0026#34;; process-\u0026gt;setWorkingDirectory(\u0026#34;D:/\u0026#34;); // Set working directory process-\u0026gt;startDetached(program, arguments); The arguments parameter here is unnecessary; it’s included to demonstrate potential use cases. When running this code, the Terminal showed no response. This happened because QProcess couldn’t find helloworld.exe in the current project directory, causing the external program to fail to launch.\nCorrect Usage QObject *parent = nullptr; QProcess *process = new QProcess(parent); // Correct usage QString program = \u0026#34;D:/helloworld.exe\u0026#34;; // Specify the program path so QProcess can locate the external program QStringList arguments; arguments \u0026lt;\u0026lt; \u0026#34;run\u0026#34;; process-\u0026gt;setWorkingDirectory(\u0026#34;D:/\u0026#34;); // Set working directory process-\u0026gt;startDetached(program, arguments); Running this code, the Terminal successfully output \u0026ldquo;helloworld!\u0026rdquo;, and helloworld.txt was generated in the D: directory.\nTesting the Effect of the WorkingDirectory Parameter Now, let’s remove the line that sets the working directory:\nQObject *parent = nullptr; QProcess *process = new QProcess(parent); // Correct usage QString program = \u0026#34;D:/helloworld.exe\u0026#34;; // Specify the program path so QProcess can locate the external program QStringList arguments; arguments \u0026lt;\u0026lt; \u0026#34;run\u0026#34;; // process-\u0026gt;setWorkingDirectory(\u0026#34;D:/\u0026#34;); // Set working directory (commented out) process-\u0026gt;startDetached(program, arguments); After running this, the Terminal still successfully output \u0026ldquo;helloworld!\u0026rdquo;, but helloworld.txt was generated in the current project’s running directory.\nConclusion When QProcess runs an external program on Windows using a relative path, it can only start from the current working directory of the parent process. Here’s the explanation from the official documentation:\nThis indicates that the WorkingDirectory parameter does not affect the search for the program during startup. It only comes into play after QProcess locates the application, switching to the specified WorkingDirectory just before launching it.\nIs this behavior unique to Windows? According to the official documentation, yes.\nThat concludes this article. If you spot any issues, please point them out. I welcome any discussion!\n","externalUrl":null,"permalink":"/pages/qt_01/","section":"All Pages","summary":"Introduction Recently, while working on a project using Qt, I noticed that even after setting the working directory for QProcess, it still couldn’t find the file, resulting in a failed startup. After researching online and reading the official documentation, I gained a clearer understanding of this issue.\n","title":"Qt QProcess setWorkingDirectory Not Working on Windows System","type":"pages"},{"content":"","externalUrl":null,"permalink":"/pages/","section":"All Pages","summary":"","title":"All Pages","type":"pages"},{"content":"","externalUrl":null,"permalink":"/tags/c++/","section":"Tags","summary":"","title":"C++","type":"tags"},{"content":"","externalUrl":null,"permalink":"/categories/","section":"Categories","summary":"","title":"Categories","type":"categories"},{"content":"","externalUrl":null,"permalink":"/tags/docker/","section":"Tags","summary":"","title":"Docker","type":"tags"},{"content":" Progress FPGA 10%\nLinux 20%\n","externalUrl":null,"permalink":"/","section":"Homepage","summary":"Progress FPGA 10%\nLinux 20%\n","title":"Homepage","type":"page"},{"content":"","externalUrl":null,"permalink":"/tags/openwrt/","section":"Tags","summary":"","title":"OpenWrt","type":"tags"},{"content":"","externalUrl":null,"permalink":"/tags/qt/","section":"Tags","summary":"","title":"Qt","type":"tags"},{"content":"","externalUrl":null,"permalink":"/tags/raspberry-pi/","section":"Tags","summary":"","title":"Raspberry Pi","type":"tags"},{"content":"","externalUrl":null,"permalink":"/series/","section":"Series","summary":"","title":"Series","type":"series"},{"content":"","externalUrl":null,"permalink":"/tags/","section":"Tags","summary":"","title":"Tags","type":"tags"},{"content":"","externalUrl":null,"permalink":"/tags/tinkering/","section":"Tags","summary":"","title":"Tinkering","type":"tags"},{"content":"","externalUrl":null,"permalink":"/zh-cn/tags/%E6%8A%98%E8%85%BE/","section":"Tags","summary":"","title":"折腾","type":"tags"},{"content":"","externalUrl":null,"permalink":"/zh-cn/tags/%E6%A0%91%E8%8E%93%E6%B4%BE/","section":"Tags","summary":"","title":"树莓派","type":"tags"}]