Archive for December, 2006

Viewsonic G810 missing colors

Saturday, December 30th, 2006

Common failure point is Motorola MHW3628 triple CRT driver IC on the HV8SA neck board (big IC in blue package). To verify, swap colors at connections with video board. The IC is very expensive ($75) from parts vendors. The one purchased by “customer” turned out to be defective, but no returns were possible. With the “new” IC, the monitor would not power up if the neck board was connected. I ended up sourcing another used neck board for around $25 (make sure it is the same part number) and this worked in the end.

Replacing Hammond M2 run motor

Saturday, December 30th, 2006

So, I got this Hammond M-2 tonewheel organ in trade for some labor. The power cord was almost rotted off. So I replaced it with a generic power cord from local hardware store.

So, going to start it up finally, the starter spins but only catches about half the time. That isn’t the real problem though. After the starter catches, I turned on the run switch, and could hear the amplifier warming up. If I continued to hold the start switch, I could hear the tone generator but the sound was out of tune and sickly sounding. But if I released the start switch, the tone generator slowly ground to a halt with a gradually decreasing pitch.

Based on the M-2 reference manual and Hammond stuff on the web, I suspected a problem with the run motor. The run switch was working because the amplifier was coming on. No motor was seized because the TG shaft was spinning freely (and could be spun freely by hand).

I unplugged the power cord, removed four screws from the shield near the middle, and loosened four screws at the top of the shield, and removed the shield. The scanner (round thing with screws around the edge) and run motor are on the left. The run motor turns the scanner with a gear that penetrates the scanner housing. The run motor turns the tone generator shaft through a ball joint plate anchored by 2 springs to the tone generator’s flywheel.

To test the run motor, desolder the two wire pairs (rightmost terminal, and fourth rightmost terminal). Use an ohm meter across the two pairs. If the ohm meter reads zero, then at least one motor winding is shorted. If the ohm meter reads non zero, then your problem is elsewhere, perhaps bad solder at the switch or at the motor terminals. My ohm meter read zero, so I knew the motor was toast.

I acquired a used run motor for $20 on the HAMTECH list. When it arrived, I tested it to make sure it was not shorted, and then proceeded to install it.

I first removed the 4 nuts attaching the run motor to the floating TG cradle. Then I was able to disengage the run motor shaft coupler from the TG shaft and remove its two springs. Finally, remove 3 screws that couple the vibrato scanner to the run motor, and separate the two pieces, being careful not to break any oil wicks that are not already broken.

Now, what can be a real problem is those old oiling wicks. They are made of cotton thread and over time simply decompose. There are two wicks that enter the vibrato scanner housing, and one wick oiling the shaft on each side of the run motor. All of these wicks need to be intact, and have one end in the oil tub on top of the run motor. I repaired these broken wicks by going to the store and buying a spool of 100% cotton thread, then tying a piece of new cotton thread to the broken piece of wick. (This is easiest by first making a loop with the new thread, then placing it around the broken wick and pulling it taut.) Then, to get the wick into the oil tub through the passages, use a needle to start the thread into the passage, then a small straightened paper clip to finish ramming it through. Do not pull the knot into the passage.

Then finish reinstalling the 3 screws that couple the vibrato scanner to the run motor (installing the oil tub onto the new motor at the same time). Reinstall the run motor to the shaft coupler with the 2 springs, then simultaneously engage the coupler to the TG shaft while aligning the 4 run motor studs into the bracket holes. Push it together, and reinstall the 4 nuts.

Solder the run motor wire pairs to the same terminals you removed them from (the polarity is irrelevant). Use a low flux solder and make sure the terminal is thoroughly heated so you don’t get a cold solder joint.

Plug in the organ (being VERY careful not to stick hands, tools, etc into the exposed area since live AC is in there), and test it by starting it and flipping the run switch. Mine worked perfectly immediately. Reinstall the shield, tightening all the screws, and pat yourself on the back!

A resilient filesystem

Monday, December 25th, 2006

