Running barrier through devd

Greetings,

I am having a bit of an issue with my setup. I have a ThinkPad W520, with a docking station on the desk with my desktop machine. Both hosts run the latest version of FreeBSD, currently 14.1.

So when I first got the laptop (about FBSD 12.3, if memory serves), I was running Synergy soft KVM. I was able, thanks to vermaden's great article, to launch synergy on the laptop when I dropped it into the dock. Over the course of time, when synergy built their paywall, I ended up switching to barrier as it matured. With synergy, I had the following in my dock.conf, when running under synergy:
Code:
# In docking staton start synergy
notify 100 {
    match "system" "USB";
    match "subsystem" "DEVICE";
    match "type" "ATTACH";
    match "vendor" "0x17ef";
    match "product" "0x100a";
    action "su -l vulcanridr -c 'synergy-core --client --name laptop desktop' &";
};

# Out of docking staton kill synergy
notify 100 {
    match "system" "USB";
    match "subsystem" "DEVICE";
    match "type" "DETACH";
    match "vendor" "0x17ef";
    match "product" "0x100a";
    action "pkill synergy-core";
};

Once I switched to barrier, I tried switching devd.conf, and was never able to get it working. I just rebuilt my laptop (after HDD/memory upgrades), and revisited the issue.

I have tried changing synergy-core --client --name laptop desktop to barrier --client --name laptop desktop , barrierc laptop desktop, and barrier --client --name laptop.fqdn desktop.fqdn

So far, I am missing the secret sauce that makes this work. Anyone know the right incantation of the barrier command to get it to automagically start when I plug in the dock?

Thanks,
--vr
 
hi mate, i used barrier a couple of years ago with freebsd

heres my notes

barrier install

Code:
sudo pkg install barrier

barrier.conf

Code:
 ~/.config/barrier/barrier.conf

Code:
section: screens
    # three hosts named:  moe, larry, and curly
    pollux:
    macmini.local:
end

section: links
    # larry is to the right of moe and curly is above moe
    pollux:
        right = macmini.local

    # moe is to the left of larry and curly is above larry.
    # note that curly is above both moe and larry and moe
    # and larry have a symmetric connection (they're in
    # opposite directions of each other).
    macmini.local:
        left  = pollux
end

section: options
    keystroke(super+`) = switchInDirection(right)
    keystroke(super+shift+`) = switchInDirection(left)
end

barrier command line

Code:
barrier --server --address 192.168.1.3:24800 --config ~/.barrier/barrier.conf

share-keyboard script

Code:
#!/bin/sh

# barrier share keyboard and mouse
usage="usage: $(basename "$0") [ start | stop ]"

# check if 1 argument is passed to the script
[ $# = 1 ] || { printf "%s\n" "$usage"; exit 1; }

# case statement
input="$1"
case "$input" in
  start)
        # if server isnt running start it
        barrier --server --address 192.168.1.3:24800 --config ~/.config/barrier/barrier.conf
        break;;
  stop)
        # if server is running stop it
        pkill barrier
        break;;
  *)    printf "%s\n" "$usage";;
esac
 
hi mate, i used barrier a couple of years ago with freebsd

heres my notes

barrier install

Code:
sudo pkg install barrier

barrier.conf

Code:
 ~/.config/barrier/barrier.conf

Code:
section: screens
    # three hosts named:  moe, larry, and curly
    pollux:
    macmini.local:
end

section: links
    # larry is to the right of moe and curly is above moe
    pollux:
        right = macmini.local

    # moe is to the left of larry and curly is above larry.
    # note that curly is above both moe and larry and moe
    # and larry have a symmetric connection (they're in
    # opposite directions of each other).
    macmini.local:
        left  = pollux
end

section: options
    keystroke(super+`) = switchInDirection(right)
    keystroke(super+shift+`) = switchInDirection(left)
end

barrier command line

Code:
barrier --server --address 192.168.1.3:24800 --config ~/.barrier/barrier.conf

share-keyboard script

Code:
#!/bin/sh

# barrier share keyboard and mouse
usage="usage: $(basename "$0") [ start | stop ]"

# check if 1 argument is passed to the script
[ $# = 1 ] || { printf "%s\n" "$usage"; exit 1; }

# case statement
input="$1"
case "$input" in
  start)
        # if server isnt running start it
        barrier --server --address 192.168.1.3:24800 --config ~/.config/barrier/barrier.conf
        break;;
  stop)
        # if server is running stop it
        pkill barrier
        break;;
  *)    printf "%s\n" "$usage";;
esac
Thanks for your post NapoleonWils0n. Barrier works fine. My barrier server installation works perfectly. I have a .barrier.conf in ~. (I should at some point move it to .config...) That said, barrierc/barrier --client should not need a config file. You just fire up barrierc <server>.

The problem seems to be the incantation in devd. I have to alt-tab to a terminal window on the laptop and run synergc desktop, and then it starts working. I was just trying to get this done through devd, as it is so convenient and a very cool way to set it up.
 
i havent used barrier and devd
to be honest i didnt even you could use the two together
When it worked, when I was using synergy-core, it was good. You leave the synergy server running, but the client launches when devd detects it is on the docking station. Check the link in my original post to the article on Vermaden's blog. He uses devd to unlock his laptop with his phone.
 
I use barrier with 3 systems, FBSD, OBSD and Void linux. I just:
- install it
- open the settings menu in the gui
1721000577642.png

- Turn SSL off (like in the pic above)
- Go to server config and setup your systems (like pic bellow)
1721000677231.png

- Then config each client with the server IP
- Finally, hit start
 
I use barrier with 3 systems, FBSD, OBSD and Void linux. I just:
- install it
- open the settings menu in the gui
View attachment 19543
- Turn SSL off (like in the pic above)
- Go to server config and setup your systems (like pic bellow)
View attachment 19544
- Then config each client with the server IP
- Finally, hit start
Yeah, I know...I have barrier fully working, I am just trying to get the client to be controlled by devd, so I don't have to start it manually. But thanks.
 
Isn't there a way to check the exit code of that programm? Maybe barrier has a log file or some other logging capabilities?
 
I am just trying to get the client to be controlled by devd, so I don't have to start it manually
Why? Why not just start with your system? If you lock the screen on the server side, or turn off the pc where the server is, doesn't matter if barrier it running or not, it won't work on the client side. There is more easier ways to do what you want to do without messing with devd.
 
Why? Why not just start with your system? If you lock the screen on the server side, or turn off the pc where the server is, doesn't matter if barrier it running or not, it won't work on the client side. There is more easier ways to do what you want to do without messing with devd.
Basically, in my use case is that I only want barrier to run when it is in the docking station. If the laptop is not in the dock, but barrierc is running, then barriers will still be connected, and keyboard/mouse will still go to both computers. devd seems the more elegant solution.
 
Basically, in my use case is that I only want barrier to run when it is in the docking station. If the laptop is not in the dock, but barrierc is running, then barriers will still be connected, and keyboard/mouse will still go to both computers. devd seems the more elegant solution.
Right click in the tray icon, click in stop, take the laptop out of the dock and voilà.
1721523319319.png


And again, if you lock your screen on the server side, barrier wont work on the client side. I see no reason to break your head with devd.
 
Back
Top