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

Graphing CPU Temperatures in Linux

March 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

Hotsolder Forum

February 2nd, 2009 by wd5gnr

I get so many requests about the Puxing and other Asian radios I decided to open a forum up. While I was at it, I figured I’d put categories for the other Hotsolder  topics — let me know if you can think of others that make sense.

The truth is, I know from experience it is hard to grow a forum, but at least this will give a place where people can ask about the Puxing and other items and maybe someone else will have the answer (belive it or not, I’m no expert on the Puxing –  I just own one).

http://forum.hotsolder.com/

You don’t have to register for the most part, but if you do, I don’t do a thing with your e-mail address. Promise.

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 finacial calculator? I don’t.

It turns out though that HP has released the entire development package for the calculator hardware (here). 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:

  • 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

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. Click it and get a PDF of what you are reading.

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

A little wxWidgets demo

December 31st, 2008 by wd5gnr

I’ve used wxWidgets back when it was wxWindows but haven’t played with it lately. So I loaded up Code::Blocks (with wxSmith) and wrote a little game. The premise is “concentration” but instead of cards, the game loads up random images from Google based on your choice of keywords. It isn’t perfect. The search sometimes returns strange things (just like any search) and if you get the same picture twice (unlikely but it happens) it can be confusing.

Anyway, for a quick throw together its not bad.

Since wxWidgets is cross platform, the game ought to run under Windows as well as Linux (where I developed it).

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

Maximize Firefox Screen Space

December 31st, 2008 by wd5gnr

One of the things that makes Firefox a great browser is its extensions. If you want an extra feature you can add it to Firefox without having to rewrite Firefox. However, all those great extensions keep cluttering up your toolbars with more and more little icons.

The answer? Um, more extensions! Here’s how I get the most bang for my buck on Firefox screen space:

1) Install the Tiny Menu extension. This will collapse your menu to a single item (”Menu”) that then pops out the actual system menu.

2) Install the Searchbar Autosizer extension. This lets you make a smaller search box and then when you type it pops it out. In the Preferences, click Keep the same width all the time and then press Advanced. Check “Shrink seachbar to button if empty” and then press Add Button to Toolbar. Size the search bar dn then set the minimum and suggestion widths to the same as the maximum. Also check “Empty searchbar when a query is submitted.” Now you’ll have a button on your toolbar that expands to the searchbar when you need it.

3) Customize the toolbars so you wind up with one or two tool bars that have everything you need on them. With the menu and the searchbar shrunk, you can get a lot on there. Particularly if you select icons only and check the small icon box.

4) (Optional) If you want to auto hide your bookmarks toolbar, read this Lifehacker article. Personally, I keep folders in my bookmark toolbar folder and then fill the folders with RSS feeds (live bookmarks). That way the feeds I follow are always a click away.

Here’s what my toolbar set up looks like:

Firefox toolbar - click to zoom

Firefox toolbar - click to zoom

Note that I lied. My bookmark toolbar has a few non-folders on it (Hulu, for example). But most of them are folders containing live feeds.

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

Linux, Gambas, and Physical Computing

December 22nd, 2008 by wd5gnr

Creating embedded applications is easy using the GP3 — if you are a Windows users. But what about Linux?

The GP3’s always had a Linux library available (which was recently updated to make creating a shared library easier). And you can always use Java if you can get Java to work with your serial ports. But a Windows developer can always slap together something in Visual Basic in a few minutes with almost no effort.

This article shows you how to use Gambas, a Linux rapid application development tool, to work with the GP3. Gambas is a lot like Visual Basic, but in fact its better.

The GP3 support for Gambas includes a Gambas component so you can use the GP3 on Linux as easy as Windows user with VB!

The sample program flashes an LED and watches a PIR sensor to dismiss your computer’s screen saver when you approach the PC. Of course, that’s just a simple example. You can access all of the GP3’s analog and digital I/O functions easily with Gambas.

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

Java Browser Plugin for Linux AMD64 is Here

December 15th, 2008 by wd5gnr

Early release, it is true but it does work.

Download from here:https://jdk6.dev.java.net/6uNea.html

From a terminal:

cd /opt
sudo sh ~/jre-6u12-ea-bin-b02-linux-amd64-08_dec_2008.bin

# So you wind up with /opt/jre1.6.0_12

cd /usr/lib/mozilla/plugins
sudo ln -s /opt/jre1.6.0_12/lib/amd64/libnpjp2.so
# (restart firefox)

http://www.thinkfree.com finally works! Hoo ray!

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

« Previous Entries