Qubes-OS 3.2: USB printer (and other devices)

Below you will find the commands we used to enable the sys-usb VM (on an installation of Qubes 3.2 where it was not enabled by default nor was the task of handling USB devices assigned to sys-net).

On dom0 terminal emulator, we executed the following first to enable sys-usb.

sudo qubesctl top.enable qvm.sys-usb;
sudo qubesctl state.highstate;

Then we modified the configuration files for the mouse (/etc/qubes-rpc/policy/qubes.InputMouse) and keyboard (/etc/qubes-rpc/policy/qubes.InputKeyboard) so that they will automatically be granted to dom0 without prompting the used each time.

We modified the content /etc/qubes-rpc/policy/qubes.InputMouse and /etc/qubes-rpc/policy/qubes.InputKeyboard to be as below:

sys-usb dom0 allow,user=root
$anyvm $anyvm deny

Qubes-OS 3.2 GNU/ Linux: Temporarily enable second language for keyboard

Recently we started using Qubes OS 3.2, at some point we needed to enable the Greek language keyboard for a Fedora 23 based VM.

To avoid making permanent change to the VM we used the following command that enables the US and GR keyboard layouts while switching is made available by pressing the two shift buttons at the same time.

setxkbmap -layout "us,gr" -option "grp:shifts_toggle";

Bash: After redirected input file is done, allow user to control application via STDIN 1

Recently, we needed to start an application using a script, which application had its own CLI.
After starting it, we had to feed it with some input to configure it before handing it over to the end user.

The application we used was named dog. We wrote into a plain text file (named food) the commands that we needed to feed the application and then we started the execution using a plain input redirect like so dog < food;.
Doing so, resulted into properly feeding the dog application the food data  but it would cause the application to terminate immediately after the food was done as it would also feed the EOF (End Of File) directive to dog.
Apparently, the application after receiving the EOF, it would then terminate without allowing the end user to take control.

To mitigate the problem, we used the cat command to concatenate the input file along with the stdin stream, permitting us to first feed all the data in the food file and then allow the user to input data using the standard input stream.
Our final command resulted in the following solution as below

cat <(cat food) - | dog;

Where - is the special sign for standard input stdin.
cat food can be of course replaced with other commands that produce output on the standard output (stdout).

A bad side-effect of this solution, is that we lost some functionality of the terminal including, but not limited to, using the backspace and navigation.