– Stable filesystem bookkeeping information should be replicated throughout the disk (such as ext’s backup superblocks).
– File UUID is updated for each file chunk whenever a new block is written.
– All file chunks should be tagged with metadata such as name, MIME type, and UUID, so that corrupted pointers do not prevent the file data from being located with a sequential scan.
– Each file chunk, as well as the entire file, has an embedded CRC that can be used in recovery as well as in detecting hardware (CPU, memory and/or disk subsystem) failure on the fly if enabled.
– User can choose the amount of parity redundancy.
– Data should be striped such that physical failure events are minimized by the parity information. Seek time profiling can be used to automatically determine the striping characteristics. This also ensures that a sequential overwrite does not lead to catastrophe.
– Directories point to files by UUID as well as by inode. Then directories can be reconstructed in a sequential scan.

Compiling a Linux kernel with distcc

Thursday, December 14th, 2006

Distcc with different architecture hosts

You may notice some strange problems when using distcc on mixed architecture machines. Especially when one of your machines is amd64 and the other i386. The object code that is output is mixed depending on what the output of gcc on each machine is, because distcc just calls the system gcc. Well, how can we make this more robust? In /usr/lib/distcc, there will be files named with GNU configuration strings such as /usr/lib/distcc/i486-linux-gnu-gcc. If you invoke make with CC=/usr/lib/distcc/i486-linux-gnu-gcc instead of CC=distcc, then distcc will only run this compiler if it exists. So this forces the remote hosts to have a correctly configured compiler for this build or they will reject the requests.

Distcc building a Debian kernel package

Here is how to use distcc to build a Debian kernel package using make-kpkg:

$ DISTCC_HOSTS="localhost remotehost1 remotehost2" CONCURRENCY_LEVEL=4
MAKEFLAGS="CC=/usr/lib/distcc/i486-linux-gnu-gcc" fakeroot make-kpkg \
--revision=1 --bzimage --initrd kernel_image kernel_headers

Comparison of Microsoft Dfs to AFS

Tuesday, December 12th, 2006


  • Both DFS and AFS use a volume location server to present many spatially-disparate server volumes in a single tree
  • Both DFS and AFS support strongly encrypted authentication methods

Benefits of DFS compared to AFS

  • DFS has full incremental snapshot capability instead of AFS’s single backup volumes
  • DFS client support is built in and supported by Microsoft on NT-based Windows; the AFS client must be installed and supported separately
  • DFS management tools are built in to Microsoft server operating systems
  • DFS-compatible SAN appliances are readily available
  • DFS has read-write (multi-master) replication and failover; AFS only has read-only replication (though DCE DFS, a derivative of AFS, has read-write replication)
  • DFS volumes can be manually parsed and checked using standard filesystem check tools; AFS uses its own file storage mechanisms (namei and inode) that require the AFS salvager to recovery and verify, and in which files and directories appear as nonsense to someone attempting data recovery

Drawbacks compared to AFS

  • AFS supports Unix-style symbolic links and same-directory hard links
  • AFS has a unified cross-domain namespace (/afs) and standardized AFSDB record to locate servers in other cells
  • AFS encrypts transmitted file data using ‘fcrypt’, a variant of DES
  • AFS employs a local file cache on the client machine; DFS does not, making it infeasible to run applications or directly manipulate data files that are stored on a network volume
  • AFS employs UNIX filesystem semantics with few exceptions (@sys, cross-directory hard links and device files unsupported); DFS employs Windows filesystem semantics, so UNIX applications cannot create case-differentiated file names, create files corresponding to MS-DOS devices (con, aux, prn, lpt[1-9], com[1-9], nul), or create files with reserved characters in the name (such as a colon character)
  • AFS users can create and manage their own ACL groups; DFS ACL groups can only be created by domain administrators

OpenAFS and NAT

Sunday, December 10th, 2006

The OpenAFS 1.4.2 client should be fairly NAT friendly. AFS only has UDP callback traffic unless you are using something experimental like Rx/TCP. Two ways to accomplish this:

Set UDP timeouts to a higher value:
net.ipv4.netfilter.ip_conntrack_udp_timeout = 480
net.ipv4.netfilter.ip_conntrack_udp_timeout_stream = 900

This sets a 15 minute timeout. 30 minutes is recommended if you continue to have problems with timed out connections.

Rewrite the client’s outgoing port 7001 traffic to a known “other” port that you assign.
For example, reserve port 7021 on the NAT box for this purpose. is the internal AFS client and eth0 is the external interface of the NAT box.
Send all traffic arriving from the outside server on the assigned port to the inside client on its standard AFS callback port (7001):
# iptables -t nat -A PREROUTING -i eth0 –dport 7021 -j DNAT –to-destination
Send all traffic destined to the server from the client out on the assigned port (7021) instead of port 7001:
# iptables -t nat -A POSTROUTING -o eth0 -s –sport 7001 -j MASQUERADE –to-ports 7021

Then set up Linux IP masquerading as usual. (This must be done after at least all of the above POSTROUTING lines, otherwise this rule will match first since it is more general, and none of the other lines will be used.)
# iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

Note: If you are hopping off someone else’s wireless router, make sure traffic destined for the assigned ports, or for port 7001, on THEIR external interface is also being forwarded back to your network’s NAT gateway. Traffic destined for the designated external ports has to somehow be able to reach the NAT box that you control so that you can rewrite the port numbers with iptables.

PCI logic analyzer

Monday, December 4th, 2006

This would be cool:

  • Debug misbehaving PCI bridges and unfriendly cards
  • Aid in reverse engineering of proprietary programming interfaces

Unix mail tips

Monday, December 4th, 2006

Some hints for using mutt, spamassassin, razor, procmail, formail:

  • To set up razor correctly, run razor-admin -create, razor-admin -discover, and razor-admin -register in that order.  Not doing this will result in a 202 error.
  • When delivering to a maildir or filtering mail with formail or some other stdin/stdout filter that does not otherwise create a file, the procmail recipe does not require a lock colon as in (:0:), only (:0).
  • Automatic expiration of list mail can be done by adding an Expires: header with formail.

How to implement tagged spamassassin reporting in mutt

Reporting each mail as spam individually in mutt is too time consuming because spamassassin must usually contact several servers, some of which may time out, and there may be 20 or more spams in your inbox if you have not paid attention to it for a while.

It is tempting to use mutt’s message tagging feature to tag several messages and send them all to spamassassin at once.

set pipe_split = yes
macro index S "<enter-command>unset wait_key<enter><tag-prefix-cond>
<pipe-message>spamassassin --report<enter><tag-prefix-cond>
<delete-message><enter-command>set wait_key<enter>"

(tag-prefix-cond is a relatively new addition to mutt that aborts execution of the rest of the macro if no messages are tagged.)

The problem with this approach is that the only thing that both mutt produces and that spamassassin can accept is a single message.  Setting pipe_split = yes in muttrc has the intended effect, that spamassassin is invoked once for each message.  But spamassassin is quite slow in this mode because it must establish a new session with each of the spam reporting servers for each piece of mail.  It is possible to background spamassassin, but without some form of external serialization, many spamassassins will be started at once, overloading the VM and competing for the write lock on the user’s Bayesian database.

Setting pipe_split = no (the default) causes mutt to concatenate all of the messages and pipe them to the program once.  But spamassassin can’t accept this input since it is not in a format that spamassassin recognizes.  Since spamassassin can accept an mbox as input, it is tempting to use something like

pipe_sep = "From abuse@localhost\n"

to emulate a mbox output.  But the first message is ignored by spamassassin, because no separator is placed at the top of the output.
This last problem can be addressed with a script like the following (mutt-sa-report).  It adds a From_ line at the beginning of mutt’s output.  After processing with this script, mutt’s piped output is now a mbox that spamassassin can recognize:

#!/usr/bin/perl --
use warnings;
use strict;
use File::Temp qw/tempfile/;
use Fcntl qw/SEEK_SET/; 
my $fh = tempfile;
my $back = "From abuse@localhost\n";
while (<STDIN>) { print $fh $back; $back = $_; }
seek $fh,0,SEEK_SET;
open my $sa, "| spamassassin --mbox --report" or die "Couldn't exec spamassassin ";
while (<$fh>) { print $sa $_; }
close $sa;
close $fh;
exit 0;

Now, this script can be called from mutt:

pipe_split = no
macro index S "<enter-command>unset wait_key<enter><tag-prefix-cond>
<pipe-message>mutt-sa-report >>/home/nemesis/Mail/logfile 2>&1<enter>
<tag-prefix-cond><delete-message><enter-command>set wait_key<enter>"

Look in logfile for the output of spamassassin. You should see “15 messages examined” or something to that effect. If so, it is working and you can remove everything but mutt-sa-report in between the pipe-message and enter tags.

Fix a dead TI-8x

Sunday, December 3rd, 2006

So you pull your trusty TI-83, TI-85, etc calculator out of the closet only to find that it is apparently no longer working. Powering on displays nothing on the screen. Changing the AAA batteries and the lithium battery improves nothing.

Before giving up and junking the calculator, there are two things you should try.

1. Adjust the contrast. For some reason, TI-8x calculators seem to be prone to having their settings corrupted and the contrast zeroed. This is probably the case if you can still communicate with the calculator through the parallel link. To adjust the contract, power the calculator on, then (blindly) hit 2nd, then hold down the up arrow. It should take about two seconds for the screen to become visible. If not….

2. Reset the calculator to factory settings. One way to do this is to remove one battery, and hold ON for 10 seconds. You can also remove all the batteries and wait several hours.

3. Reset the calculator using self test. Press 2nd, Mode, Alpha, A, Enter. This will wipe the calculator memory.

If for some reason you need to open the calculator to try component swapping, there are exactly three screws; two short ones at the bottom, and one long one for the lithium battery. After removing all the batteries, the calculator will pop open with some effort.

OPC power and dying/dead CD Recordable drives

Saturday, December 2nd, 2006

You might notice that one day you get the dreaded OPC Failed or Power Calibration Failed on your trusty CDR drive when no other software, hardware or media has changed. You go through several discs wondering what to make of this, then change to a different brand of media with the same result.

The laser diode in a CD drive has a finite lifetime during which the laser output for a given amount of power flowing through it will gradually decrease. The useful life of the laser pickup depends upon the average power flow through the diode; a high power flow accelerates the degeneration of the laser beam. Eventually, this renders the pickup unusable because the circuit has a laser power ceiling at which point it will refuse to increase the power through the diode any more so that it avoids immediately burning out the diode. If your deck has reached the laser power ceiling, but the laser output is still low enough to render your discs unreadable, it is time for a new deck.
A CD pickup has a compensation circuit that sets the laser power to the minimum necessary to get a clean read. The laser power is increased when the disc is dirty or the lens is dirty. Cigarette smoke and dust from a poorly sealing drive will dirty the lens and increase the average laser power, thus shortening its life.

You might notice that even though your burner no longer writes discs, it will still read them. This is because the laser requires far more power to write a disc than to read it. Therefore, a weak pickup (one which has a low laser output to laser power ratio) will very often still function as a reader even when it is no longer useful as a writer.

Another fact to note is that the laser requires more power to write reliably at higher speeds. This means that a higher average write speed will mean a shorter laser life. It also means that if you have a CD writer that is failing power calibration at its maximum write speed because it is nearing the end of its useful life, you may be able to get extended service from it by simply lowering the write speed. If the OPC passes at a given speed, it is quite likely that the disc will be successfully written.

Also, just because a disc failed OPC does not mean it must be discarded. CD recordable discs have 100 OPC segments. So a disc that fails OPC in one recorder can simply be reused in another one, or in the same recorder at a sufficiently lowered speed.