Skip to content

Commit

Permalink
Merge pull request #42 from Jinof/patch-1
Browse files Browse the repository at this point in the history
Update duos.md: update auto wifi connect commands.
  • Loading branch information
carbonfix authored Aug 5, 2024
2 parents bd4fc23 + d1b4db1 commit 2818923
Showing 1 changed file with 30 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Milk-V 是 SG2002 芯片的全球授权经销商。您可以直接从我们的

<Image src='/docs/duo/duos/duos-pinout-v1.1.webp' maxWidth='50%' align='center' />


### GPIO 引脚映射

<div className='gpio_style'>
Expand Down Expand Up @@ -292,9 +293,37 @@ wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant.conf
即可连接 WIFI,连接之后可以通过 `ifconfig` 或者 `ip a` 命令查看分配的 IP 地址。

:::tip
如果需要开机自动连网,可以把该命令放到 `/mnt/system/auto.sh` 文件中。
如果需要开机自动连网,可以把以下命令放到 `/mnt/system/auto.sh` 文件中。
:::

```bash
interface="wlan0"
max_attempts=100
attempt=0
log_file="/var/log/auto.sh.log"

# Continuously attempt to detect if the interface exists, up to $max_attempts times
echo "start auot.sh" > "$log_file"
while [ $attempt -lt $max_attempts ]; do
# Check if the wlan0 interface exists
ip link show "$interface" > /dev/null 2>&1
if [ $? -eq 0 ]; then
echo "$(date +'%Y-%m-%d %H:%M:%S') $interface interface exists, starting wpa_supplicant..." >> "$lo
wpa_supplicant -B -i "$interface" -c /etc/wpa_supplicant.conf >> "$log_file"
break # Exit the loop if the interface is found
else
echo "$(date +'%Y-%m-%d %H:%M:%S') $interface interface not found, waiting..." >> "$log_file"
sleep 1 # Wait for 1 second before checking again
attempt=$((attempt + 1)) # Increment the attempt counter
fi
done
# If the maximum number of attempts is reached and the interface still not found, output an error message
if [ $attempt -eq $max_attempts ]; then
echo "$(date +'%Y-%m-%d %H:%M:%S') Interface $interface not found after $max_attempts attempts" >> "$lo
fi
```
### eMMC 版本固件烧录
DuoS eMMC 版本出厂未烧录固件,需要使用 PC 通过 USB 接口烧录。
Expand Down

0 comments on commit 2818923

Please sign in to comment.