-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Task/thdubois/wsl2 devices doc #73
Open
Thomasdjb
wants to merge
6
commits into
SiliconLabsSoftware:main
Choose a base branch
from
Thomasdjb:task/thdubois/wsl2-devices-doc
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
4e1daa9
build: d/host_dependencies.apt: Remove libasound2 for WSL #72
rzr aee776b
SWPROT-8953: build: Add run rule (#72)
rzr 7dd5ca4
SWPROT-8953: Docs add Quickstart instructions (#72)
rzr 2f8918d
SWPROT-8953: git: Ignore temp files (#72)
rzr 901105b
SWPROT-8953: docker: Run zpc in container (#72)
rzr fde8b4a
script: Add wsl2 devices support #73
Thomasdjb File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# .dockerignore | ||
Dockerfile | ||
docker-compose.yml | ||
|
||
# .gitignore | ||
# Temporary files | ||
*~ | ||
tmp | ||
# All build folders | ||
/build*/ | ||
# Visual Studio Code | ||
.vscode/settings.json | ||
.vscode/launch.json | ||
.vscode/*.log | ||
*.code-workspace | ||
# JetBrains IDE | ||
.idea/ | ||
# Cmake Projects in root ### | ||
compile_commands.json | ||
# Clangd index | ||
.clangd/ | ||
.cache/ | ||
# BeyondCompare backup files | ||
*.orig | ||
# SonarScanner files | ||
.scannerwork/ | ||
# Generated debconf files | ||
applications/*/debconf/config | ||
# Macos fs igores | ||
*.DS_Store | ||
# Other files | ||
*.swp | ||
*.gcov |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# .gitignore | ||
# Temporary files | ||
*~ | ||
tmp | ||
# All build folders | ||
/build*/ | ||
# Visual Studio Code | ||
.vscode/settings.json | ||
.vscode/launch.json | ||
.vscode/*.log | ||
*.code-workspace | ||
# JetBrains IDE | ||
.idea/ | ||
# Cmake Projects in root ### | ||
compile_commands.json | ||
# Clangd index | ||
.clangd/ | ||
.cache/ | ||
# BeyondCompare backup files | ||
*.orig | ||
# SonarScanner files | ||
.scannerwork/ | ||
# Generated debconf files | ||
applications/*/debconf/config | ||
# Macos fs igores | ||
*.DS_Store | ||
# Other files | ||
*.swp | ||
*.gcov |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# -*- coding: utf-8 -*- | ||
# SPDX-License-Identifier: ZLib | ||
|
||
version: "2" | ||
|
||
services: | ||
broker: | ||
image: eclipse-mosquitto:1.5.9 | ||
ports: | ||
- '1883:1883' | ||
command: mosquitto | ||
restart: unless-stopped | ||
|
||
zpc: | ||
build: . | ||
command: run --mqtt.host=broker | ||
devices: | ||
- ${DEVICE:-/dev/ttyACM0}:/dev/ttyUSB0 | ||
depends_on: | ||
- broker | ||
restart: on-failure |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
# SPDX-License-Identifier: ZLib | ||
# This script can be used to attach and detach a device to your WSL2 distribution | ||
Thomasdjb marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
[CmdletBinding()] | ||
param( | ||
[Parameter(Mandatory= $false, HelpMessage = "Busid of the device you want to bind")] | ||
[Alias("b")] | ||
[string]$Busid, | ||
|
||
[Switch]$Attach, | ||
[Switch]$Detach, | ||
[Switch]$List | ||
) | ||
|
||
# Unblock the script file | ||
Unblock-File -Path $MyInvocation.MyCommand.Path | ||
|
||
Function List-devices { | ||
usbipd list | ||
} | ||
|
||
Function Attach-device { | ||
param( | ||
[string]$Busid | ||
) | ||
Write-Host "Attaching device $Busid" | ||
usbipd bind --busid $Busid --force | ||
usbipd attach --wsl --busid $Busid --auto-attach | ||
} | ||
|
||
Function Detach-device { | ||
param( | ||
[string]$Busid | ||
) | ||
Write-Host "Detaching device $Busid" | ||
usbipd detach --busid $Busid | ||
usbipd unbind --busid $Busid | ||
} | ||
|
||
if ($Attach -or $Detach -or $List) | ||
{ | ||
if($List) | ||
{ | ||
List-devices | ||
} | ||
if ($Detach) | ||
{ | ||
if ($Busid) | ||
{ | ||
Detach-device -Busid $Busid | ||
} | ||
else | ||
{ | ||
Write-Host "Busid not specified" | ||
} | ||
} | ||
if ($Attach) | ||
{ | ||
if ($Busid) | ||
{ | ||
Attach-device -Busid $Busid | ||
} | ||
else | ||
{ | ||
Write-Host "Busid not specified" | ||
} | ||
} | ||
} | ||
else | ||
{ | ||
Write-Host "No argument specified. Use -Attach, -Detach or -List" | ||
Write-Host 'Ex: ./wslusb.ps1 -b "5-3" -Attach' | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe there is a powershell style is there ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doesn't matter really