Saturday, June 16, 2018

xrandr: why not just have --setcvtmode 1920x1080@60

I have fiddled with xrandr a lot and I wish that it'd be easier to just specify a resolution and refresh rate in one line.

Something like

xrandr --output VGA-1 --setcvtmode 1920x1080@60

instead of having to do:


$ cvt 1920 1080 60
# 1920x1080 59.96 Hz (CVT 2.07M9) hsync: 67.16 kHz; pclk: 173.00 MHz
Modeline "1920x1080_60.00" 173.00 1920 2048 2248 2576 1080 1083 1088 1120 -hsync +vsync


then copying and pasting the modeline into xrandr --newmode

$ xrandr --newmode "1920x1080_60.00" 173.00 1920 2048 2248 2576 1080 1083 1088 1120 -hsync +vsync

and then adding the mode to the VGA-1

$ xrandr --addmode VGA-1 "1920x1080_60.00"

and then finally actually setting the mode

$ xrandr --output VGA-1 --mode "1920x1080_60.00"


You can do things like use awk:

xrandr --newmode `cvt 1920 1080 60 | awk 'NR==2 {for (i=2;i<=NF;i++) printf("%s ",$i);}'`
xrandr --addmode VGA-1 `cvt 1920 1080 60 | awk 'NR==2 {for (i=2;i<=2;i++) printf("%s ",$i);}'`

but why not have it all in a single command, and maybe have an option for trying it out and reverting to the previous settings in 10 seconds, in case your monitor doesn't like it.



something like:

xrandr --output VGA-1 --setcvtmode 1920x1080@60 --trymode 10

That would make it much less cumbersome. Why does it have to be hard?

Thursday, June 14, 2018

Mysterious unscannable barcode on my service tag

So I was fiddling with my barcode scanner and was scanning the barcode of my Dell Service Tag. There were actually two barcodes on the tag, one that would scan that was Code 128, and the other that would not.

I did some detective work and figured out the one that wouldn't scan must be Interleaved Code 2 of 5.

From the wikipedia page at https://en.wikipedia.org/wiki/Interleaved_2_of_5 I figured out how to manually decode it. It's actually pretty simple once you know that it encodes pairs of numbers, the widths of the black bars being the first number and the widths of the gaps being the second number.

Interleaved 2 of 5 has a start code of nnnn and stop code of Wnn which makes it a bit easier to spot now that I know what I'm looking for.

So for example the I2of5 barcode on my Optiplex 745 Desktop was "0019". Plugging that number into my Brother P-touch software and selecting I2of5 makes the exact same barcode.

But why wouldn't it scan?

I found a manual for my Symbol Spark and looked at its configuration barcodes, and enabled the I2of5 but it still wouldn't scan.

So I scanned the MIN Length I2of5 and then 0 and 0. (The Symbol Spark expects two digits when you scan the configuration barcodes and I was baffled why it wasn't working because I was only scanning a single number).

Now that I've got it configured correctly, the barcode scanner would scan those previously "invisible" barcodes.

Wednesday, June 6, 2018

Soundbar is so irritating

So I got a soundbar for my TV. It sounds great with deep sound, but it's kind of irritating too.

Sometimes I don't want the "full" sound experience, (like late at night) so I'll switch to TV speakers only.

It doesn't pass through the HDMI signal through unless I have the sound bar turned on and select HDMI on the sound bar.

So I'll have to turn it on, and then switch to TV SPK.

If I accidentally hit the channel change on the TV, then it switches the soundbar automatically to DIGITAL IN. So then you've got to switch the soundbar back to HDMI, and it takes a few seconds for the TV to lock on to the HDMI, then switch back to TV SPK.

When using the soundbar's DIGITAL IN, if you haven't got the TV speakers muted, there's a slight delay in the sound so you get that weird sound effect of multiple tvs on (like you're watching all the TVs at the target store). If I could just have a slight video delay on the TV to get things to match perfectly... You can add audio delay at the soundbar but that just makes the delay worse.

There's just too much switching and fiddling around. It's almost so irritating that I'm feel like pulling the sound bar. I just want everything simple. You turn it on, it works. And it's perfectly in sync.


It doesn't sound like much, just pressing a couple of buttons. It's the 100th time you do it and you wonder why it just doesn't work seamlessly.

Sunday, May 6, 2018

Switching the VT from the command line

Just for fun, I wondered how to change the virtual terminal from the command line.

You can switch with CTRL+ALT+F1 through F7 (or go as high as F12) but how do you do it with a command?


chvt will switch you to the virtual terminal.


So if you type this from an Ubuntu 17.10 terminal window:


sudo chvt 5; sleep 2; sudo chvt 2

That will switch you to vt 5, sleep for a couple of seconds, then switch you back to the graphics screen desktop on vt 2.

