Skip to content
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

Headless Linux box share mouse and keyboard to windows #1135

Open
lededev opened this issue Apr 19, 2021 · 4 comments
Open

Headless Linux box share mouse and keyboard to windows #1135

lededev opened this issue Apr 19, 2021 · 4 comments

Comments

@lededev
Copy link

lededev commented Apr 19, 2021

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.

@lededev
Copy link
Author

lededev commented 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

@lededev
Copy link
Author

lededev commented Apr 21, 2021

step 2 complete. Just add an option --headless-mode in server command line, with my PR #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.

@lededev
Copy link
Author

lededev commented 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)

@lededev
Copy link
Author

lededev commented May 18, 2021

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

@lededev lededev changed the title [Question] Headless Linux box share mouse and keyboard to windows Headless Linux box share mouse and keyboard to windows May 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant