Created
July 31, 2024 12:28
-
-
Save h3po/2bca4d200f66ab24772cf2b3e63136b2 to your computer and use it in GitHub Desktop.
let udev start usbredirect as systemd service, using a static port per usb port location. requires usbredirect >= 0.14
This file contains hidden or 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
USBREDIRECT_1_5_1=0.0.0.0:7000 | |
USBREDIRECT_1_5_2_1=0.0.0.0:7001 | |
USBREDIRECT_1_5_2_2_1=0.0.0.0:7002 | |
USBREDIRECT_1_5_2_2_2=0.0.0.0:7003 | |
USBREDIRECT_1_5_4=0.0.0.0:7004 | |
USBREDIRECT_1_5_2_4=0.0.0.0:7005 | |
USBREDIRECT_1_5_2_3=0.0.0.0:7006 |
This file contains hidden or 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
ACTION=="bind", SUBSYSTEM=="usb", ENV{BUSNUM}=="001", ENV{DEVTYPE}=="usb_device", ENV{ID_MODEL}!="USB_2.0_Hub", \ | |
TAG+="systemd", ENV{SYSTEMD_WANTS}="[email protected]" | |
This file contains hidden or 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
[Unit] | |
Requires=network.target | |
After=network.target | |
BindsTo=%i.device | |
[Service] | |
Type=simple | |
EnvironmentFile=/etc/default/%p | |
ExecStart=/bin/bash -c '\ | |
hostvarname="USBREDIRECT_$$(basename '%I' | tr - _ | tr . _)"; \ | |
hostvar="$${!hostvarname}"; \ | |
if [[ -z "$$hostvar" ]]; then echo "environment variable $$hostvarname for device %I not defined in /etc/default/%p 1>&2"; exit 1; fi ; \ | |
usbredirect --device $$(cat %I/busnum)-$$(cat %I/devnum) --as $${!hostvarname}' | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment