Ryan Finnie

Big Brother in Motion

A few weeks ago, I installed a networked security camera overlooking the front yard. It performs three functions:

  1. It continually records a 640x480 10fps low-bitrate stream.
  2. When motion is detected, it saves a 2304x1296 20fps high-bitrate recording of the event. The camera can do 30fps, but only at 1920x1080 or lower, so lower framerate is an acceptable trade-off for a higher resolution.
  3. When motion is detected, it saves a series of three 2304x1296 JPEG images, one second apart each.

The motion detection normally activates when a car drives by, so most of the burst shot images were of a car at three different positions. I decided to average each of the sets together from a three day period, and the result was pleasing.

convert 00001a.jpg 00001b.jpg 00001c.jpg -evaluate-sequence mean 00001.jpg

From there, I converted the sets of averaged images into a video.

ffmpeg -framerate 5 -i %05d.jpg -c:v libx264 -profile:v high -crf 20 \
    -pix_fmt yuv420p -s 1920x1080 -r 30 output.mp4

The invocation converts the images into a 5fps video, forces yuv420p color (as the night shots were true greyscale), downscales to 1080p, and upconverts from 5fps to 30fps (as I wasn’t sure if YouTube would properly handle a 5fps video). The music was added post-upload from the YouTube audio library, and I’m very pleased with how well that track syncs up with the events in the video itself.

The input images were actually hand-curated a bit before making the video. I removed all images of me (walking to the mailbox, backing out of the driveway, etc) and all images where it’s unknown why the camera motion detection occurred (which are rare).

A large number of removed images were due to the separate security light underneath the camera, which has its own motion detection and is more sensitive and prone to false trigger, especially around dusk. The security light will turn on, causing a camera event. The camera will then realize it has enough light to switch from greyscale to color, causing another event. A few minutes later, the light will turn off; third event. The camera will switch from color to greyscale; fourth event. Repeat a few times until both the light and camera settle on “really, it’s dark now”.

Also of note is the first day was a rare day (for Northern Nevada) when it rained. A remote friend pointed out the craziness of it raining three times during a single afternoon, completely wetting the roads each time, and then completely drying out each time before the next rain. Yeah, that happens.

M.2 SATA SSDs on Mac Mini G4s

It’s 2017. I have two PowerPC G4 Mac Minis which have been in service since they were released in 2005. Long overdue for an upgrade. No, I’m not going to replace them. Instead, I’m giving them solid state drives.

My two G4 Mac Minis (leo and inez – the home network uses Futurama characters for a naming scheme) were released in 2005, and for the most part, they have been running 24/7 since then, usually for Finnix builds. One of the nice things about the G4 Minis is they are very power efficient for the period – about 12 watts at idle – so I treat them as always-on servers. inez is the more powerful of the two, with a 1.4GHz G4 and a 320GB 2.5” IDE HDD from an upgrade in 2010. leo is a stock 1.2GHz G4 and an 80GB HDD. Both have maxed out 1GB RAM.

But I’ve been thinking about their longevity lately, and not just because Debian and Ubuntu are dropping the 32-bit PowerPC architecture. Namely, their hard drives. IDE hard drives are not manufactured anymore, and they will eventually fail, being constantly spinning mechanical platters. I checked leo’s original 12-year old hard drive SMART data, and its seek failures were so high, I’m surprised it’s still running. inez’s upgraded hard drive is “only” 7 years old and looks to be in good shape, but it will fail someday.

So what other options are available? The drives are standard laptop-style 2.5” 44-pin IDE drives. SSDs really didn’t exist until the SATA era. CompactFlash to IDE adapters are available, but most of the ones I’ve seen are “loose” (not in a form factor emulating a standard physical drive size), and besides, CompactFlash is basically obsolete too. SD to IDE adapters exist and I’ve tried a few over the years, but compatibility tends to be terrible, and the interface is slow.

HP 15-f019dx

But the other day, I found something I didn’t expect to exist: an M.2 SATA (up to 2280 length) to 44-pin IDE adapter, housed in a 2.5” enclosure. And from what I read at the time, supposedly they worked well. They’re available from several outlets (Amazon, eBay, AliExpress, etc), but all appear to be the same base manufacturer. The difference is just price and how long you want to wait for them to arrive. I ordered two from Amazon, as well as two of literally the cheapest 128GB M.2 SATA drives available ($52 each on sale at the time).

Migrating the hard drives was a bit of an ordeal. The G4 Mac Minis have no room for expansion (the drive and a single stick of memory barely fit in the case as is). My first idea was to use a 44-pin laptop IDE to 40-pin regular IDE adapter I had, install it in an old spare x86 machine I had, boot Finnix, recreate the partitions and sync from machine to machine. But mac-fdisk is only available on PowerPC, so that was out. I could have done the same with a G4 tower, but that’s buried in a closet. What I ended up doing was 44-pin to 40-pin, then 40-pin to USB. The latter involved cannibalizing an old IDE CDROM to IDE enclosure, removing all but the PCB (because of the layout of the 44-pin to 40-pin adapter), but once I had that worked out, I attached the USB device to the Mac Mini.

Let me reiterate: at this point I was going from SATA to M.2 to 44-pin IDE to 40-pin IDE to USB.

The partitioning and syncing was relatively straightforward, but keep in mind for NewWorld PowerPCs, extra work is needed to make the bootstrap partition (#2) actually bootable, using hattrib to essentially do the following:

hmount /dev/sda2
hattrib -c UNIX -t tbxi :yaboot
hattrib -b :

Once the new drives were physically swapped in after the transfers (which is physically a pain on G4 Mac Minis), I checked them out. This is something I never expected to see from smartctl on a 12-year-old PowerPC:

Device Model:     ADATA SU800NS38
Rotation Rate:    Solid State Device
Form Factor:      M.2
ATA Version is:   ACS-3 (minor revision not indicated)
SATA Version is:  SATA 3.1, 3.0 Gb/s

I didn’t do tests on leo with its nearly-failing drive before swapping it out, but I did do bonnie++ on inez before. Mind you, before the upgrade, its hard drive was a 320GB Western Digital Blue drive from 2010; essentially one of the last and most modern 2.5” drives produced. And here’s the before/after with literally the cheapest M.2 SATA drive I could buy new:

Version  1.97       ------Sequential Output------ --Sequential Input- --Random-
Concurrency   1     -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- --Seeks--
Machine        Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP  /sec %CP
inez(old)        2G           35513  17 16987  11            46172  13 157.3   6
Latency                        2113ms    1488ms             68443us    1952ms
inez(new)        2G           87089  40 41527  27           102046  27  4145 178
Latency                         836ms     229ms              7650us    8976us

Version  1.97       ------Sequential Create------ --------Random Create--------
                    -Create-- --Read--- -Delete-- -Create-- --Read--- -Delete--
              files  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP
inez(old)        16 15257  77 +++++ +++ 20204  72 15349  75 +++++ +++ 19069  73
Latency               669us    1460us    1694us     691us     110us     671us
inez(new)        16 16910  85 +++++ +++ 22496  80 16591  82 +++++ +++ 21245  82
Latency               832us    1410us    1703us    9260us     120us     840us

I’m impressed. I expected the IDE interface to be a large bottleneck, so I didn’t expect those sorts of speed increases.

Side note: I bought two of the exact same drives. ADATA SU800NS38 128GB, same firmware (Q0125D), similar serial numbers. They both appear to perform about the same, but the raw disk sizes are different. One is 128,035,676,160 bytes, one is slightly lower at 128,034,594,304 bytes. Weird.

What would Brian Behlendorf do?

(With apologies to both Brian Behlendorf and Mr. Bad for the title.)

In 1996, the final official release of NCSA HTTPd was made, 1.5.2a. If you were born after 1996, just remember that there were web servers which came before Apache. Also, get off my lawn.

In 2007, I decided on a lark to get ncsa-httpd working on (at the time) modern Linux/GCC. It only took a handful of changes, and I packaged it up as an (unpublished) Debian package, ignoring modern FHS requirements and continuing to put everything under /usr/local/etc/httpd/, as it was in the 90s.

This evening, my IRC friend Screwtape posted a link he found about building a new Gopher search engine using 1990s technology, and that got me thinking about ncsa-httpd again. I went back to my project from 2007 and discovered it was no longer buildable on GCC 5, and with help from Screwtape, I got it building again.

HTTP/1.0 200 Document follows
Date: Mon, 22 May 2017 05:56:08 GMT
Server: NCSA/1.5.2
Content-type: text/html

After that, I continued on, finding a few bugs in the source code, fixing them, finding a few more, etc. After a few hours I stopped and realized what I was doing, and threw those patches out. I was literally reinventing the Apache project, 22 years too late.

I’ve made the patches required to build on modern systems available in this repository. And if you’re interesting in the Debian packages, they’re available as well.

Oh, and it should go without saying, do not use this in a production environment, on anything accessible from the Internet, etc. We’re talking about code which has been unmaintained for over 20 years, and has many known vulnerabilities.

Re-Buying My Childhood, Part 3: The Clone Wars

This is a continuation of my Re-Buying My Childhood series. Please see the previous two entries, eBay Does What Nintendon’t and Send in the Clones.

Donkey Kong Country Competition Cartridge SNES reproduction Ladies and gentlemen, the Donkey Kong Country Competition Cartridge (DKCC). One of the rarest and most expensive SNES cartridges in history, they now go for around $2000, and I own one. Look for the distinctive translucent red cartridge…

Nah, I’m just kidding. DKCC is a real game (though in a standard grey case), and it is one of the rarest and most expensive SNES cartridges in trade, but this is a reproduction.

DKCC was used in Powerfest ‘94, and the Blockbuster World Video Game Championships II in 1995. It’s a modification of the standard Donkey Kong Country game, with a number of changes for competitive play. When powered on, it goes directly into the first level rather than the title screen, and when you complete one level it immediately goes on to the next (all levels taken from DKC, but not in the same order). While DKC does not have a scoring system, DKCC does. Each banana or letter you collect, and each enemy you defeat gives you a certain number of points. There is a 5-minute timer, and when the timer runs out, the game simply freezes, so the score may be recorded.

Once the Blockbuster competition was finished, all the cartridges were recalled and sold through Nintendo Power. What makes me interested in DKCC is I personally competed in that Blockbuster competition back in 1995. I actually played one of those original cartridges. (I came in second place in the local store. I was bummed about that for years, until I found out recently that they didn’t have a regional round; they simply invited some of the highest scoring players to a national competition.)

I found a seller on AliExpress (the same who sold the Super Players Entertainment System clone) who offered reproduction cartridges for $18, and ordered DKCC. What arrived was a quite convincing physical reproduction… of the normal Donkey Kong Country, or at least that’s what it said on the label. I was about ready to write to the seller, but tried playing it first. Indeed, the actual game was DKCC, just with a wrong label.

I later found a US seller who produces custom cartridge shells and reproduction labels, though if you look closely, you’ll see he does put “REPRODUCTION LABEL” in the bottom left. I wanted my reproduction copy to look nice and have an accurate label, but at the same time wanted it to be clear this was a reproduction, so I chose a translucent red shell. (And, well, it looks awesome.)

See, there’s a forgery trade out there which makes near-perfect replicas of rare/expensive titles, and I wanted none of that. It makes it harder to verify you have an original (I closely scrutinized my $50 copy of Super Metroid to make sure it was authentic, since it was in suspiciously good condition) and hurts basically everyone. I don’t even know why most people knowingly buy them. I wanted DKCC because of personal nostalgia, but can’t justify paying $2000 for an authentic one. So owning a reproduction is fine, but I want it to be clear it’s a reproduction. Would I want to own a reproduction of, say, Stadium Events for the NES (which goes for over $10,000) if I were a real collector? Nobody wants that for the gameplay or personal nostalgia; only about 10 legitimate copies are known in the wild and it’s literally the same game as World Class Track Meet. I would know it’s fake.

The reproduction PCB itself is interesting. It consists of a MX29GL128ELT2I-90G 128 Mib flash chip, an unmarked QFP chip (presumably a microcontroller), a V62C318256L-35T 256 Kib SRAM chip, and a PIC 12F629 microcontroller (which emulates the SNES lockout chip). And, oddly, a populated CR2032 battery, despite the fact that DKCC has no save functionality. I originally feared that the ROM was stored in a large SRAM area and kept active by the battery, but now I assume the PCBs are assembled en masse (some games need battery backup, some don’t) and then flashed with individual ROMs right before they leave the factory. But I’m not confident enough to test this by pulling the battery.

Shantae GBC reproduction Shantae is another rare title, currently going for around $300 on eBay. Its rarity comes from being an obscure game at the time, released on the Game Boy Color long after the Game Boy Advance had been released, so very few were sold. I bought a clone of it on AliExpress for a few dollars, mainly because it’s a fun little platformer, not because I have any nostalgic attachment to it (I hadn’t played it until a few years ago on an emulator). And this clone could never be mistaken for authentic: the label is nice quality, but it’s in a red Game Boy cartridge (not even GBC), with “GAME” where “Nintendo” should be.

Super 3D Noah's Ark (post-2014 SNES re-release) Super 3D Noah’s Ark, a truly biblical Wolfenstein 3D clone. Literally. This game was notable for being the only unlicensed game released during the SNES’s original run. The developer, Wisdom Tree, started as Color Dreams in the 1980s and produced several unlicensed (agnostic) NES games, being able to defeat the NES’s 10NES lockout chip. Later, the company changed to Wisdom Tree, re-skinned several of its games and re-released them with Christian themes.

During the SNES era, its CIC lockout chip had not yet been cracked, but Wisdom Tree figured out how to bypass it, by producing a cartridge which resmbled an SNES Game Genie, with a standard connector on the bottom and a cartridge slot on the top. You plugged the Frankencart into the SNES, then plugged a licensed SNES game into it, and it piggybacked on the licensed cart’s CIC chip, and it was good.

So why would I buy a reproduction of Super 3D Noah’s Ark, 23 years later? Here’s the thing, it’s not actually a reproduction. Here in 2017, I walked to the (proverbial) store and bought a copy from a Wisdom Tree-authorized retailer. Wisdom Tree is still around, and in 2014 it resurrected Super 3D Noah’s Ark, licensing the distribution rights to Piko Interactive, which sells a digital version on Steam, but more importantly, an actual, physical SNES cartridge – albeit a standard grey SNES cartridge, without the need to plug another cart into it.

There’s been a bit of a holy war over the years regarding this game’s title, Super 3D Noah’s Ark or Super Noah’s Ark 3D, one which has not been solved to this day. The game’s logo is ambiguous, and could be interpreted as “Super 3D / Noah’s Ark”, or “Super / Noah’s Ark” with “3D” just placed in the top-right corner. Piko Interactive uses both on its web site, the Steam product page says Super 3D Noah’s Ark, while the spine of the modern cartridge’s label says Super Noah’s Ark 3D.

So again, why would I buy it? I don’t know, it’s interesting to own a new, immaculate copy of an SNES game which is an actual, licensed (just not by Nintendo) release in 2017. Do I need to conceive further reasons?

Super 54-in-1 SNES pirate cart The Super Players Entertainment System SNES clone I bought came with a 54-in-1 pirate cart (an actual cartridge as opposed to a built-in pirate ROM on the console). The physical cart is a perfect SNES cartridge clone, and the cart plays fine on both the clone hardware and the original SNES. There are no repeats and little shovelware, but I don’t have much interest in the games on it, with very few being repeats of real cartridges I own, and no Mario games. (I’m guessing they excluded first-party games to avoid Nintendo’s wrath.)

As I mentioned in my previous post, I’ve got an additional NES top-loader clone console on its way from China. That comes with a 154-in-1 pirate cart, but I don’t expect anything special from that. However, the seller includes a list of titles on the cart, and it’s actually a pretty good list. For example, it contains both Super Mario Bros. 2 and Doki Doki Panic (the original Japanese game which was ported to become SMB2). Oh, and the cartridge is white, not grey, which looks like it’ll be interesting.

Side note: Interesting seeing both 54-in-1 and 154-in-1 cartridges. Both 4 and 5 are considered unlucky in Chinese numerology; 4 can mean “death” and 5 can mean “not” and is unlucky by itself. However, according to Wikipedia, 5 can negate 4 so the number 54 is considered lucky (“not death”).

Re-Buying My Childhood, Part 2: Send in the Clones

In my last post, I detailed the last six months of re-buying my old Nintendo systems and cartridges, beginning with a Game Boy Color back in October, after watching a few videos online during the NES Classic Edition hype.

GB Boy Colour (Game Boy Color clone) Actually, a few details were left out. In truth, the Game Boy Color was the second console I bought in October, but the first I received. This was the video I watched which got me interested, a review of a clone system called the GB Boy Colour by Kong Feng. It’s a near replica of the Game Boy Color, but has a few notable enhancements.

I ordered it from AliExpress for about $30, and started the multi-week wait for it to arrive from China. … Then I got antsy and bought a real GBC locally the next week.

At first glance, the GB Boy Colour looks nearly identical to a real GBC. Placed next to one, you can see it’s slightly wider and taller, but without the comparison it’s almost impossible to tell. What is noticeable (but not terribly annoying) is the screen size. The diagonal size is the same as a real GBC (2.3 inches), but its aspect ratio is different, with graphics slightly wider and squatter.

But its other screen feature makes up for it: the screen is backlit. The Nintendo Game Boy, Game Boy Color and Game Boy Advance all had no backlighting, with the Game Boy Advance SP being the first to introduce a built-in light (albeit a frontlit screen). I owned an original Game Boy as a kid, and don’t particularly remember the lack of lighting being a problem. However, I briefly owned a GBA in the 2000s, and it was nearly unplayable. I had an external light attachment permanently installed, and even then, it would only work if you held the GBA at a certain angle. The backlight on the GB Boy Colour is nice and bright, and evenly illuminates the screen.

The GB Boy Colour’s D-pad and buttons are the same size as the GBC’s, and feel good. The D-pad’s shape is a little more rounded than the GBC’s square cross shape, but is enjoyable (perhaps even more so than the GBC’s). My only complaint is you can “bottom out” the D-pad, where it’s possible to press the middle of the cross and register all four directions at once. For me, this only tends to happen in frantic games which require a lot of movement changes, such as Operation C.

All of the GBC’s features are replicated on the GB Boy Colour, with one exception: the infrared port is missing, with a black window on the top going nowhere. But as very few games used the infrared port, I don’t miss it.

As far as I can tell, the console has full compatibility with GBC and GB games; all of the cartridges I own play perfectly. But when you turn on the GB Boy Colour without a cartridge inserted, it boots into a built-in pirate multi-cart. The title says “188 in 1”, but many of the games are repeats. The cart only contains 66 unique games, but this is reflected on the AliExpress page and the box. It’s got a good mix of popular (again, pirated) North American games, Japanese-only games and homebrew games. One thing to note is that, while the GB Boy Colour is a full Game Boy Color clone, all of the built-in games are original Game Boy Games (though a few games have GBC-specific enhancements, like Donkey Kong). All play perfectly, except for a few which expect a battery save feature (again, Donkey Kong) which is not present on the built-in ROM.

This console wasn’t bought as a novelty; I use it all the time instead of the GBC to play Game Boy games, as its extra features (namely the backlight) make it much better to play than the original.

Super Players Entertainment System (SNES clone) You would think I would learn from history, but no. A few months later, I came across the Super Players Entertainment System SNES clone on AliExpress. I ordered it, got antsy while waiting for it to be delivered, and bought a real SNES in the meantime.

Unlike the GB Boy Colour, there isn’t a huge reason to own this versus an authentic SNES. The console is modeled after the SNS-101 (“SNES Mini”), but is lighter then an authentic SNS-101, and much lighter than an original SNES. The plastic is not terribly thin, but again, thinner than an authentic model. Overall, its quality is acceptable, nothing to complain about, but not up to original standards. Game compatibility is 100%, as far as I can tell, and gameplay is identical to the original.

It lacks an RF out connector, but makes up for it with an S-Video connector in addition to A/V RCA. So if your TV has S-Video, this would make for a better video signal. The included controllers are decent, though the buttons are a bit stiffer than an authentic controller.

The biggest annoyance is the power connector, in that its barrel size is not the same as an authentic SNES. And, hilariously, the wall wart is branded Creative, and has a Europlug connector, despite this being an NTSC unit. I can see this playing out at the factory: “We need a power cable for this unit.” Reaches into box, pulls out random cable. “Yeah, this will work.” At least the wall wart supports 120v and the Europlug detaches to a figure-eight connector, so I can use it with a North American cable.

GamerzTek 8-Bit (NES clone) I bought my NES on eBay, and didn’t expect to also buy a clone. The problem is the NES doesn’t exactly age well. When the console arrived, I could only get a few games to play reliably on it. Cleaning the cartridge connectors helped a bit, I tried repairing the console’s 72-pin cartridge assembly , and even went as far as replacing the 72-pin assembly. But even after all that, reliability is more miss than hit. Top-loader NES units are supposed to be more reliable, but the NES-101 can be fairly expensive on eBay, so I turned to purchasing a clone.

The GamerzTek NES 8-Bit Entertainment System is hilariously tiny. But for $15, it’s hard to go wrong. It’s incredibly lightweight (the internals are literally an edge connector, an NES-on-a-Chip (NOAC) and a few PCBs to mount the ports and buttons), and it contains no extra features. Video output is mono A/V (no RF output). But it works well, with one moderate exception I’ll get to later. Every game I’ve thrown at it starts immediately, unlike the original NES in its current state, except for Super Mario Bros. 2 (and I think that may be a PCB problem with that specific cartridge). I’ve read that it has compatibility problems with a small handful of cartridges (which all NOACs seem to have problems with), but I don’t own any of the affected cartridges).

