Wednesday, May 24, 2017

Ubuntu 16.04 suspending from keyboard

I got tired of using the mouse to put the computer into suspend. Wouldn't it be easier to just hit a key on the keyboard?

So I found this webpage that gives you a command to suspend using keyboard shortcuts.

Just go to System settings/keyboard make a new custom shortcut, call it suspend and make the command "systemctl suspend".

I have a dell keyboard with a "music key" that doesn't seem to have any purpose (for me anyway) so I use that.

Works pretty well.

Thursday, May 18, 2017

Making ubuntu text black

I like my text black, so I had to find out how to make it so.

has a helpful post:

To change the system font color of the Ambiance theme from gray to black, you can edit these three files:


In these files change

text_color:#3C3C3C to text_color:#000000

fg_color:#4c4c4c to fg_color:#000000

This should greatly improve contrast and make applications' menu and dialog text much easier to read.

answered Apr 27 '12 at 23:15

note that the gtkrc is in the gtk-2.0 directory and Leafpad text wouldn't go black until I changed it.

gtk-color-scheme = "base_color:#ffffff\nfg_color:#000000\ntooltip_fg_color:#ffffff\nselected_bg_color:#f07746\nselected_fg_color:#FFFFFF\ntext_color:#000000\nbg_color:#F2F1F0\ntooltip_bg_color:#000000\nlink_color:#DD4814"

Wednesday, May 10, 2017

Optiplex 390 and Ubuntu 16.04 multimonitor problems

A simple idea in theory, 4 monitors simultaneously doesn't seem to work at all. The maximum I've been able to do is 3 monitors, 1 on integrated VGA port and 2 on Radeon 6350 VGA ports out of the DMS-59 dongle.

If I disconnect the integrated HDMI port, everything seems to work properly. (All three monitors come up.)

I'll lose the mouse pointer or one the screens will just freeze (though displaying a static frame of the desktop) or the screen will go weird, and the displays control panel will do crashy things if I have all 4 monitors connected and enabled. Often when configuring the displays the X server will crash and get relaunched so I have to type my password to login.

I sure wish that someday this linux multimonitor will get fixed so that it just works. I guess I'll be happy with 3 monitors. (but that fourth port just sits there and taunts me: "c'mon just try it one more time")

Optiplex 390 and integrated video with discrete video with Ubuntu 16.04

On the Optiplex 390, you CAN use the onboard video along with a discrete card (in my case, the radeon 6350).

You just have to go into the bios setup and enable the Multi-Monitor option under the Video.

If you plug in a single monitor to the onboard video with a discrete card installed and you haven't enabled Multi-Monitor, the computer will respond with "Unsupported Video Configuration. Unplug the cable and plug it into the video card instead. System halted".

The bios message for the Multi-Monitor option says "It should be enabled for Windows 7 32/64 bit. It is not applicable to other operating systems."

You can't even get into the BIOS without swapping the cable to the discrete card, though it will display the boot logo and this message.

So now I can do 4 monitors, 2 on the DMS-59 discrete card + 2 on the onboard video (HDMI+VGA) though I haven't actually hooked everything up yet. No desk space available for all of that yet. 4 monitors does take up a fair bit of room.

Without enabling the Multi-monitor, the onboard doesn't show up in the lspci.

lspci -nn

00:02.0 VGA compatible controller [0300]: Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller [8086:0102] (rev 09)
01:00.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc. [AMD/ATI] Cedar [Radeon HD 5000/6000/7350/8350 Series] [1002:68f9]

lspci -vv

00:02.0 VGA compatible controller: Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller (rev 09) (prog-if 00 [VGA controller])
DeviceName: Onboard IGD
Subsystem: Dell 2nd Generation Core Processor Family Integrated Graphics Controller
01:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Cedar [Radeon HD 5000/6000/7350/8350 Series] (prog-if 00 [VGA controller])
Subsystem: Dell Radeon HD 6350

Tuesday, May 9, 2017

Mame compile on Ubuntu 16.04 is pretty easy

I must be getting better at setting up compiling mame on a ubuntu 16.04 system because it seems pretty easy now.

I get the latest 185 version from

Look for MAME 0.185 sources in ZIP format (all platforms) and extract it with Archive Manager.

The instructions at:
tell you what you need:

sudo apt-get install git build-essential libsdl2-dev libsdl2-ttf-dev libfontconfig-dev qt5-default

and then I edit the makefile,

where the line says

# QT_HOME = /usr/lib64/qt48/

I just add this line underneath:

QT_HOME = /usr/lib/x86_64-linux-gnu/qt5/

I like to see how long it takes so I run with time and -j4 for 4 processes since I have a quad core machine:

time make -j4

and it fails for some reason at the end, probably some race condition:

Archiving liboptional.a...
Compiling src/mame/mame.cpp...
Compiling generated/version.cpp...
Assembler messages:
Fatal error: can't create ../../../../linux_gcc/obj/x64/Release/generated/version.o: No such file or directory
mame.make:295: recipe for target '../../../../linux_gcc/obj/x64/Release/generated/version.o' failed
make[2]: *** [../../../../linux_gcc/obj/x64/Release/generated/version.o] Error 2
make[2]: *** Waiting for unfinished jobs....
Makefile:1006: recipe for target 'mame' failed
make[1]: *** [mame] Error 2
makefile:1244: recipe for target 'linux_x64' failed
make: *** [linux_x64] Error 2

real 37m12.567s
user 91m59.028s
sys 6m14.188s

