Xorg open two windows in full screen - window

I would like to open two windows (one per display) in full screen without any controls and bars. I'm using matchbox to do that, which would be ok except one thing. Windows open stretch in full screen in two monitors as it would be one.
I'm using this .xinitrc file to control Xorg.
xrandr --output HDMI2 --auto --pos 0x1080 --output HDMI1 --auto --pos 0x0
xset s off
xset -dpms
matchbox-window-manager &
electron ./window1
electron ./window2
I could change window manager if it only could run application with kiosk restrictions.

I figure out how to do that. You should use -use_dialog_mode=free
# set window one below another
xrandr --output DP1 --mode 1920x1080 --output HDMI1 --mode 1920x1080 --below DP1
matchbox-window-manager -use_dialog_mode=free &
# BONUS: touchscreen cover only area of HDMI1
xinput map-to-output 11 HDMI1

Related

How to Setup VcXSrv for use with WSL2

How do you setup VcXSrv.exe on Windows 10 to work with WSL2 without disabling access control? Every description on the internet shows to disable the access control, but this allows any program on the local network to log your keystrokes and mouse movements among other things.
Rather than disabling access control on VcXSrv, you should use the .Xauthority file to share keys between your X11 clients and the VcXSrv X11 server. The .Xauthority contains a collection of authorization keys indexed by the DISPLAY . You'll need to setup this file with a key for your particular Windows host and share that file between the VcXSrv and your X11 clients running on your WSL2 distro. To setup this, follow these steps:
Run your WSL2 distro (Assuming this is a debian based one) and install xauth, md5sum and gawk or awk. We'll also install some X11 client to test our setup. In this case, we'll install gnome-terminal but you can install something else if you want. On an Ubuntu distro, you can do:
sudo apt install -y xauth coreutils gawk gnome-terminal
xauth list # this should be an empty list
magiccookie=$(echo '{some-pass-phrase}'|tr -d '\n\r'|md5sum|gawk '{print $1}')
xauth add host.docker.internal:0 . $magiccookie
cp ~/.Xauthority /mnt/c/Users/{WindowsUserName}
Add the following to either your ~/.bashrc in your WSL2 distro home dir
export DISPLAY=host.docker.internal:0
We need to create either an XLaunch configuration file (i.e. config.xlaunch ) or
a shortcut to VcXSrv.exe with the desired command line args. XLaunch is a simple launcher
that assists in setting up the arguments and in turn calls vcxsrv.exe. We'll ignore using XLaunch and
just create our own shortcut with the appropriate arguments.
We want to run VcXSrv.exe with these args:
vcxsrv.exe -multiwindow -clipboard -wgl -auth {.XAuthority file} -logfile {A Log file} -logverbose {int log level}
From above, we copied the .Xauthority file to /mnt/c/Users/{WindowsUserName}/.Xauthority which means our desired command line is:
vcxsrv.exe -multiwindow -clipboard -wgl -auth "c:\users\{WindowsUserName}\.Xauthority" -logfile "c:\users\{WindowsUserName}\VcXSrv.log" -logverbose 5
Feel free to omit the logfile and logverbose options if you're not debugging any issues. So you can just do:
vcxsrv.exe -multiwindow -clipboard -wgl -auth "c:\users\{WindowsUserName}\.Xauthority"
Remember to replace {WindowsUserName} with the name of your folder under c:\Users.
To create the shortcut, navigate to where VcXSrv.exe is installed. The default location of this is
C:\Program Files\VcXSrv\VcXSrv.exe
In the explorer file window, right click on the VcXSrv.exe and click "Create Shortcut" . This will create a shortcut
on your desktop.
Right click over the created shortcut icon, and select properties.
In the Shortcut tab, append the arguments above after the executable . It should look something like:
"C:\Program Files\VcXSrv\VcXSrv.exe" -multiwindow -clipboard -wgl -auth "c:\users\{WindowsUserName}\.Xauthority"
In the General tab of the Properties dialog, change the name to be "VcXSrv with XAuthority".
Click ok.
Now you can start the X11 server by double clicking on the shortcut.
If you wish to have the X11 server started at startup, follow the instructions here:
https://support.microsoft.com/en-us/windows/add-an-app-to-run-automatically-at-startup-in-windows-10-150da165-dcd9-7230-517b-cf3c295d89dd
Now back in the WSL distro terminal, you should be able to run
the gnome-terminal or other X11 client and have it display securely
on the VcXSrv X11 server running on the Windows host.
export DISPLAY=host.docker.internal:0
gnome-terminal
This should result in the gnome-terminal being displayed on your X11 Server. Further, the xauthority file will be used to allow only authorized clients to connect to your X11 server.