Silly fun!

What's kind of interesting is that if you do something like:


sudo chvt 5; date; sleep 2; date; sudo chvt 2; date


the system doesn't actually update the graphics screen with the output of the date commands until you have switched back to the graphics screen on vt 2.

Monday, April 23, 2018

Debian 9.3 weird video problem with ASUS Eee PC 701


I tried my USB Debian 9.3 32 bit hard drive install on my ASUS Eee PC 701 with a Celeron M 900mhz.

The LCD screen is so scragged that you can't see anything on it. It was broken like that when I got it.

So I have it hooked up to an external VGA monitor.

But when I boot debian 9.3 it comes up all skewy and shimmery and you can't read it at all. The computer's working, but you can't see what you're doing.

I can blindly type CTRL+ALT+F1 then my login name and password, then type "sudo reboot" and type my password again to get the computer rebooted.


If I go to grub and edit the boot parameters, I can add

video=800x600@60

and the system will boot up with a visible and normal screen.

I fired up an LXTerminal and did an xrandr to tell me what resolutions were available.

so I typed

xrandr --output VGA1 --mode 800x600

and then

xrandr --output VGA1 --mode 1920x1080

upon which the screen went crazy.

So I hit up arrow twice to bring back my 800x600 xrandr command and hit enter to execute.

By trial and error, I can go up to 1440x900 and also do 1280x720.

Anything higher and it's K-razy. 1600x1200 is a no go.

I made my own resolution at 1366x768 (though it bumped it to 1368x768_60.00) with

$ cvt 1366 768 60
# 1368x768 59.88 Hz (CVT) hsync: 47.79 kHz; pclk: 85.25 MHz
Modeline "1368x768_60.00" 85.25 1368 1440 1576 1784 768 771 781 798 -hsync +vsync
$ xrandr --newmode "1368x768_60.00" 85.25 1368 1440 1576 1784 768 771 781 798 -hsync +vsync
$ xrandr --addmode VGA1 1368x768_60.00
$ xrandr --output VGA1 --mode 1368x768_60.00



And what's weird with this system's bios is that the USB drive comes up as /dev/sdc2 so I have to change my root directory to /dev/sdc2 from /dev/sda2


so my command line looks like:

linux /vmlinuz-4.9.0-4-686 root=/dev/sdc2 ro quiet video=1280x720

Debian 9.3 weird video problem on bootup with ASUS 900A Eee PC


I decided to try my USB hard drive install of debian 9.3 32 bit on my Asus Eee PC 900A (which is an Intel Atom N270 @ 1.6ghz).

But weird things happen.


I have a 1920x1080 monitor hooked to the VGA and it has its own 1280x800 LCD.

If I don't specify a video resolution on the grub command list, it comes up as a black screen with just a mouse pointer.

The mouse pointer does weird things, being enclosed in a tiny rectangle on the upper left of the VGA monitor and when you move it it will go so far then magically pop up in the center of the rectangle.

But if I specify a video parameter e.g.

video=1920x1080@60

all is well. I get full HD on the VGA monitor. I think the LCD will go grey.

I tried

video=800x600@60

and

video=1366x768@60

and that works too. Or whatever your monitor supports.


So my grub command line (hit e when you see the grub boot screen, then F10 when you're done editing and ready to go)

looks like:

linux /vmlinuz-4.9.0-4-686 root=/dev/sdb2 ro quiet video=1920x1080@60


I also had to change the root parameter to /dev/sdb2 (it was /dev/sda2 but the usb drive comes up as /dev/sdb).

Oddly enough, on first cold boot it comes up as /dev/sdc. Each subsequent warm boot it comes up as /dev/sdb so go figure. Crazy bioses.



Sunday, April 22, 2018

Stupid bioses that won't boot Debian off an external usb drive


I have a usb hard drive that I've installed debian 9.3 on. It's pretty useful to boot off the usb, and I've been able to move the usb drive to different systems quite easily.


However, there are some bioses that are pure #%@#$@#%.

I tried it on an Dell Inspiron 530 and it boots up debian but isn't able to get past the fsck of the boot drive, throwing up weird errors like inode past extent. Which has been fine on a bunch of other systems.

The bios is 1.0.18 dated 02/24/2009.

The other k-rappy bios is on an HP 6742p. For some reason it doesn't want to boot, dropping me to a funny grub console


You'd think that they'd test this. Surely I'm not the only person who wants to run an os off a usb drive.

A couple of times I've had to edit the grub by hitting e upon the debian boot screen and change drives from /dev/sda2 to /dev/sdb2 or something like that.

Booting to a USB drive with debian just works on my Dell Optiplexes and about every Dell laptop that I've thrown at it. So it can be done.