Server Change

January 4th, 2010 by wd5gnr

The server that hosts Hotsolder (and AWCE and several other related sites) was due for a major overhaul and it got it. May still be some glitches here and there so either bear with us or report any problems you are having.

Happy New Year!

Add This! BlogLines del.icio.us Digg Diigo DZone Facebook Google Google Reader Yahoo! MyWeb Netscape Netvouz reddit SlashDot Sphere StumbleUpon Technorati

Velleman PCS500 Oscilloscope under Linux

December 29th, 2009 by wd5gnr
Velleman Software on Linux

Velleman Software on Linux

I like my Velleman PCS500. Its not perfect, but it does a good job and has been my “bench scope” for awhile now edging out my old faithful Tek scope for all but the most demanding jobs. However, there are two things I definitely don’t like about it. It uses a parallel port which many of my computers no longer have and the software doesn’t run under Linux.

When I built my last computer I stuck a cheap PCI parallel card in it. Of course, the PCI bus puts it at some wacky address like 0xE000 and most software can’t find it. I read this article: http://www.lafraze.net/nbernard/doc/misc_tips/velleman.html but it didn’t help either since the I/O wrapper won’t work on “high ports.” For the longest time I’ve just used an old Windows laptop as my “scope” and that’s worked ok.

But today I finally cracked the code to running the software under Linux (see the picture). Here’s what I did:

1) Set the permissions on the /dev/parport0 device to 666 (or you could add your user ID to the lp group and set it to 664 or 660):
sudo chmod 666 /dev/parport0

2) Create a new wine prefix:
WINEPREFIX=~/pcs500 winecfg

3) Inside winecfg set the default operating system to Win98. Close winecfg.

4) Run the wine regedit program. Create a key under HKEY_CURRENT_USER named Software\Wine\VDM\ppdev. Create a string value named 378 and make the value /dev/parport0. This must be under Current User and not System!

5) Download the PCLab2000SE software from Velleman and run setup like this:
WINEPREFIX=~/pcs500 wine setup.exe

6) Finish the install then run pcs500.exe from the ~/pcs500/drive_c/Program Files/Velleman/PcLab2000SE directory:
WINEPREFIX=~/pcs500 wine pcs500.exe

7) If you like, make a shortcut in your desktop software to launch this automatically.

I have noticed the software occasionally hangs up under Wine — don’t know if it is a problem with Wine or a problem with the software, but it doesn’t happen enough to be a problem.

Hope that works for you!

Add This! BlogLines del.icio.us Digg Diigo DZone Facebook Google Google Reader Yahoo! MyWeb Netscape Netvouz reddit SlashDot Sphere StumbleUpon Technorati

Kubuntu KDE4 Toolbar Icons for KDE3 Programs

December 17th, 2009 by wd5gnr

I noticed that a few programs (like kpdf, piklab, pikloops, etc.) were not showing icons in their toolbars. The common element seemed to be that they were all KDE3 programs and I was using KDE4. But that should work.

It took a little detective work, but here’s the solution: I had changed theme files and apparently most these have a missing line that enables this to work. In my case, I was using Nuvola, but the same principle will work with any theme.

1) Find the index.theme file for the theme you are using. In my case, it was in /usr/share/icons/nuvola/index.theme.

2) Edit it (you’ll need to be root — that is use sudo) to save it. Add a single line:

Inherits=hicolor

I don’t know that it matters where you put it as long as it is in the [Icon Theme] section. I put it right under DisplayDepth=32.

3) I don’t know if you have to reload the theme, but I did. I just picked another theme, hit Apply, and then picked Nuvolo again and hit apply. You also need to restart any programs that you expect this to fix.

4) Enjoy toolbar buttons with icons.

Add This! BlogLines del.icio.us Digg Diigo DZone Facebook Google Google Reader Yahoo! MyWeb Netscape Netvouz reddit SlashDot Sphere StumbleUpon Technorati

Linux Multimonitor Madness

November 29th, 2009 by wd5gnr

I’m addicted to having two monitors. It drives me crazy to go back to just one. Well yesterday one of my 19″ panels went white and stayed that way. Luckily with black Friday sales going on I was able to replace it on the cheap. However, most monitors these days are widescreen, so it takes a little getting used to. I replaced both monitors so they’d match (they were cheap) so my X screen is effectively 3200×900 now.

With all that real estate, I wanted some way to manage windows so they could be tiled effectively on one monitor (which is basically how I use two monitors; one app on one screen and another on the other screen). I’ve talked before about using wmctrl to script windows so I dusted off my shell programming skills and wrote “place”.It assumes your monitors are sitting next to each other (not stacked).