Running the make again is successful:

time make -j4
GCC 5.4.0 detected
Building driver list...
Compiling generated/version.cpp...
34200 driver(s) found
Compiling generated/mame/mame/drivlist.cpp...
Linking mame64...

real 0m45.262s
user 0m19.616s
sys 0m2.536s

It takes me 38 minutes to compile on a quad core i5-2400 (3.1ghz x 4)

An Intel Core i3-2100 CPU @ 3.10GHz × 4 gives takes about 45 minutes.

real 45m22.111s
user 162m59.016s
sys 8m59.484s

and ./mame64 will run the compiled mame.

Tuesday, April 25, 2017

The defrost timer was the problem

Well, crossing my fingers didn't work: the fridge iced up again so obviously more diagnosis was in order.

I figured out that there is an access to the defrost timer on the underside of the module that is attached to the ceiling of the refrigerator compartment. This allows you to manually turn the defrost timer without removing the whole module.

After turning it enough that I could hear a click, the fridge promptly would go into a defrost cycle.

The kill-a-watt told me that the defrost element uses around 460 watts, compared to 160 watts for running the compressor. The defrost cycle takes about .14 KWH (460 watts for 0.3 hour)

Also, when it is in defrost cycle, the compressor is disconnected, so you definitely know that it has switched over.

After 20 minutes the defrost thermostat shuts off, and power consumption goes to about 1 watt.

But the compressor never comes back online... after 20 minutes which is the normal cycle time, the timer is supposed to "click" and turn the compressor back on and shut the defrost element off.

Since the element heats up (if you put your hand in the back of the freezer compartment, you can feel the heat), and it's using 460 watts, we know the defrost element is good.

Since the element shuts off after 20 minutes, we know the defrost thermostat is working.

Therefore, the timer must be bad.

After searching ebay, I found a timer that matched specs (1/2 hp, 12 hour) and looked identical except for the model number, made by the same manufacturer.

In the week while waiting for delivery, I would activate the defrost cycle manually for 20 minutes once a day. (It's interesting that the element would run for just about exactly 20 minutes). I put a mirror up so I could see the little grey thing to turn. It's kinda tricky to get a screwdriver on it.

I just swapped the defrost timer and things seem to be working. Now when I open the fridge and put my head nearby and listen, I can hear the timer motor grinding slowly. Before, I heard no timer motor noise. (edit: I think the timer motor only runs when the compressor runs, so it's quiet when the compressor is shut off. I only heard the timer motor running while the defrost cycle was active.) So that explains why after exactly 12 hours the defrost cycle didn't initiate, it's 12 hours of compressor run time).

It was super easy to swap it out because it was identical in virtually every way, though the case on this one was opaque versus clear plastic.

It's pretty useful to have the kill-a-watt, if this fridge using more KWH than normal, around 1.5 KWH per day, you definitely know something's wrong.

Maybe I'll put some pictures up tomorrow when I feel more industrious.

Friday, April 21, 2017

So where does the PNP ID come from in the EDID?

Looking at the EDID, where is the manufacturer code and the monitor ID?

The wikipedia EDID article tells us that bytes 8-9 are the Manufacturer ID and bytes 10-11 are the product code.

8–9 Manufacturer ID.

These IDs are assigned by Microsoft, they are PNP IDs "00001=A”; “00010=B”; ... “11010=Z”. Bit 7 (at address 08h) is 0, the first character (letter) is located at bits 6 → 2 (at address 08h), the second character (letter) is located at bits 1 & 0 (at address 08h) and bits 7 → 5 (at address 09h), and the third character (letter) is located at bits 4 → 0 (at address 09h).
Bit 15 (Reserved, always 0)
Bits 14–10 First letter of manufacturer ID (byte 8, bits 6–2)
Bits 9–5 Second letter of manufacturer ID (byte 8, bit 1 through byte 9 bit 5)
Bits 4–0 Third letter of manufacturer ID (byte 9 bits 4–0)

10–11 Manufacturer product code. 16-bit number, little-endian.

So let's make a little LibreCalc spreadsheet and a function to get the bits:

function bits(value, lowbit, highbit as double)as double
  retval = 0
  for i = lowbit to highbit
    retval = retval + (value and (2^i))
  next i
  retval = retval / (2^lowbit)
  bits = retval  
end function

then a table from a1:31 with the numbers 1 to 31
a table from b1:31 with the formula =CHAR(A1+UNICODE("A")-1) in b1 and fill copy it to b31. I'm so used to using the ASC function but now I guess it has to be UNICODE.

and to see the bit patterns, why not fill c1:c31 with =DEC2BIN(A1,5) to pad it to 5 binary digits.

then to translate a 5 bit letter code to a letter, we go:


and to get the bits for a specific range let's use the bits routine:

=bits(number,14,10) for bits 10 to 14

Let's use cell f4 for our : 10ac

put a =HEX2DEC(f4) into g4

and the following into cell h4


And now you can convert that hex code to a manufacturer ID.

The product code is easy, just reverse the little endian:

So if your hexdump looks like this:

00000000 00 ff ff ff ff ff ff 00 10 ac 15 a0 35 34 38 36 |................|

10ac = DEL
15a0 = A015

for the PNP code of DELA015

And if you want to get rid of the lookup table, you can just compute it with another function:

function pnpletter(code) as string  
end function

which makes our cell h4 formula


It would have been neat to have it "human readable" without bit fiddling but I guess they wanted to save a byte here and there.