Posts

Linux and Logitech Unify Dongles

Image
Logitech Unify was a game changer, in relation to wireless input devices (keyboards/mice). The major problem with it is changing which dongle each of the input devices were paired with.   I have been using their combo keyboard/mouse package since it was originally released.  It works perfectly, but the letters on the keyboard keys keep rubbing off after too much use. This gets to the point of "How do you switch the keyboard" out with a new one?  On Windows and MacOS is easy.  Logitech provided software that can directly configure the dongle and what items are paired with it. Unfortunately, they never released anything for Linux.  I have been using Ubuntu for the longest time, so I will explain how to configure the dongles on Ubuntu 24.04. The first thing you need to find is a package named 'solaar' in PyPi. If you have a Python version installed, you can run the following command and it just works: pip install solaar I would su...

Bash, here-document and Python

Bash: Bourne Again SHell bash has the ability to create a document without having to write a file to disk.  This is done through 'here-document'.   The documentation can be found here:  https://tldp.org/LDP/abs/html/here-docs.html The basic syntax is: [n]<<[-]DELIMITER here-document DELIMITER The DELIMITER tells what identifier is the end of the document.  'EOF' is commonly used, as the example below. #!/bin/bash echo "Bash Start"; # Just grab the system version of 'python3', that is installed. # We do not want to assume a specific path or version of python3. PYTHON=$(which python3); cat <<-EOF | $PYTHON print("This is a test") EOF echo "Bash End"; I'm not going to get into the details, as there is a lot of documentation and examples out there. Check out some of the references below. REFERENCES here-docs documentation: https://tldp.o...

Bash and Compact Disc(CD) backups

 On the previous post, I went over how to automate copying floppy disks with only providing a Title (identifier) for the image created. This script is smiliar, but uses HandBrakeCLI to query the disc in the drive for the Chapters/Titles.  In this case, we are only querying the chapters in the Title 0 on the disc.  HandBrake has a GUI to do this manually. #!/bin/bash NAME="UNKNOWN"; function wait_for_cd_dvd_mount() { # Query the CD/DVD Drive to see if the disc is detected blkid /dev/sr0 2&>1; last_run=$?; # If blkid's exit code is not 0(Zero), then the disc detected while [[ $last_run -ne 0 ]]; do echo "Device not mounted. Waiting..."; sleep 1; blkid /dev/sr0; last_run=$?; done } function extract_videos() { # Query all CD/DVD Titles via HandBrakeCLI (-t 0 is to scan all titles) for TITLE in $(HandBrakeCLI -i /dev/sr0 --no-dvdnav -t 0 2>&1 | grep title | grep -v...

Bash and mass backup of floppy disks

 While dealing with cleaning out the family house, I have been tasked to backup all the pictures from floppy disks (3 1/2") and Compact Discs(CDs).  Thankfully I still had both a CD reader and a 3 1/2" Floppy disk drive to read them. As any sort of media goes bad over time, I first had to copy the contents onto my local drive before extracting and inspecting the contents of each.  This brings me to a problem with the 3 1/2" Floppy disks, as most of them had read errors on them.  This caused headaches when attempting to using a the standard COPY command. This is where I turned to my trusty friend ddrescue*.  This would allow me to copy the data into an IMG format, while retrying to all errors that come up while reading from the disk.   This brings me to attempting to automate the process.  A quick bash script allowed inputting of the title of the disk, along with looping indefinitely. This is a pretty simple script that requires 'sudo' access to ru...