Place chops your screen up into 8 zones:

ABCD
EFGH

So your left screen is ABEF and your right screen is CDGH. You can also use 1 for the left screen and 2 for the right screen

How to use it: Run the script (hint: assign it a global shortcut key). It will prompt you to press OK and then click on a window. Click on the window you want to adjust, and the script  will prompt you to enter the grid letters. Enter them in order.

So you might enter A to get it at the top left or GH to get a double wide window at the bottom right. Or DH to get a double high window (the acronym is coincidental).If you enter CDGH or 2 the app will jump to the 2nd screen

What you need:

Stuff you can get out of the repos:  Bash (duh), zenity, xwininfo, gawk, and wmctrl. You also need to use a window manager that works with wmctrl (most do). The script picks up the reported size of your screens automatically. This could be a problem if you have two mismatched screens since I know at least TwinView (NVidia) reports a bigger size (so if your screens are 1600×900 and 1600×1024, TwinView reports 3200×1024.

Options (all optional):

-w 10 – Set width trim to 10 (adjusts the width down to account for decor)

-t 40 – Set height trim to 40

-i 0×4942 – Use window ID instead of prompting for window

-n ‘mywin’ – Identify window by title instead of prompting

Note: -n doesn’t work well when 2 windows have same title! Also, use -i -n or nothing but do not use -i and -n together

-x 1600 – Override screen width to 1600

-y 900 – Override screen height to 900

-s ABEF – Use placer string and don’t prompt

-r – Do not raise window

-q – Quiet (do not show intro dialog)

Here’s the script (or download it from here.

#!/bin/bash
# Dual Monitor Window placement script -- Williams alw@al-williams.com
# Version Beta 1, November 28 2009 - http://www.hotsolder.com

## This little script chops your screen up into 8 zones:
#  ABCD
#  EFGH
# (Obviously I'm assuming you have two monitors horizontally)
# So your left screen is ABEF and your right screen is CDGH
# You can also use 1 for the left screen and 2 for the right screen
#
# How to use it: Run this script (hint: assign it a global shortcut key)
# It will prompt you to press OK and then click on a window
# Then it will prompt you to enter the grid letters. Enter them in order.
# So you might enter A to get it at the top left or GH to get a double
# wide window at the bottom right. Or DH to get a double high window.
# if you enter CDGH or 2 the app will jump to the 2nd screen
#
# What you need:
# Stuff you can get out of the repos:
# Bash (duh), zenity, xwininfo, gawk, wmctrl
# You also need to use a window manager that works with wmctrl (most do)
#
# The script picks up the reported size of your screens automatically
# This could be a problem if you have two mismatched screens since
#  know at least TwinView (NVidia) reports a bigger size (so if your
#  screens are 1600x900 and 1600x1024, TwinView reports 3200x1024
# So you may want to override
# Also, you will want to trim down the exact values so the window edges
# and all fit. You can adjust WTRIM and HTRIM below or use the options

# Options (all optional)
# -w 10 - Set width trim to 10
# -t 40 - Set height trim to 40
# -i 0x4942 - Use window ID instead of prompting for window
# -n 'mywin' - Identify window by title instead of prompting
# Note: -n doesn't work well when 2 windows have same title!
# Note: Use -i -n or nothing but do not use -i and -n together
# -x 1600 - Override screen width to 1600
# -y 900 - Override screen height to 900
# -s ABEF - Use placer string and don't prompt
# -r - Do not raise window
# -q - Quiet (do not show intro dialog)

# TODO: Custom grid dialog to pick on a 4x2 grid
# I may do this with kdialog and/or pick zenity or kdialog depending on
# which is available

# max width and height trim down (adjust to suit)
WTRIM=40
HTRIM=40
PROMPTCMD=zenity
XWIOPT=
XWIARG=
CELLS=
NORAISE=0

# Max Width and Height
MW=`xwininfo -root | awk ' /^[ \\t]*Width:/ { print $2 }' `
MH=`xwininfo -root | awk ' /^[ \\t]*Height:/ { print $2 }' `

# process options
while getopts hw:t:i:n:qx:y:s:r o
do
	case "$o" in
	r) NORAISE=1 ;;
	w) WTRIM="$OPTARG" ;;
	t) HTRIM="$OPTARG" ;;
	i) XWIOPT="-i" ; XWIARG="$OPTARG"  ;;
	n) XWIOPT="-name" ; XWIARG="$OPTARG" ;;
	x) MW="$OPTARG" ;;
	y) MH="$OPTARG" ;;
	s) CELLS="$OPTARG" ;;
	q) PROMPTCMD=false ;;
	[?]|h) echo "Usage $0 [-x screen_width] [-y screen_height] [-w width_trim] [-h height_trim] [-i window_id] [-n window_name] -q" 1>&2
	exit 1 ;;
    esac
