Setting device limit in client (server license purchased)

Hi
We're using VH to kiosk a dozen UP!Plus2 3D printers using Raspberry Pi. It works fantastically well, and you're to be congratulated on a brilliant product.
We've bought the unlimited license, and actually found one snag which we didn't have with the trial version (bear with me here!)
Is there a way to limit the number of devices (to 1) a client can connect to?
We'd like to be able to force people to 'Use' a device in the client, and then 'Stop using', before another device can be selected for use (so that command don't accidentally get sent to a printer that is already printing). We actually liked the fact that the trial version only allowed one device to be used at a time!
I hope this makes sense, and thanks in advance for any response.
Best
Ali Napier

#2

Thats a good idea, and easy feature to add, i can add it in the next build available in the next day or two

#3

1. Download version 2.8.9 from here https://www.virtualhere.com/usb_server_software
2. Stop the server
3. edit the server config.ini file and add the line
clientAuthorization=/home/pi/auth.sh "$NUM_BINDINGS$"
4. Create a file /home/pi/auth.sh and put in the following and chmod +x the file

#!/bin/bash
# Example script for limiting a user to only one device at a time
# Return 1 if the user is allowed to access this device
# Return 0 if the user is not allowed to access this device
# Parameters are passed in as:
# $1 = NUM_BINDINGS
logger "Authorizing -> '$1'"
if [[ "$1" == 1 ]]; then
logger "Not authorized, already connected"
exit 0
else
logger "Authorized"
exit 1
fi

The $NUM_BINDINGS$ is replaced at runtime by the server with the number of devices the user is currently using

More information can be found here https://virtualhere.com/authorization

#4

Wow, amazing response! I'll check it out when I get in to the studio tomorrow - thanks so much.

#5

Thanks so much for writing this feature into the server - exactly what I was after, and it works perfectly.

Best
Ali