POE 设置 IP
POE 设置 IP
请确保正确设置掩码和网关!如果设置不正确,您将软砖化您的设备(将无法访问它),并且必须恢复出厂设置您的 OAK PoE。
我们建议使用设备管理器,这是一个用于与引导加载程序及其配置交互的 GUI 工具。
演示
Command Line
1Found device with name: 192.168.1.136
2 -------------------------------------
3 "1" to set a static IPv4 address
4 "2" to set a dynamic IPv4 address
5 "3" to clear the config
6 1
7 -------------------------------------
8 Enter IPv4: 192.168.1.200
9 Enter IPv4 Mask: 255.255.255.0
10 Enter IPv4 Gateway: 192.168.1.1
11 Flashing static IPv4 192.168.1.200, mask 255.255.255.0, gateway 192.168.1.1 to the POE device. Enter 'y' to confirm. y
12 Flashing successful.Command Line
1Found device with name: 192.168.1.200
2 -------------------------------------
3 "1" to set a static IPv4 address
4 "2" to set a dynamic IPv4 address
5 "3" to clear the config默认 IP 地址,如果未检测到 DHCP 服务器,它将恢复到该地址。有关此工作原理的更多详细信息,请参阅 PoE 部署指南中的 无 DHCP 部分。设置
Command Line
1git clone https://github.com/luxonis/depthai-python.git
2cd depthai-python/examples
3python3 install_requirements.py源代码
Python
PythonGitHub
1import depthai as dai
2
3(found, info) = dai.DeviceBootloader.getFirstAvailableDevice()
4
5def check_str(s: str):
6 spl = s.split(".")
7 if len(spl) != 4:
8 raise ValueError(f"Entered value {s} doesn't contain 3 dots. Value has to be in the following format: '255.255.255.255'")
9 for num in spl:
10 if 255 < int(num):
11 raise ValueError("Entered values can't be above 255!")
12 return s
13
14if found:
15 print(f'Found device with name: {info.name}')
16 print('-------------------------------------')
17 print('"1" to set a static IPv4 address')
18 print('"2" to set a dynamic IPv4 address')
19 print('"3" to clear the config')
20 key = input('Enter the number: ').strip()
21 print('-------------------------------------')
22 if int(key) < 1 or 3 < int(key):
23 raise ValueError("Entered value should either be '1', '2' or '3'!")
24
25 with dai.DeviceBootloader(info) as bl:
26 if key in ['1', '2']:
27 ipv4 = check_str(input("Enter IPv4: ").strip())
28 mask = check_str(input("Enter IPv4 Mask: ").strip())
29 gateway = check_str(input("Enter IPv4 Gateway: ").strip())
30 mode = 'static' if key == '1' else 'dynamic'
31 val = input(f"Flashing {mode} IPv4 {ipv4}, mask {mask}, gateway {gateway} to the POE device. Enter 'y' to confirm. ").strip()
32 if val != 'y':
33 raise Exception("Flashing aborted.")
34
35 conf = dai.DeviceBootloader.Config()
36 if key == '1': conf.setStaticIPv4(ipv4, mask, gateway)
37 elif key == '2': conf.setDynamicIPv4(ipv4, mask, gateway)
38 (success, error) = bl.flashConfig(conf)
39 elif key == '3':
40 (success, error) = bl.flashConfigClear()
41
42 if not success:
43 print(f"Flashing failed: {error}")
44 else:
45 print(f"Flashing successful.")需要帮助?
请前往 Discussion Forum 获取技术支持或提出您可能有的任何其他问题。