C:\Windows\System32>usbipd wsl list
BUSID VIDID DEVICE STATE
2-1 093a:2533 USB 输入设备 Not attached
2-2 12d1:107f HDC Interface, "HDC Device" Not attached
2-3 2717:5013 USB 输入设备 Not attached
2-6 30c9:00a9 Integrated Camera, Integrated IR Camera, APP Mode Not attached
2-10 8087:0033 英特尔(R) 无线 Bluetooth(R) Not attached
```
用管理员权限启动 `cmd`
```
usbipd wsl attach --busid 2-2
```
```js
C:\Windows\System32>usbipd wsl list
BUSID VIDID DEVICE STATE
2-1 093a:2533 USB 输入设备 Not attached
2-2 12d1:107f HDC Interface, "HDC Device" Attached - WSL
2-3 2717:5013 USB 输入设备 Not attached
2-6 30c9:00a9 Integrated Camera, Integrated IR Camera, APP Mode Not attached
2-10 8087:0033 英特尔(R) 无线 Bluetooth(R) Not attached
```
```
zmtzawqlp@localhost:~/ohos/flutter/demo/flutter_ohos$ lsusb
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 002: ID 12d1:107f Huawei Technologies Co., Ltd. "HDC Device"
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
```
最后执行 `sudo chmod -R 777 /dev/bus/usb/`
```
zmtzawqlp@localhost:~/ohos/flutter/demo/flutter_ohos$ flutter devices
Flutter assets will be downloaded from https://storage.flutter-io.cn. Make sure you trust this source!
2 connected devices:
```
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Redist\\MSVC\\14.38.33130\\arm64\\Microsoft.VC143.CRT\\msvcp140.dll'
Executing //build/vs_toolchain.py took 159ms
ERROR at //build/toolchain/win/BUILD.gn:59:3: Script returned non-zero exit code.
exec_script("//build/vs_toolchain.py",
^----------
```
```
flutter\enigne
Hvigor cleaning...
Hvigor installing...
ENOENT ENOENT: no such file or directory, open 'D:\ohos\flutter\enigne\src\flutter\shell\platform\ohos\flutter_embedding\dependencies\hvigor-3.2.1-s.tgz'
```
`flutter run --local-engine-src-path /Users/xxx/Documents/ohos/flutter/engine/src --local-engine ohos_debug_unopt_arm64 `
#### 修改 flutter_tools 的流程
* 创建一个 `ohos_local_engine.patch` 文件,将下面的内容复制到里面去。
```
diff --git a/packages/flutter_tools/lib/src/runner/flutter_command_runner.dart b/packages/flutter_tools/lib/src/runner/flutter_command_runner.dart
index 28dc9f587a..bf94f57750 100644
--- a/packages/flutter_tools/lib/src/runner/flutter_command_runner.dart
+++ b/packages/flutter_tools/lib/src/runner/flutter_command_runner.dart
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.