done

# Calculate Trimmed sizes
MWT=`expr $MW - $WTRIM`
MHT=`expr $MH - $HTRIM`

# Calculate 1 cell width and height and their trimmed versions
W1=`expr $MW / 4`
H1=`expr $MH / 2`
W1T=`expr $MWT / 4`
H1T=`expr $MHT / 2`

# prompt user so as not to confuse
if [ "$XWIOPT" == "" ]
then $PROMPTCMD --info --text 'Press OK and then select a window' --title 'Window Placer'
fi

# find out ID of window selected
if [ "$XWIOPT" != "" ]
then WID=`xwininfo $XWIOPT "$XWIARG" | awk '/xwininfo: Window id:/ { print $4 } ' `
else WID=`xwininfo | awk '/xwininfo: Window id:/ { print $4 } ' `
fi
if [ "$WID" == "" ]
then
	echo  "Unknown window" 1>&2
	exit 2
fi

# get position requested
if [ "$CELLS" == "" ]
then CELLS=`zenity --title 'Window Placer' --entry --text 'Your screens are divided into a 4x2 grid.
The top 4 cells are ABCD and the
bottom cells are EFGH. Or pick a screen (1 or 2).
Pick which cells you wouldd like for this window to occupy.

ABCD    -or-   12
EFGH' `
  if [ $? -ne 0 ]
  then
    echo Cancelled
    exit 3
  fi
fi

# Do the processing
case $CELLS in
[aA])
	X=0
	Y=0
	W=$W1T
	H=$H1T
;;
[bB])
	X=$W1
	Y=0
	W=$W1T
	H=$H1T
;;

[cC])
	X=`expr 2 \* $W1`
	Y=0
	W=$W1T
	H=$H1T

;;
[dD])
	X=`expr 3 \* $W1`
	Y=0
	W=$W1T
	H=$H1T

;;
[eE])
	X=0
	Y=$H1
	W=$W1T
	H=$H1T
;;
[fF])
	X=$W1
	Y=$H1
	W=$W1T
	H=$H1T
;;

[gG])
	X=`expr 2 \* $W1`
	Y=$H1
	W=$W1T
	H=$H1T

;;
[hH])
	X=`expr 3 \* $W1`
	Y=$H1
	W=$W1T
	H=$H1T

;;

[aA][bB])
	X=0
	Y=0
	W=`expr 2 \* $W1T`
	H=$H1T
;;

[bB][cC])
	X=$W1
	Y=0
	W=`expr 2 \* $W1T`
	H=$H1T
;;
[cC][dD])
	X=`expr 2 \* $W1`
	Y=0
	W=`expr 2 \* $W1T`
	H=$H1T
;;
[eE][fF])
	X=0
	Y=$H1
	W=`expr 2 \* $W1T`
	H=$H1T
;;

[fF][gG])
	X=$W1
	Y=$H1
	W=`expr 2 \* $W1T`
	H=$H1T
;;
[gG][hH])
	X=`expr 2 \* $W1`
	Y=$H1
	W=`expr 2 \* $W1T`
	H=$H1T
;;
[aA][bB][cC])
	X=0
	Y=0
	W=`expr 3 \* $W1T`
	H=$H1T
;;

[bB][cC][dD])
	X=$W1
	Y=0
	W=`expr 3 \* $W1T`
	H=$H1T
;;
[eE][fF][gG])
	X=0
	Y=$H1
	W=`expr 3 \* $W1T`
	H=$H1T

;;

[fF][gG][hH])
	X=$W1
	Y=$H1
	W=`expr 3 \* $W1T`
	H=$H1T
;;
[aA][bB][cC][dD])
	X=0
	Y=0
	W=$MWT
	H=$H1T
;;
[eE][fF][gG][hH])
	X=0
	Y=$H1
	W=$MWT
	H=$H1T
;;

[aA][eE])
	X=0
	Y=0
	W=$W1T
	H=$MHT
;;
[bB][fF])
	X=$W1
	Y=0
	W=$W1T
	H=$MHT
;;
[cC][gG])
	X=`expr 2 \* $W1`
	Y=0
	W=$W1T
	H=$MHT
;;
[dD][hH])
	X=`expr 3 \* $W1`
	Y=0
	W=$W1T
	H=$MHT
;;

