Archive for category Software

Xubuntu 16.04 LTS Bringup

Notes on updating my desktop Optiplex 980 from Xubuntu 14.04 LTS to 16.04 LTS, after being unable to compile OpenSCAD, Slic3r, and GNU Radio from source. Blowing three days on reconfiguration & tweakage after a clean install is the price one pays to get rid of a few years of cruft; the old version remains bootable and lootable on another partition, Just In Case.


  • nfs-common
  • xfce-goodies
  • hp2xx
  • xsane, xscanimage
  • kate (which hauls in a big hunk of wayland, alas)
  • digikam
  • chromium-browser
  • devilspie2
  • dropbox (from site)
  • remmina


The hacks required to ensure NFS mounts happen before signing in seem to be obsolete. Given that systemd now controls everything, I have NFI how to proceed if that’s not the case.

The Xubuntu load progress display looks like it’s scaled up from 640×480.

There seems no way to disable on-screen notifications without deep hackery; some of the collateral damage involves the death of the volume control applet in the indicator panel thingy, so I didn’t try very hard.

The aforementioned volume control now fires up the Pulseaudio control dialog. That display explained why the audio came out of the 980’s crappy internal speaker, but switching it to the HDMI output produced only silence. After blowing away ~/.config/pulse and rebooting that sucker, it’s all good: Linux audio remains a slow-motion train wreck.

The initial sign-on dialog appears on the portrait monitor, minus rotation, because the dialog box follows the mouse pointer: the initial mouse position sits one pixel beyond the landscape monitor. Blind-type the password, whack Enter, and it’s all good.

FWIW, I’ve installed the XFCE flavor of Mint Linux on the laptops, but that’s basically Xubuntu with (some of) the ugly sanded off and really doesn’t buy much for somebody who pays no attention to eyecandy.


Raspberry Pi Streaming Radio Player: Yet Another Cheap Wireless Keypad

One might think, just from looking, that this black wireless USB numeric keypad:

BonyTek Wireless USB Numeric Keypad

BonyTek Wireless USB Numeric Keypad

Was identical to the white keypads I already used on the streaming media players:

Wireless Keypad - colored labels

Wireless Keypad – colored labels

One would, of course, be wrong.

They both claim to be manufactured by “Creative Labs” with a 0x062a vendor ID, but with different model IDs:

  • White = 0x4101 “Wireless Keyboard/Mouse”
  • Black = 0x4182

Astonishingly, that model ID appears nowhere in Google’s search results, yet it actually works when plugged into my desktop PC.

The new model ID requires Yet Another Udev Rule in /etc/udev/rules.d/Streamer.rules:

ATTRS{idVendor}=="062a", ATTRS{idProduct}=="4182", ENV{ID_INPUT_KEYBOARD}=="1", SYMLINK+="input/keypad"

No big deal by now …

Leave a comment

Raspberry Pi Streaming Radio Player: Ignoring a Missing Volume Knob

The Dell AC511 USB SoundBars have volume control knobs, which this udev rule turns into the /dev/input/volume device:

ATTRS{name}=="Dell Dell AC511 USB SoundBar", SYMLINK+="input/volume"

I recently wanted to use an ordinary USB “sound card” that did not, of course, have a volume knob:

Sabrent USB Audio Adapter

Sabrent USB Audio Adapter

This hack skips the configuration that makes the knob’s events visible to the Python program:

import os.path

... snippage ...

# if volume control knob exists, then set up its events

VolumeDevice = '/dev/input/volume'

vp = select.poll()
if os.path.exists(VolumeDevice):
  v = InputDevice(VolumeDevice)
  vp.register(v.fileno(),select.POLLIN + select.POLLPRI + select.POLLERR)

It turns out that if you never register a device with the event polling interface, then the interface never reports any events and the rest of the code remains blissfully undisturbed: the non-existent knob doesn’t do anything, while the volume control buttons on the keypad continue to function as usual.

