File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -103,6 +103,7 @@ ZPC> zwave_add_node
103103(...)
104104```
105105
106+
106107Set endnode to learn mode and the controller should see it:
107108
108109``` sh
@@ -131,6 +132,31 @@ ZPC>attribute_store_set_desired 110,1
131132
132133Refer to [ ./doc] ( doc ) for more (using shell, MQTT, WebApp etc).
133134
135+ ### WSL2 build
136+
137+ How to use a z-wave controller with ZPC running in WSL2 ?
138+
139+ You can use this [ script] ( ./scripts/wslusb.ps1 ) .
140+
141+ Start by installing the usbipd service as described at: https://learn.microsoft.com/en-us/windows/wsl/connect-usb
142+
143+ ``` sh
144+ # You can list devices using:
145+
146+ (Powershell)$ ./wslusb.ps1 -List
147+
148+ # Get the BUSID of the device you want to mount
149+
150+ (Powershell)$ ./wslusb.ps1 -Attach < busid>
151+
152+ # Check that the device is correctly mounted into WSL2
153+
154+ (WSL2)$ lsusb # you should see your device here
155+
156+ # Detach the device with
157+
158+ (Powershell)$ ./wslusb.ps1 -Detach < busid>
159+ ```
134160
135161### Docker build
136162
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