[aA][bB][eE][fF]|1)
	X=0
	Y=0
	W=`expr 2 \* $W1T`
	H=$MHT
;;
[bB][cC][fF][gG])
	X=$W1
	Y=0
	W=`expr 2 \* $W1T`
	H=$MHT
;;
[cC][dD][gG][hH]|2)

	X=`expr 2 \* $W1`
	Y=0
	W=`expr 2 \* $W1T`
	H=$MHT
;;

*)
	zenity  --title 'Window Placer' --error --text 'Unknown position command'
	exit 5
;;  

esac

if [ $NORAISE -eq 0 ]
then wmctrl -i -R $WID
fi
wmctrl -i -r $WID -e 0,$X,$Y,$W,$H
exit $?
Add This! BlogLines del.icio.us Digg Diigo DZone Facebook Google Google Reader Yahoo! MyWeb Netscape Netvouz reddit SlashDot Sphere StumbleUpon Technorati

One-Der the 32-bit 1 instruction CPU

November 20th, 2009 by wd5gnr
.!.

I’ve talked a bit about One-Der my 32-bit CPU project before. It finally has seen the light of day.

Here’s the article in DDJ: http://www.ddj.com/embedded/221800122?pgno=1

And some more info: http://www.awce.com/classroom/course/view.php?id=11

And it got slashdotted!


Hands on with One-DEr

Here’s the simulator in action (actually the simulator has had a face lift and has more verbose commands and better output now):

Coming soon: A Forth compiler, interrupts, debugging support and more!

Add This! BlogLines del.icio.us Digg Diigo DZone Facebook Google Google Reader Yahoo! MyWeb Netscape Netvouz reddit SlashDot Sphere StumbleUpon Technorati

Graphing CPU Temperatures in Linux

July 12th, 2009 by wd5gnr

I recently changed motherboards and as always mounting the fan and heatsink on the CPU makes me feel stupid. I have a large non-stock cooler and it is always a struggle to make it fit with all the other things motherboard makers stuff near the CPU these days. After some busted knuckles, I thought I had it. But the temperature was a little high for my taste and seemed to climb for no good reason.

I looked at the setup and realized the plate that touches the CPU was off center. So I decided to remount it. Well, turns out there was a reason the plate wouldn’t center, but I eventually solved it. But all this has given me an unsual interest in temperature the last few days.