The end result of this fiddling puts a Raspberry Pi 2 Model B to work as a streaming player on my Electronics Workbench, untethering the laptop from those powered speakers:

RPi 2 Streaming Player - USB sound gadget

RPi 2 Streaming Player – USB sound gadget

It’s a shame that USB audio gadget is so big, because it crowds out standard USB plugs to the side.

The most satisfactory LED configuration for a translucent case with an external WiFi adapter seems to be:


The rest of the code remains unchanged as shown in that GitHub Gist.

Bomb the bass!



Loop Antenna Splice Reinforcement

Those solder joints and finicky little wires seem much too fragile on their own:

LF Loop Antenna - complete joint

LF Loop Antenna – complete joint

This should help:

Loop Antenna Splice - assembled

Loop Antenna Splice – assembled

Foam blocks hold the ribbon cable in place and provide a bit of strain relief around the hard plastic edge:

Loop Antenna Splice - hardware

Loop Antenna Splice – hardware

The brass inserts in the bottom block (on the left) got epoxied in place, because they must provide quite a bit of force to clamp the foam. Their larger knurled end sits flush with the outside surface and the smaller end has one thread thickness of clearance below the inner surface.

A last look at the wiring:

Loop Antenna Splice - wiring

Loop Antenna Splice – wiring

I think the preamp must sit at some distance from the antenna to prevent feedback, but that remains to be seen.

The M2’s nozzle accumulated a huge blob of PETG that turned into a giant smear:

Loop Antenna Splice - PETG booger

Loop Antenna Splice – PETG booger

Fortunately, it’s on the inside where nobody will ever see it. If you know where to look, it’s barely visible from the outside.

The solid model shows off the structure a bit better:

Loop Antenna Splice - show view

Loop Antenna Splice – show view

The inside view:

Loop Antenna Splice - bottom

Loop Antenna Splice – bottom

The OpenSCAD source code as a GitHub Gist:

, ,


Blog Backup

Recent news about Dropbox removing its Public folder feature reminded me to do my every-other-month blog backup. Wordpress provides a method to “export” the blog’s text and metadata in their XML-ish format, so you can (presumably) import your blog into another WordPress instance on the server of your choice. However, the XML file (actually, ten of ’em, all tucked into a paltry 8 MB ZIP file) does not include the media files referenced in the posts, which makes sense.

Now, being that type of guy, I have the original media files (mostly pictures) tucked away in a wide variety of directories on the file server. The problem is that there’s no easy way to match the original file to the WordPress instance; I do not want to produce a table by hand.

Fortunately, the entry for each blog post labels the URL of each media file with a distinct XML tag:


Note the two leading tabs: it’s prettyprinted XML. (Also, should you see escaped characters instead of < and >, then WordPress has chewed on the source code again.)

While I could gimmick up a script (likely in Python) to process those files, this is simple enough to succumb to a Bash-style BFH:

grep attachment_url *xml > attach.txt
sed 's/^.*http/http/' attach.txt | sed 's/<\/wp.*//' > download.txt
wget --no-verbose --wait=5 --random-wait --force-directories --directory-prefix=/where/I/put/WordPress/Backups/Media/ -i download.txt

That fetches 6747 media files = 1.3 GB, tucks them into directories corresponding to their WordPress layout, and maintains their original file dates. I rate-limited the download to an average of 5 s/file in the hope of not being banned as a pest, so the whole backup takes the better part of ten hours.

So I wind up blowing an extra gig of disk space on a neatly arranged set of media files that can (presumably) be readily restored to another WordPress instance, should the occasion arise.

Memo to Self: investigate applying the -r option to the base URL, with the -N option to make it incremental, for future updates.


Under-cabinet Lamp Brackets: Angled Edition

The LED strip lights have a reasonably diffuse pattern with an on-axis bright area that puts more light on the rear of the counter than seems strictly necessary. Revising the original brackets to tilt the strips moves the bright patch half a foot forward:

Kitchen Light Bracket - angled - solid model

Kitchen Light Bracket – angled – solid model

