File tree Expand file tree Collapse file tree 2 files changed +99
-0
lines changed Expand file tree Collapse file tree 2 files changed +99
-0
lines changed Original file line number Diff line number Diff line change @@ -127,6 +127,32 @@ ZPC>attribute_store_set_desired 110,1
127
127
(...)
128
128
```
129
129
130
+ ### WSL2 build
131
+
132
+ How to use a z-wave controller with ZPC running in WSL2 ?
133
+
134
+ You can use this [ script] ( ./scripts/wslusb.ps1 ) .
135
+
136
+ Start by installing the usbipd service as described at: https://learn.microsoft.com/en-us/windows/wsl/connect-usb
137
+
138
+ ``` sh
139
+ # You can list devices using:
140
+
141
+ (Powershell)$ ./wslusb.ps1 -List
142
+
143
+ # Get the BUSID of the device you want to mount
144
+
145
+ (Powershell)$ ./wslusb.ps1 -Attach < busid>
146
+
147
+ # Check that the device is correctly mounted into WSL2
148
+
149
+ (WSL2)$ lsusb # you should see your device here
150
+
151
+ # Detach the device with
152
+
153
+ (Powershell)$ ./wslusb.ps1 -Detach < busid>
154
+ ```
155
+
130
156
### More
131
157
132
158
Refer to [ ./doc] ( doc ) for more (using shell, MQTT, WebApp etc).
Original file line number Diff line number Diff line change
1
+ # SPDX-License-Identifier: ZLib
2
+ # This script can be used to attach and detach a device to your WSL2 distribution
3
+
4
+ [CmdletBinding ()]
5
+ param (
6
+ [Parameter (Mandatory = $false , HelpMessage = " Busid of the device you want to bind" )]
7
+ [Alias (" b" )]
8
+ [string ]$Busid ,
9
+
10
+ [Switch ]$Attach ,
11
+ [Switch ]$Detach ,
12
+ [Switch ]$List
13
+ )
14
+
15
+ # Unblock the script file
16
+ Unblock-File - Path $MyInvocation.MyCommand.Path
17
+
18
+ Function List-devices {
19
+ usbipd list
20
+ }
21
+
22
+ Function Attach-device {
23
+ param (
24
+ [string ]$Busid
25
+ )
26
+ Write-Host " Attaching device $Busid "
27
+ usbipd bind -- busid $Busid -- force
28
+ usbipd attach -- wsl -- busid $Busid -- auto- attach
29
+ }
30
+
31
+ Function Detach-device {
32
+ param (
33
+ [string ]$Busid
34
+ )
35
+ Write-Host " Detaching device $Busid "
36
+ usbipd detach -- busid $Busid
37
+ usbipd unbind -- busid $Busid
38
+ }
39
+
40
+ if ($Attach -or $Detach -or $List )
41
+ {
42
+ if ($List )
43
+ {
44
+ List- devices
45
+ }
46
+ if ($Detach )
47
+ {
48
+ if ($Busid )
49
+ {
50
+ Detach- device - Busid $Busid
51
+ }
52
+ else
53
+ {
54
+ Write-Host " Busid not specified"
55
+ }
56
+ }
57
+ if ($Attach )
58
+ {
59
+ if ($Busid )
60
+ {
61
+ Attach- device - Busid $Busid
62
+ }
63
+ else
64
+ {
65
+ Write-Host " Busid not specified"
66
+ }
67
+ }
68
+ }
69
+ else
70
+ {
71
+ Write-Host " No argument specified. Use -Attach, -Detach or -List"
72
+ Write-Host ' Ex: ./wslusb.ps1 -b "5-3" -Attach'
73
+ }
You can’t perform that action at this time.
0 commit comments