I won’t tell you how to set up lmsensors since there are plenty of good references on how to do so (a quick google on “lmsensors howto” shows lots of pages including this one. I even used ksensor (I use KDE) to give a nice display. I was thinking how nice it would be to automatically collect the data and graph it. Then I thought, well, why not?

I wrote a quick and dirty script — you’d need to change it for your setup. I have an AMD 5600+ (overclocked though), so when I run “sensors” I get several devices. The one I wanted was the k8temp-pci-00c3 which shows the two core temperatures. Unfortunately, it isn’t in a great format for processing:

k8temp-pci-00c3
Adapter: PCI adapter
Core0 Temp:  +38.0°C
Core1 Temp:  +36.0°C

But certainly awk is up to the challenge of fixing this up. Here’s the quicky script:

#!/bin/bash
#usage: tempdata delay file
echo Press ^C to exit
echo "Date/Time,Core 0,Core 1">$2
while true
do
   echo -n `date +%Y%m%d%H%M%S,` >>$2
   sensors k8temp-pci-00c3 | awk 'NR==3 { gsub/.C/,""); c1=$3; } NR==4 { gsub(/.C/,""); print c1 "," $3; } >>$2
   sleep $1
done

That does it. The long line that starts with sensors might not show up right, so here it is broken up:

   sensors k8temp-pci-00c3 |
     awk 'NR==3 { gsub/.C/,""); c1=$3; }
          NR==4 { gsub(/.C/,""); print c1 "," $3; } >>$2


You wind up with a file that looks like this:

Date/Time,Core 0,Core 1
20090312075009,+38.0,+37.0
20090312075039,+38.0,+37.0
. . .

So all that’s left is to plot it. I thought about using gnuplot, but figured it would be easier to import the data into OpenOffice Calc and plot it that way. In Calc, you can import a text file by using Insert | Sheet from File. Pick the file and use a comma as a seperator. Then its simple enough to select the data and use Insert Chart to make any sort of graph you like. Here’s a short run of my system going from idle to playing Urban Terror, which usually stresses it about as much as running Xilinx ISE on a big CPU design.

CPU Temperature Plot

CPU Temperature Plot

So there you have it. A classic example of using little Linux tools to create something bigger.

Add This! BlogLines del.icio.us Digg Diigo DZone Facebook Google Google Reader Yahoo! MyWeb Netscape Netvouz reddit SlashDot Sphere StumbleUpon Technorati

Setting Input Audio for VirtualBox (Linux)

April 28th, 2009 by wd5gnr

If you use VirtualBox to run things (like Windows) under Linux you know that its pretty capable. It can even map sound from the guest OS to the Linux ALSA system. However, the GUI only provides a way to use the same input and output device on the host OS. That’s a problem for me. I have a normal PCI or onboard sound card (I have both) that I use for output. But for input I use a USB microphone that has no output.

It turns out there is an environment variable for this. If you set:

VBOX_ALSA_ADC_DEV

you can select a different sound device for input. For example, my microphone is set to hw:3,0 (getting a USB device to come up as the same card every time is another post for another day). So before launching any VirtualBox I make sure to have this environment variable set:

VBOX_ALSA_ADC_DEV=hw:3,0

Works great!

Add This! BlogLines del.icio.us Digg Diigo DZone Facebook Google Google Reader Yahoo! MyWeb Netscape Netvouz reddit SlashDot Sphere StumbleUpon Technorati

The Finacial Calculator Every Engineer Wants

January 12th, 2009 by wd5gnr

I’ve owned a good many HP calculators in my day and still prefer my venerable HP41C over the many more modern calculators I own.  But I’m ready to buy an HP 20b Financial calculator. Why do I want a financial calculator? I don’t.

It turns out though that HP has released the entire development package for the calculator hardware (here

Washington Heights release

). So you can reprogram the calculator any way that you like. There’s even a Wiki

with details.

So for about US$40 you get an Atmel 32-bit arm processor running at 30MHz connected (portably) to a nice LCD display and a keyboard. You need a JTAG adapter and some free software and you are good to go.

Add This! BlogLines del.icio.us Digg Diigo DZone Facebook Google Google Reader Yahoo! MyWeb Netscape Netvouz reddit SlashDot Sphere StumbleUpon Technorati

I/O Scheduling Eleveator and Gambas

January 2nd, 2009 by wd5gnr

Gambas Program

I recently had to work with some very large files under Kubuntu 8.10 and found that when I was decompressing or copying these large files the system would become sluggish. Keep in mind this is with dual 3Ghz AMD cores and 4GB of RAM. The CPU load was almost nothing, but for some reason the disks were blocking the whole system.

Looking around, I wasn’t the only one to have this problem. It turns out Linux can use several I/O schedulers or “elevators”. The idea is to try to service disk requests as the heads go by instead of moving the heads back and forth for each request. There are 4 schedulers:

    I Capture the Castle movie

  • noop – Don’t schedule
  • anticipatory – Try to anticipate disk usage patterns
  • deadline – Service requests if they haven’t been serviced by a deadline already
  • cfq – Completely fair; this is the default in recent kernels

Razor’s Ring
Turns out the cfq scheduler is what was doing it — not sure if it is a bug per se or just some interaction with my hardware. Anticipatory worked best for me. There are two ways you might change the schedule policy. At run time you can send the right string to /sys/block/XXX/queue/scheduler (where XXX is the device name). So if your main disk is /dev/sda you might say:

echo deadline>/sys/block/sda/queue/scheduler

You can cat the same file to find out which one is current (it will be in square brackets). You can also edit your bootloader line to include the option elevator=XXX to set the system-wide default (XXX can be noop, as, deadline, or cfq — as is anticipatory).

I wrote a simple Gambas program using Gambas 2.9 to view and set the scheduler. It uses either kdesudo or gksudo to give you root privleges to write to the system file. I haven’t tried to distribute a Gambas program before — I know it depends on having Gambas in the system repositories and of the same version, so I’m not sure how useful it will be to others unless they are Gambas developers. None the less, I have a .deb file

and a source archive available.

Add This! BlogLines del.icio.us Digg Diigo DZone Facebook Google Google Reader Yahoo! MyWeb Netscape Netvouz reddit SlashDot Sphere StumbleUpon Technorati

PDF any Blog Entry

December 31st, 2008 by wd5gnr

If you go to the actual article for any of these blog entries there is a PDF button courtesy of http://web2.pdfonline.com

Moon the movie

Tristan + Isolde movie download
Deal rip

. Click it and get a PDF of what you are reading.

Fall release

Add This! BlogLines del.icio.us Digg Diigo DZone Facebook Google Google Reader Yahoo! MyWeb Netscape Netvouz reddit SlashDot Sphere StumbleUpon Technorati

« Previous Entries