How to write my own printer driver for a printer that is no longer supported by manufacturer?

The question pretty much says it all. I basically want to create a driver that is compatible with my current MacOS (Catalina). The issue I'm facing is that my printer (with scanner) currently will only scan pages and print them out. I'd like to be able to use my scanner to save an image of a scanned document.
I'm honestly not sure if writing a driver is the best way to do this but the manufacturer (Canon) no longer has drivers for this old scanner. But it works just as well as the day we got it so I REALLY don't want to have to toss this one out and buy a new one.
UPDATE: currently stuck with the following:
rabdelazin#rabdelazim Downloads % device=$(sane-find-scanner | awk '/Canon/{print $NF}')
rabdelazin#rabdelazim Downloads % echo $device
libusb:020:029
rabdelazin#rabdelazim Downloads % scanimage --device Canon:$device -x 210 -y 297 --mode color --resolution 240 --format=tiff --depth 8 > ~/Downloads/scan.tiff
scanimage: open of device Canon:libusb:020:029 failed: Operation not supported
I have an EPSON Perfection 4990 Photo on macOS, so I cannot give you full code and examples for your Canon but it may get you started. I spend my life in Terminal rather than using GUIs for anything so I just scan the full area of the platten at full resolution and do whatever I need later with ImageMagick or Photoshop if necessary.
So, to get it going I installed homebrew from here. Then I installed some packages:
brew install libusb
brew install sane-backends
Then I can find my scanner with:
sane-find-scanner
Sample Output
found USB scanner (vendor=0x04b8 [EPSON], product=0x012a [EPSON Scanner]) at libusb:003:002
Now you need the last word on that line, the libusb:003:002 part, with my EPSON, I use:
sane-find-scanner | awk '/EPSON/{print $NF}'
You will need to see what you get, and adapt slightly.
SampleOutput
libusb:003:002
So, in order to scan, I capture that in a bash variable called device and do this:
device=$(sane-find-scanner | awk '/EPSON/{print $NF}')
scanimage --device epson:$device -x 210 -y 297 --mode color --resolution 240 --format=tiff --depth 8 > ~/Desktop/scan.tif
I put the whole lot in a bash script called scan like this:
#/bin/bash
TMP="$HOME/Desktop/scan.tif"
# Find libusb device name
device=$(sane-find-scanner | awk '/EPSON|HP/{print $NF}')
if [ -z $device ]; then
echo ERROR: Unable to find libusb device
exit 1
fi
echo Found scanner at: $device
# Now scan full-size, colour, hi res
scanimage --device epson:$device -x 210 -y 297 --mode color --resolution 240 --format=tiff --depth 8 > "$TMP"
# Check we got a file
if [ ! -s "$TMP" ]; then
echo ERROR: Empty scan
exit 1
fi
My script has some further, optional, ImageMagick stuff at the end to create a Web-usable JPEG, if you add this you will need to do:
brew install imagemagick
Then add this to the script above:
# Copy the file to User's Desktop and number nicely...
# ... save as hi-res 16-bit TIF
# ... and medium res, medium quality JPG for web use
cd ~/Desktop
i=0
while :; do
base=$(printf "scan-%03d" $i)
if [ ! -f "${base}.jpg" ]; then
cp "$TMP" "${base}.tif"
convert "$TMP" -resize 2000x2000 -quality 85% "${base}.jpg"
break
fi
((i++))
done
Here are a couple of resources I found helpful when working it all out. You can debug the scanimage program with:
SANE_DEBUG_SNAPSCAN=128 scanimage -L
This resource was useful.
You can get help like this:
scanimage --help -d epson
Note that you may also be able to use a Raspberry Pi or similar small, low-cost Linux machine as a "scanner server". Basically you would attach your scanner via USB to the Raspberry Pi and run SANE on the Raspberry Pi. Once you get it working, you could run saned which is a daemon service, on the Raspberry Pi, that listens on the network for other devices (such as your Mac) making requests to scan. It does the scan, using its Linux SANE drivers and delivers the image back over the Ethernet to the Mac (or other) client. I know you dislike this option, but there may be future readers...
Keywords: macOS, OSX, scan, scanner, scanning, EPSON, Canon, HP, libusb, SANE, sane-backends
Well after a LOT of trial and error, I've finally come up with a solution.
TL;DR: I made a print server out of a raspberry-pi and installed cups and set the printer to be shared through the server. Works like a charm!
It took quite a bit of investigation but as part of reviving an old laptop, I got it running by installing Ubuntu 20.04. Just for kicks I decided to try and print something from the laptop. I had to install CUPS and maybe a few other packages but it worked. That got me thinking that I should just make a print server that knows how to talk to the printer so all the other machines can come and go but my printer should still work.