The bundled controllers are excellent, literally better than the originals in my opinion. Buttons are responsive and feel good, and the controller design is rounded (though not dog-bone like the NES-101’s redesigned controllers), and slightly wider than the original. Seriously, I love them. Of course, the GamerzTek console accepts all regular NES controllers, and likewise the GamerzTek controllers work on an authentic NES.

The biggest problem with the GamerzTek console is its sound. The audio has a constant buzzing, which is worst during black screens with no sound being played, and not as bad during gameplay and other audio playing. And the sound effects are off. The former is definitely noticeable, though you probably wouldn’t pick up the latter unless you already knew the game.

A minor annoyance, like the Super Players Entertainment System, is the power connector. As opposed to the SPES having a different barrel connector than the SNES, the GamerzTek does have the same barrel connector as the NES… but it expects 6 volts instead of the NES’s 9 volts. So not only can I not use an NES power brick on the GamerzTek, but I had to label the GamerzTek console and brick to make sure I don’t mix them with the NES.

This is my go-to console for playing NES games, not because it’s great (the audio issues are annoying), but because it works reliably. Coincidentally, between ordering this and it arriving, The 8-Bit Guy released a video on clone NES consoles which also featured the GamerzTek NES clone.

(I’ve got another NES clone on the way, a ZOGA NES-101 clone, though it’s being shipped from China so it’ll be a few weeks before I receive it.)