For lack of anything smarter, the angle puts the diagonal of the LED strip on the level:

Kitchen Light Bracket - angled - Slic3r preview

Kitchen Light Bracket – angled – Slic3r preview

The translucent block represents the strip (double-thick and double-wide), with a peg punching a hole for the threaded brass insert.

Although the source code has an option to splice the middle blocks together, it can also build them separately:

Kitchen Light Bracket - angled - LED block

Kitchen Light Bracket – angled – LED block

Turns out they’re easier to assemble that way; screw ’em to the strips, then screw the strips to the cabinet.

I moved the deck screw holes to the other end of the block, thus putting the strips against the inside of the cabinet face. It turns out the IR sensor responds to the DC level of the reflected light, not short-term changes, which meant the reflection from the adjacent wood blinded it to anything waved below. Adding a strip of black electrical tape killed enough of the reflected light to solve that problem:


Under-cabinet light - IR sensor shield

Under-cabinet light – IR sensor shield

The tape isn’t quite as far off-center as it looks, but I’m glad nobody will ever see it …

The before-and-after light patterns, as viewed on B-size metric graph paper centered on the left-hand strip and aligned with the belly side of the countertop:

Under-cabinet light - straight vs angled patterns

Under-cabinet light – straight vs angled patterns

Those look pretty much the same, don’t they? So much for photography as evidence for anything.

The OpenSCAD source code as a GitHub Gist:



Quilt Blocks: Scan and Montage

Mary has been working on the Splendid Sampler project, with 56 completed blocks (*) stacked on her sewing table. We agreed that those blocks would make a nice background for our Christmas Letter, but the labor involved to photograph all the fabric squares and turn them into a page seemed daunting.

Turned out it wasn’t all that hard, at least after we eliminated all the photography and hand-editing.

The 6½x6½ inch blocks include a ¼ inch seam allowance on all sides and, Mary being fussy about such things, they’re all just about perfect. I taped a template around one block on the scanner glass:

Quilt block in scanner template

Quilt block in scanner template

Then set XSane to scan at 150 dpi and save sequentially numbered files, position a square scan area over the middle of the template, and turn off all the image enhancements to preserve a flat color balance.

With “picture taking” reduced to laying each square face-down on the glass, closing the lid, and clicking Scan, the scanner’s throughput became the limiting factor. She scanned the blocks in the order of their release, while tinkering the auto-incremented file number across the (few) gaps in her collection, to produce 56 files with unimaginative auto-generated names along the lines of Block 19.jpg, thusly:

Block 19

Block 19

The “square” images were 923×933 pixels, just slightly larger than the ideal finished size of 6 inch × 150 dpi = 900 pixel you’d expect, because we allowed a wee bit (call it 1/16 inch) on all sides to avoid cutting away the sharp points and, hey, I didn’t get the scan area exactly square.

With the files in hand, turning them into a single page background image requires a single Imagemagick incantation:

montage -verbose B*jpg -density 150 -geometry "171x173+0+0" -tile "7x" Page.jpg

I figured the -geometry value to fill the 8 inch page width at 150 dpi, which is good enough for a subdued background image: 8 inch × 150 dpi / 7 images = 171 pixels. Imagemagick preserves the aspect ratio of the incoming images during the resize, so, because these images are slightly higher than they are wide, the height must be slightly larger to avoid thin white borders in the unused space. With all that figured, you get a 1197×1384 output image.

Bumping the contrast makes the colors pop, even if they’re not quite photo-realistic:

Quilt block montage - contrast

Quilt block montage – contrast

I’ll lighten that image to make the Christmas Letter text (in the foreground, atop the “quilt”) readable, which is all in the nature of fine tuning.

She has 40-odd blocks to go before she can piece them together and begin quilting, with a few other projects remaining to be finished:

Mary quilting

Mary quilting

(*) She’s a bit behind the block schedule, having had a year of gardening, bicycling, and other quilting projects, plus whatever else happens around here. Not a problem, as we see it.