redirect serial port output as bash command with Xbee and RPI

My setup is complicated and I think I have a clear way ahead, but please let me know if you see a better way to accomplish my end state of using a terminal window over Xbee. My use case is that RPI #1 has internet connectivity, but RPI #2 does not, and I want to fully control and access RPI #2 via RPI #1 over Xbee.
I have x2 Raspberry Pi 3B+ and am using x2 Xbee Pro S3B modules to communicate between the RPIs over Xbee USB Development Shields. The Xbees show on the RPIs as /dev/ttyUSB0. I want to use the Xbees as a transportation layer to the RPIs, much like 802.11/15 or plain old ethernet would be used in a headless situation with bash. The Xbees are running at 115200 baud rate, and are named and setup via the X-CTU tool. I have no illusions of high speed data, but want to "see" RPI #2 terminal on RPI #1, the same as when SSH is accomplished with traditional transport layers.
I am able to use the Xbees in Transparent Mode, and send plain text with Screen, Minicom, "echo "text here" > /dev/ttyUSB0", and "cat < /dev/ttyUSB0". Despite the ability to pass messages, I want to use these plain text messages as bash input. For example, when I pass the command ls via any of the three methods listed from RPI 1, I want to have bash exectue "ls" on RPI 2, not just see it listed on the screen for RPI 2.
I've found several tools for Xbee, but don't want to wire up the GPIO pins and go that method; I want to use the Xbees as simple transport, nothing more. How do I pass text from /dev/ttyUSB0 to bash as a command, and see the results? Short of a more direct route, I'm considering using crontabs and an executable file that is erased and re-written to accomplish this task, but feel that is a last, very ineffective, method.
Is there some tool I am missing that does this already? Can I "screen" over a serial port as command line and serial I/O simultanously?
I found pyserial, which could allow for a TCP binding to the /dev/ttyUSB0 port, but am not sure if that is the right way to go or not. As of now, my code is as simple as
RPI #1:
echo "ls" > /dev/ttyUSB0
RPI #2:
cat < /dev/ttyUSB0
I was able to send and recieve commands from command line of a local (although remoted) XBee host to a remote (secondary, off net) Xbee host. I found the answer when I started looking at how serial devices could open a login terminal, and arrived at the getty tool. Here are my setup instructions for Transparent Mode use, I am still trying to get python-xbee and other tools to work to allow for the same concept, but via API mode. Note that the below instructions are a 95% solution, but should get the common user to a solid way ahead. I am not the original author of the steps below in their format, but found each step and combined them through various other Q&A forums to arrive at a solution:
First, acquire Digi Xbee X-CTU software (does not install on ARM devices such as Raspberry or Odroid):
XCTU:
Install from the following Digi.com link, but navigate to the corrresponding software FTP link:
https://www.digi.com/support/productdetail?pid=3352&type=drivers
Linux 64 Bit: ftp://ftp1.digi.com/support/utilities/40002881_R.run
Linux 32 Bit: ftp://ftp1.digi.com/support/utilities/40002880_R.run
Windows: ftp://ftp1.digi.com/support/utilities/40003026_T.exe
Mac: ftp://ftp1.digi.com/support/utilities/40003026_T.exe
Install X-CTU Via:
sudo wget ftp://ftp1.digi.com/support/utilities/40002880_R.run
sudo mv 40002881_R.run xctu_64bit.run
sudo chmod +x xctu_64bit.run
sudo ./xctu_64bit.run
Find X-Bee Device:
make sure Xbee is not plugged into a hub, power will be too little, recognizable via the below error, YMMV:
dmesg | grep ttyUSB0
and returning error: [ 228.800021] ftdi_sio ttyUSB0: failed to get modem status: -32
lsusb -v -d 0403:6001
sudo nano /boot/cmdline.txt
change the console tty device from AMA to USB, then for the kgdboc, which allows the remote end to watch the boot process, add/make match as appropriate
console=ttyUSB0,115200 kgdboc=ttyUSB0,115200
sudo nano /etc/inittab
make sure to uncomment (remove #) if present, change tty from AMA to USB
T0:23:respawn:/sbin/agetty -L ttyUSB0 115200 vt100
On Ubuntu x86 system, use X-CTU via
sudo ./XCTU.desktop
update firmware to the latest version
currently 8075 for the Pro S3B, then set baud rate to 115200 on each device
other xbees on in the vicinity can be updated by using a local xbee via X-CTU, then setting the api mode to “api mode with escapes”. Note that Transparent Mode should be used unless you have an indepth knowlege to make API mode work. I started with Transparent Mode to demonstrate the below works, but have since moved to API mode to gain the enhanced send-recieve control capabilities (pending a working version as of this writing).
do the same steps for all the devices that will be used on the network; once the local device is complete, other remote devices can be updated if visible (close enough).
Close out X-CTU and add the current user to the dialout group via:
sudo usermod -a -G dialout root
reboot then:
Setup Minicom Via:
sudo aptitude install minicom
minicom -s
serial port setup
a, set to /dev/ttyUSB0, then hit enter
e, set baud rate to 115200, then hit enter
hit enter again to close the window and arrive at the configuration page of minicom
select to save as dfl, followed by enter
then move to exit, and hit return
test connection to a locally connected device via
three plus symbols without hitting return
if it replies “ok” in a few seconds or less, all is well
OR Screen:
screen /dev/ttyUSB0
again, if you see a login prompt, you are connected. Note that screen is probably the best choice for most users; it has the inherent quality of ease of use (when compared to Minicom), handles low bandwidth connections with ease, and stays alive despite a disconnect from remote host. Ctl+a and then k will disconnect.
Install Coreutils to add more options than Minicom (Screen is also advisable):
sudo aptitude install coreutils && screen
stty -F /dev/ttyUSB0 -a
this will check serial port capabilities and settings
Communicate with your devices:
Note you interact with your network on a local machine with an X-Bee plugged in, or on a remote device you SSH over the internet, as long as it has an X-Bee attached. Also, note that the below settings to rc.local weren't keeping my settings after a reboot; this is a work in progress. I was setting them manually until I got automation worked out.
Also, I added rc.local to the RPI manually, the how-to for that is out there somewhere:
sudo systemctl stop serial-getty#ttyAMA0.service
sudo systemctl disable serial-getty#ttyAMA0.service
sudo systemctl enable serial-getty#ttyUSB0.service
sudo nano /etc/rc.local
add the below before exit 0
The stty line is twice because it has been noted that the first instance changes the reported baud rate to 9600, the second to 115200. If you are doing this manually, do a “stop” then re-do the start command to receive the prompt. This could be automated; I will update this post with a process monitor.
stty -F /dev/ttyUSB0 speed 115200 cs8 -cstopb -parenb raw
stty -F /dev/ttyUSB0 speed 115200 cs8 -cstopb -parenb raw
sudo systemctl start serial-getty#ttyUSB0.service
Then, use Minicom, Screen, or "cat" and "watch" to view messages sent. When using Minicom you will receive a login prompt via the above directions. As previously stated, I am still trying to get this working smoothly for API mode, but at least I know I have connectivity and can do basic command & control via the command line remotely with Transparent Mode, including running command line programs and commands. Transparent Mode does not offer any enhanced RF propagation correction techniques, hence my desire to get API mode working; RSSI values and error correction would be nice.

How to automate ISO installation (iDrac for DELL server)?

I need to automate ISO installation on Dell server. For such systems we have host itself and another ip for the iDrac management interface.
The flow that I need to automate is:
Connect a USB with ISO DD image to the system
reboot the host (can be done via ssh directly or from iDrac virtual console that connects to the host)
After the reboot, I don't have ssh connection to host but in the KVM (virtual console) I can still see the rebooting process and communicate with it. for example pressing F2 F11 etc.
Change the BIOS setup to start from USB and complete the installation by filling all required parameters.
For that purpose I tried using the pywinauto (we have a RobotFramework + Python2.7), but the problem that I'm facing that the KVM (virtual console) is recognized as one window (with no children or other controls).
So I can type keys like: ENTER SPACE Arrows(Up,Down,Left,Right) TAB F2 F11... but I'm not able to get or read the content of the console shown in the screen, what enforce me to use hardcoded steps and use sleeps between steps.
Something else that I thought that can help is connecting to the iDrac via SSH and with racadm api to try to get that content, but I couldn't find a subcommand that gives such information.
So am out of options, I know about other tool called Sikuli that works with image recognition which I used before to automate iOS and I found the reliability of it hard to trust so am not going to try it again.
Please advise if there is such a tool that can extract that console content.
BTW, the console can be opened with different plug-in types such: Native, Java, Html5 (only in iDrac 8+), even with Html5 the control that contains that console is a <canvas> that I can’t really extract anything from it (beside that I need to cover older versions of iDrac)
I work for Dell. There are a couple options. Simplest is to use remote racadm from your script. You can install racamd on any Windows or Linux machine. You can use racadm to dispaly boot order then change it and boot the host.
http://topics-cdn.dell.com/pdf/idrac7-8-lifecycle-controller-v2.30.30.30_Reference%20Guide4_en-us.pdf
racadm -r <idrac-ip> -u <user> -p <passwd> get BIOS.BiosBootSettings
racadm -r <idrac-ip> -u <user> -p <passwd> set BIOS.BiosBootSettings.HddSeq
racadm -r <idrac-ip> -u <user> -p <passwd> serveraction powerup
Other options are wsman and redfish you can learn about those on the Dell Tech Center wiki http://de.community.dell.com/techcenter/w/wiki
Place the desired ISO on a Windows share
Install racadm tools on your workstation
https://www.dell.com/support/home/us/en/04/drivers/driversdetails?driverid=8gmf6
In command line, give the iDRAC command to mount the shared ISO to the server where you want to install the iso content:
racadm -r remote_machine_iDRAC_IP -u idrac_user -p idrac_password remoteimage -c -u remote_share_user -p remote_share_passwd -l //remote_share_IP/iso/<iso_name>
Change boot order:
racadm -r remote_machine_iDRAC_IP -u idrac_user -p idrac_password remoteimage -c -u remote_share_user -p remote_share_passwd set idrac.ServerBoot.FirstBootDevice VCD-DVD
Use powercycle if machine machine is powered up, or powerup if it is powered down:
racadm -r remote_machine_iDRAC_IP -u idrac_user -p idrac_password remoteimage -c -u remote_share_user -p remote_share_passwd serveraction powercycle/powerup
When you connect to the iDRAC console it should boot (assuming the ISO is a bootable image) to the OS installation screen.
Do the installation and right before restarting it following the OS deployment disconnect the mounted ISO:
racadm -r remote_machine_iDRAC_IP -u idrac_user -p idrac_password remoteimage -d
selecting on f11 boot manager and then click on shot bios menu
and then selected bootable usb. it is doing automatic

disable ubuntu 10.10 screensaver using command

Does anyone know how to disable ubuntu 10.10 screensaver by just using command or edit conf?
because I can only ssh to the machine to turn the screensaver off
thx.
To disable the screensaver:
gconftool-2 -s /apps/gnome-screensaver/idle_activation_enabled --type=bool false
To disable monitor sleeping:
gconftool-2 -s /apps/gnome-power-manager/timeout/sleep_display_ac --type=int 0
The command to disable monitor sleeping has changed. You should now run:
gconftool-2 -s /apps/gnome-power-manager/timeout/sleep_display_ac --type=int 0

Resources