[GH-ISSUE #1135] Headless Linux box share mouse and keyboard to windows #912

Open
opened 2026-05-05 07:16:13 -06:00 by gitea-mirror · 4 comments
Owner

Originally created by @lededev on GitHub (Apr 19, 2021).
Original GitHub issue: https://github.com/debauchee/barrier/issues/1135

Can I use barrier on a Linux box no monitor, but have USB port and mouse and keyboard, and share them to a Windows PC?
I need this because fiber HDMI can transmit video far distance, but some of them have no USB channel, to provide input devices.
A raspberry pi or openwrt box which have USB port, do this job I think is enough.
I tried USB over Ethernet, but the newest windows usbip still unstable, so I come here.

Originally created by @lededev on GitHub (Apr 19, 2021). Original GitHub issue: https://github.com/debauchee/barrier/issues/1135 Can I use barrier on a Linux box no monitor, but have USB port and mouse and keyboard, and share them to a Windows PC? I need this because fiber HDMI can transmit video far distance, but some of them have no USB channel, to provide input devices. A raspberry pi or openwrt box which have USB port, do this job I think is enough. I tried USB over Ethernet, but the newest windows usbip still unstable, so I come here.
Author
Owner

@lededev commented on GitHub (Apr 20, 2021):

  • progress

I am now using a RK3288 TV box, install Armbian, and barrier as server, connect USB kbd and mice.
because Armbian act like other TV box, it will directly go into user desktop by default. I can lunch barriers by using xfce4's autostart.
After this TV box power on, wait about 60s, press hotkey CTRL+ALT+o, my windows client got kbd and mice.

As the next step in the future, I will add some C++ code to make the switch screen action automatically. When server find remote client connected, it will switch screen input focus to remote client immediately, because a headless box hold USB HID devices is pointless.
The primary(headless) client which on server will only got input focus by using hotkey CTRL+ALT+p, for maintenance purposes.

filename: /home/user/.config/autostart/barriers.desktop

[Desktop Entry]
Encoding=UTF-8
Version=0.9.4
Type=Application
Name=barriers focus remote client
Comment=share keybd mice
Exec=/usr/bin/barriers --debug INFO --name headless --enable-crypto -c /home/user/remote_client.sgc --address :24800
OnlyShowIn=XFCE;
RunHook=0
StartupNotify=false
Terminal=false
Hidden=false

filename /home/user/remote_client.sgc

section: screens
        remote_client:
                halfDuplexCapsLock = false
                halfDuplexNumLock = false
                halfDuplexScrollLock = false
                xtestIsXineramaUnaware = false
                preserveFocus = false
                switchCorners = none +top-left +top-right +bottom-left +bottom-right
                switchCornerSize = 99
        headless:
                halfDuplexCapsLock = false
                halfDuplexNumLock = false
                halfDuplexScrollLock = false
                xtestIsXineramaUnaware = false
                preserveFocus = false
                switchCorners = none +top-right +bottom-right
                switchCornerSize = 99
end

section: aliases
end

section: links
        remote_client:
        headless:
end

section: options
        relativeMouseMoves = true
        screenSaverSync = false
        win32KeepForeground = false
        clipboardSharing = false
        switchCorners = none
        switchCornerSize = 0
        keystroke(Control+Alt+o) = switchToScreen(remote_client)
        keystroke(Control+Alt+p) = switchToScreen(headless)
end

<!-- gh-comment-id:823247196 --> @lededev commented on GitHub (Apr 20, 2021): * progress I am now using a RK3288 TV box, install Armbian, and barrier as server, connect USB kbd and mice. because Armbian act like other TV box, it will directly go into user desktop by default. I can lunch barriers by using xfce4's autostart. After this TV box power on, wait about 60s, press hotkey CTRL+ALT+o, my windows client got kbd and mice. As the next step in the future, I will add some C++ code to make the switch screen action automatically. When server find remote client connected, it will switch screen input focus to remote client immediately, because a headless box hold USB HID devices is pointless. The primary(headless) client which on server will only got input focus by using hotkey CTRL+ALT+p, for maintenance purposes. filename: /home/user/.config/autostart/barriers.desktop ``` [Desktop Entry] Encoding=UTF-8 Version=0.9.4 Type=Application Name=barriers focus remote client Comment=share keybd mice Exec=/usr/bin/barriers --debug INFO --name headless --enable-crypto -c /home/user/remote_client.sgc --address :24800 OnlyShowIn=XFCE; RunHook=0 StartupNotify=false Terminal=false Hidden=false ``` filename /home/user/remote_client.sgc ``` section: screens remote_client: halfDuplexCapsLock = false halfDuplexNumLock = false halfDuplexScrollLock = false xtestIsXineramaUnaware = false preserveFocus = false switchCorners = none +top-left +top-right +bottom-left +bottom-right switchCornerSize = 99 headless: halfDuplexCapsLock = false halfDuplexNumLock = false halfDuplexScrollLock = false xtestIsXineramaUnaware = false preserveFocus = false switchCorners = none +top-right +bottom-right switchCornerSize = 99 end section: aliases end section: links remote_client: headless: end section: options relativeMouseMoves = true screenSaverSync = false win32KeepForeground = false clipboardSharing = false switchCorners = none switchCornerSize = 0 keystroke(Control+Alt+o) = switchToScreen(remote_client) keystroke(Control+Alt+p) = switchToScreen(headless) end ```
Author
Owner

@lededev commented on GitHub (Apr 21, 2021):

step 2 complete. Just add an option --headless-mode in server command line, with my PR https://github.com/debauchee/barrier/pull/1139 applied:
Exec=/usr/bin/barriers --debug INFO --name headless --enable-crypto -c /home/user/remote_client.sgc --address :24800
replace to
Exec=/usr/bin/barriers --debug INFO --name headless --enable-crypto --headless-mode -c /home/user/remote_client.sgc --address :24800
You will got an out of the box headless USB HID server.

Step 3 in future: I will replace my RK3288 TV box to an even more cheaper RK3188 TV stick, as headless Linux device.

<!-- gh-comment-id:823876120 --> @lededev commented on GitHub (Apr 21, 2021): step 2 complete. Just add an option `--headless-mode` in server command line, with my PR https://github.com/debauchee/barrier/pull/1139 applied: `Exec=/usr/bin/barriers --debug INFO --name headless --enable-crypto -c /home/user/remote_client.sgc --address :24800` replace to `Exec=/usr/bin/barriers --debug INFO --name headless --enable-crypto --headless-mode -c /home/user/remote_client.sgc --address :24800` You will got an out of the box headless USB HID server. Step 3 in future: I will replace my RK3288 TV box to an even more cheaper RK3188 TV stick, as headless Linux device.
Author
Owner

@lededev commented on GitHub (Apr 30, 2021):

headless: add hotkey bind userscript
let headless server easy to restart service and reboot server, by using hotkey bind userscript.
Usage:
in remote_client.sgc section: options

        keystroke(Control+Alt+k) = userScript(/home/user/Barrier-script-restart.sh)
        keystroke(Control+Alt+l) = userScript(sudo reboot)
<!-- gh-comment-id:830210077 --> @lededev commented on GitHub (Apr 30, 2021): headless: add hotkey bind userscript let headless server easy to restart service and reboot server, by using hotkey bind userscript. Usage: in remote_client.sgc section: options ``` keystroke(Control+Alt+k) = userScript(/home/user/Barrier-script-restart.sh) keystroke(Control+Alt+l) = userScript(sudo reboot) ```
Author
Owner

@lededev commented on GitHub (May 18, 2021):

Update PR, login screen reconnect delay change from 15s to 2s. Some more changes backport from upstream, to resolve pointer jump.

<!-- gh-comment-id:842891754 --> @lededev commented on GitHub (May 18, 2021): Update [PR](https://github.com/debauchee/barrier/pull/1139/commits/7ac22c31cbc845cd9a778eef8deced040bcda949), login screen reconnect delay change from 15s to 2s. Some more changes backport from upstream, to resolve pointer jump.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/barrier#912
No description provided.