Software Design Patterns For Real Hardware

Here on Hackaday, we’re generally designers of hacks that live in the real world. Nevertheless, I’m convinced that some of the most interesting feats are at the mercy of what’s possible in software, not hardware. Without the right software, no 3D printer could print and no quadcopter could fly. The source code that drives these machines may take months of refinement to flesh out their structure. In a nutshell, these software packages are complicated, and they don’t happen overnight.

So how do they happen; better yet: how could we make that happen? How do we write software that’s flexible enough to coexist peacefully on all sorts of hardware variations?

What separates the big open-source software projects like ROS, LinuxCNC, and Multiwii from the occastional hackathon code are the underlying principles that govern how they’re written. In object-oriented programming, these principles are called design patterns. In the next couple posts, I’m going to crack the lid on a few of these. What’s more, I’ll package them into real-world examples so that we can see these patterns interact with real hardware. The next time you pop open the source code for a big open source hardware project, I hope you can tease out some of these patterns in the code. Better yet, I hope you carry these patterns into your next robot and machine project. Let’s get started.

For readability, all of the examples run in Python3. The snippets below are truncated for brevity, but the real examples in the repository will work if you’ve got a similar hardware setup.

Continue reading “Software Design Patterns For Real Hardware”

Apple Passwords: They All ‘Just Work’

When the Macintosh was released some thirty-odd years ago, to Steve Jobs’ triumphant return in the late 90s, there was one phrase to describe the simplicity of using a Mac. ‘It Just Works’. Whether this was a reference to the complete lack of games on the Mac (Marathon shoutout, tho) or a statement to the user-friendliness of the Mac, one thing is now apparent. Apple has improved the macOS to such a degree that all passwords just work. That is to say, security on the latest versions of macOS is abysmal, and every few weeks a new bug is reported.

The first such security vulnerability in macOS High Sierra was reported by [Lemi Ergin] on Twitter. Simply, anyone could login as root with an empty password after clicking the login button several times. The steps to reproduce were as simple as opening System Preferences, Clicking the lock to make changes, typing ‘root’ in the username field, and clicking the Unlock button. It should go without saying this is incredibly insecure, and although this is only a local exploit, it’s a mind-numbingly idiotic exploit. This issue was quickly fixed by Apple in the Security Update 2017-001

The most recent password flaw comes in the form of unlocking the App Store preferences that can be unlocked with any password. The steps to reproduce on macOS High Sierra are simply:

  • Click on System Preferences
  • Click on App Store
  • Click the padlock icon
  • Enter your username and any password
  • Click unlock

This issue has been fixed in the beta of macOS 10.13.3, which should be released within a month. The bug does not exist in macOS Sierra version 10.12.6 or earlier.

This is the second bug in macOS in as many months where passwords just work. Or don’t work, depending on how cheeky you want to be. While these bugs have been overshadowed with recent exploits of Intel’s ME and a million blog posts on Meltdown, these are very, very serious bugs that shouldn’t have happened in the first place. And, where there are two, there’s probably more.

We don’t know what’s up with the latest version of the macOS and the password problems, but we are eagerly awaiting the Medium post from a member of the macOS team going over these issues. We hope to see that in a decade or two.

Debouncing The Old-Fashioned Way

If you were given the task of designing a computer at a time when computers weren’t really even a thing, how would you start? How would you take a collection of vacuum tubes, passive components, and a precious few germanium diodes and engineer something to sell to customers looking for an “electronic brain”?

Where there’s a paycheck, there’s a way, and computer archeologist [Ken Shirriff] laid his hands on some old IBM hardware that tells us a lot about how engineers thought in the earliest days of the computer industry. The gear is a pluggable module from IBM, one of hundreds that once went into their Model 705 computer from the mid-1950s. The particular module [Ken] has is a 5-channel contact debouncer, or in Big Blue’s mid-century parlance, a “Contact-Operated Trigger.” It was used to debounce five of the many, many mechanical contacts in the machine, both buttons and relays, and used eight dual triode tubes to do it. Other modules with the exact same footprint formed the flip-flops, inverters, buffers and clocks needed to build a computer.

[Ken]’s analysis of the debouncer is a fascinating look at what was possible with the technology of the day, and the fact that it led to a standardized framework for generic modules that were actually hot-swappable with what essentially was a zero insertion force plug was quite a feat of engineering. And as a bonus, [Ken] and friends actually got the module up in running in the video after the break.

Jonesing for more retro-computer pluggable goodness? Check out this reproduction IBM flip-flop module from the 1940s.

Continue reading “Debouncing The Old-Fashioned Way”