Cool Baby RS-36 (Famicom Mini pseudo-clone) The Cool Baby RS-36 is not a clone of the original Famicom; instead it’s meant to be a clone of the Famicom Mini, the Japanese equivalent of the now-discontinued NES Classic Edition. It’s smaller than an original Famicom, and a near perfect physical clone of the Famicom Mini.

I’ll admit, it’s damn cute. But beside that, it’s pure garbage. The controllers are tiny – at first I thought that was a design choice on the clone manufacturer’s part, but turns out the Famicom Mini also had smaller controllers than the Famicom, while North America got full size NES controllers with the NES Classic Edition. Sorry Japan, you got the short stick here. But these clone controllers are terrible. Fragile thin plastic, and button presses don’t register half the time.

This system does not accept cartridges. Instead, it has a built-in pirate cart advertised on the site as “400 in 1”, but the main menu says “500 in 1”. Of course, most are repeats; the actual count is closer to 200 titles, and most are cheap homebrew or shovelware titles. Very few well known (North American) titles, no Mario titles except for the original Mario Bros. (not Super Mario Bros.). On the other hand, if you like Contra, this is for you. Each title (Contra 1, 2, 3, 6, 8… wait a second…) boots into a sub-menu which has a bunch of cheat modifiers. Want to start on the 5th level with permanent Spread gun and 30 lives? This system has you covered.

I now have more clone consoles than authentic retro consoles. By why stop at hardware? Tomorrow, part three: The Clone Wars.