Over the years, I have build up several useful scripts to use on Linux systems. I'll try to document them here!
I have split this long page into several sub pages:
Any other unsorted stuff will be here!
Mount Seagate external drive without UAS
Normally, you can't run smartctl on a Seagate external drive since they use UAS (USB attached SCSI), which might make it a bit faster for planar drives, but smartctl doesn't support reading SMART data over UAS.
First, unmount and unplug the drive if it is in use
Then, remove the usb-storage and uas modules
sudo modprobe -r usb-storage sudo modprobe -r uas
(or alternatively, use rmmod)
sudo rmmod usb-storage sudo rmmod uas
Next, before you plug the drive in (which will auto-load uas), you need to load the usb-storage module with the quirk to disable uas for your Seagate drive.
To do this, get the vendor and product id by doing lsusb (the xxxx:yyyy stuff)
Finally, reload the module with the quirk as follows
sudo modprobe usb-storage quirks=0bc2:331a:u
Where the xxxx:yyyy is the vendor and product id for your drive, and the :u tells it to not use uas.
Map Wacom tablet to one display
By default, connecting a graphic tablet such as a Wacom will map the full resolution of the X11 window to the tablet. If you have more then one display, it will mess with the aspect ratio.
The solution is simple. If you are on X11, this can be done with xinput. You can also use xsetwacom with libinput.
First check the list of input devices by doing
This will return the list of input devices. You want to search for the one that is the pen or stylus for your tablet, as it is the one that send the mouse inputs. Copy the id of this device.
Since most devices have the work stylus, you can just grep for it
xinput list | grep "stylus"
Then, check the display name you want to map it to by running
or using a display manager of your choice.
Finally, to map the input to the display, run the following
xinput map-to-output <input> <display>
For example, to map input device 10 to display DVI-D-0
xinput map-to-output 10 DVI-D-0
Alternatively, on some systems, you can use xsetwacom to achieve the same thing if you don't use libinput.
xsetwacom set 10 MapToOutput DVI-D-0
Things that make you question why this was implemented.
Play music from motherboard speaker
Have you wanted to relive the experience of listening to music through a tin can or the audiophile grade (lol) 70v ceiling speakers installed at your old school? Well, the kernel has got the solution for you!
Some custom computers and most prebuilt computers have a small onboard speaker or buzzer on the motherboard. This is usually very handy for debugging as it can produce a range of tones to help troubleshoot problems. On Linux, the bell input and some escape characters normally trigger the buzzer. I also use the beep command to signal notifications with a range of tones. It's like the old RGB indicator on phones, where you can tell what program just fired a notification from the sound (like you could based on the colour of the LED).
Of course, people have already compiled a range of melodies for this, and you can find it here https://github.com/ShaneMcC/beeps
But, what if that's not enough, and you want to use the buzzer as a speaker? By default the kernel loads the pcspkr module for using the speaker/buzzer. There is however another module snd-pcsp that can mount the speaker as an ALSA output, allowing PulseAudio to use it as a sound output.
sudo rmmod pcspkr sudo modprobe snd-pcsp
Finally, bring up pavucontrol and enable the mono output. You mau need to unmute it first from alsamixer as well. Then, you can simply set a program like MPD to use it as an output and enjoy your music in what may be usable quality if your MB has a speaker, and horrifying quality that sounds like a dying fire alarm if your MB has a buzzer. (tip: change the base frequency to be above the range where you can hear it).
todo: attach a recording of the sound quality