Flashing HHKB Jp Controller Mac Layout Hex

Having recently received Hasu’s fantastic HHKB JP Bluetooth Controller, I noticed one irksome thing: the alt and command keys were reversed on the left hand side, and the kana key that I typically remap to right command was reverted.

This is normal: the keyboard targets Windows users primarily, but one thing you lose when upgrading to the Hasu controller are the dip switches that allow changing the role of caps lock, the arrow keys and setting it to macOS mode.

The default HHKB layout without Hasu controller

The default HHKB JP OSX layout without Hasu controller – link

Of course it’s a pretty easy change to fix: you simply need to head over to the TMK Keymap Editor and edit the current layout, then download the hex file and flash it, but I’ve done the work, so I might as well share!

HHKB Hasu Jp OSX Layout

A layout that reverses alt and command and sets the kana key to right command for use with macOS computers

HHKB Hasu Jp Alternative Controller Layer 2

An overview of the second layer (layer1, counting from 0) used in the Hasu HHKB JP default layout

First off, as in other tutorials, you’ll need the DFU/AVR tools installed in OSX. This is accomplished by using Homebrew.

The code to get these installed is as follows:

brew tap osx-cross/avr
brew install avr-libc dfu-programmer

Next up, you’ll need to download the layout hex file that I have compiled here: “mac_version.hex“. If, for whatever reason, you need to go back to the default firmware, I have that compiled as well: default.hex. Remember to unzip these files prior to using them if Safari doesn’t automatically unzip your downloads.

Finally, put the keyboard in DFU mode by pressing the button on the back of the controller, where the dip switches used to reside. You may need to remove the cover to do so, and note that you can use the cover if you have short fingernails.

Once in DFU mode, this one-liner will erase the firmware, load the new hex layout and reset the keyboard so that you can use it once again. Note that I’m assuming your hex file will be in the Downloads folder in your home directory, and I’d also recommend having a spare keyboard handy in case anything goes wrong.

Bash script:

sudo dfu-programmer atmega32u4 erase --force && \
sudo dfu-programmer atmega32u4 flash ~/Downloads/mac_version.hex && \
sudo dfu-programmer atmega32u4 reset

Finally, if your layout is still a bit odd (underscore and pipe not working), you may have set the keyboard to the wrong layout. In Apple OSX this can be done by opening the keyboard section of the settings and changing the keyboard layout. Note that it doesn’t really matter that ANSI is suggested when you hit shift+z, shift+?, but that you select JIS once completed, like so:

Open the keyboard panel in System Preferences, then click “Change Keyboard Type…” on the bottom left

Click continue (or press return) to start the detection wizard

Press shift+z, then shift+? as instructed

Select the JIS radio button, even though it defaults to ANSI

RSync Files to a Unix/BSD Backup Device from your Mac Laptop

My photo-taking workflow while on vacation usually involves taking a lot of photos daily, dumping them to a laptop, processing, then backing them up once I have returned home.
Previously, I accomplished this manually using BeyondCompare for Windows, as that would run on Windows Home Server.
Since moving to ZFS-based storage, however, this is no longer an option as BeyondCompare only has a Linux client (nothing for Unix/BSD).
There are other ways to get around this:

  • SSHFS and Meld – Complicated, somewhat bloated, but great BeyondCompare alternative
  • *Commander Utilities – Midnight Commander derivatives can accomplish similar tasks using the ctrl+x,d shortcut
  • Rsync – typically installed by default, easy to script

I chose Rsync as I wanted something more automated, but I do find myself using Midnight Commander from time-to-time to simply “get things done” when syncing files other than my images.

Here’s how I did it:

rsync -a -e ssh /volumes/PICTURES/ 'username@mymac:/Volumes/BIGRAID/'

Let’s break this down into smaller pieces:

rsync – this is the command that will do our heavy lifting and file comparison

-a – archive mode

-e – specify an RSH replacement

ssh  – use SSH

/volumes/PICTURES/ – this specifies the “Volumes” folder on my Mac, and the “PICTURES” drive within it. Replace this with the location of your items to backup

 – note the use of single quotes here. We’re using these in case there are spaces in the folder names, and we could have done the same above.

username@mymac – We’re logging on to the host “mymac” with the username “username”. You’ll probably want to change these. I use a hostname here, but you could just as easily use an IP address if you use static IP addresses.

:/volumes/BIGRAID/ – the colon denotes a subfolder on the server we are backing up to, and /volumes/BIGRAID in this case refers to a ZFS pool called “BIGRAID”.

Do you have a similar backup strategy for BSD/Unix targets that you would like to share?

Macbook Pro 15″ i5 Unibody Upgrades

I’ve finally purchased a MacBook Pro, and things are going pretty well. Most of my work these days involves using servers for heavy lifting, but I still use Windows 7 from time to time, and Lightroom 3 almost all the time.

Unfortunately, Lightroom 3’s catalog is essentially a database of photos, and the more you put in it, the more slowly it will run. In this case, the MacBook Pro’s stock 320GB 5400 RPM hard drive just isn’t cutting the mustard. Simple actions like scrolling through images from the last import can be painful. Using Firefox or Chrome while importing makes everything crawl, and I’m forced to look for entertainment in Meat Space. The horror!

I know, “it can’t be that bad” is what you’re thinking. It is. Imports can take up to an hour. While on vacation, the last thing I want to be doing is waiting for imports of photos I’ve already taken while I could be out taking more photos.

I mentioned the fact that I use Windows 7 on the MBP. This is via either Boot Camp or VMware Fusion (running the Boot Camp partition). Things work swimmingly in Boot Camp, but I really have to be careful in Fusion because many of the newer Mac applications are RAM-hungry, and you start paging to disk quickly. Since the disk is so slow, you’re at a standstill within minutes.

So the problem essentially boils down to two things, both of which could have been resolved at time of purchase had I looked into the specs a bit further.

  1. Not enough memory
  2. Hard drive too slow

Costs add up

The memory upgrade, direct from Apple, via their online store, is a whopping $420. The hard drive upgrade from 320GB 5400 RPM to 500GB 7200 RPM is $158. Together I would have shelled out $578 in order to get the system where I think it needs to be.

Enter the Apple Technician

In the not-so-distant past, I repaired Apple laptops for a certified depot. It used to be pretty difficult as some of the Mac laptops had an inordinate amount of screws of varying sizes and dizzying teardown diagrams. I would say I was competent, but it really wasn’t something enjoyable. That said, I have been out of the game for a bit, and things have seemingly gotten much easier for the majority of Apple laptops. Often, you can simply remove the bottom case to gain access to wireless cards, Bluetooth, SuperDrive, hard drive and memory. And such is the case with the Macbook Pro 15″ i5.

Using the diagrams found at iFixIt, I was able to confirm that only a little bit of work would be needed to perform the upgrades. That means I save money on labour, which isn’t cheap.

Price Comparison

I was able to source hard drives at the 500GB capacity ranger running at 7200RPM for very cheap. I’d be looking at around $80, worst case. But being spoiled on other computers running solid state drives, I thought I should look into the option of adding an SSD instead. Though they have come down in price, getting larger capacity SSD drives can run upwards of $400 easily. Ouch. I decided to settle on one of Seagate’s newly-released “hybrid” drives that combine 4GB of superfast SSD with 500GB of traditional rotating platter storage. This should hopefully give me the best of both worlds. The cost? About $140. That’s definitely a few dollars less than the “off the shelf” Apple price, though it’s also double the cost of a typical 500GB 2.5″ hard disk. But speed is the issue to address, and I’m confident the HDD will address that. My only concern will be the speed of the platters may produce noise.

The memory for a MacBook Pro i5 is slightly harder to find. It took some poking around to find the exact speed and latency of the chips, as I want to make sure the logic board won’t complain, and no unforeseen issues would be introduced. After looking at Kingston’s website, I was able to deduce that the full specifications of the RAM are as follows:

  • Format – 204 pin SODIMM
  • Speed – PC3-8500 / DDR3 1066MHz
  • Latency – 7-7-7-20

This is not cheap memory. We’re talking high speed, high density, low latency RAM. After searching high and low, I came across some Mushkin RAM that was Mac certified. I wasn’t even aware that Mushkin made Mac certified RAM, but boy was I happy. The cost for an 8GB pair of 4GB SODIMM modules was only $260! In case you’re interested, the part number is “996644”, and I still don’t see a better deal from ANY vendor for memory this fast with timings this tight. Even for PC.

Our current total is sitting at $400. That’s less than even the RAM would cost from Apple.

Going Forward

Not to miss any opportunities, I decided to go one step further. Removing the memory and hard drive would leave me with spare parts. These could be sold on Craigslist locally for cheap, or I could re-use them. Use for the hard drive is pretty easy: Time Machine backup. A $20 external AcomData 2.5″ Ruggedized Samurai enclosure would fit the bill well, but the last thing you want to do on vacation is lug around cables and accessories. In my experience, they either get lost or forgotten (or both). This may not be the case for everyone, but I actually rarely use optical media. My data is transferred using USB sticks if I need to sneakernet, over wifi or LAN if I need to backup (and again to another location off-site to be safe) and when I do make audio “mixtapes”, it’s not often as I use an iPod for music.

So here I have a useless device taking up space in the laptop. Some digging, and looking at the tear-down told me a 2.5″ hard drive could fit in there easily. Excellent, a use for the old drive that takes up no extra space! Of course, like many good ideas I think I have come up with first, someone had “been there, done that” before, and you can buy full kits online for cheap. I found two companies that sell these: MCE and OWC. I opted for OWC because I really don’t have a need for the external optical drive that MCE throws in for “free”, creating a $20 difference in price as I have a Lacie DVD-RW already. Cost of this part: $80. (MCE’s is around $100 if you still might need that SuperDrive)

The total now sits at $480. More than the cost of the RAM, but still considerably less than the over $700 cost to have Apple do this at time of purchase. If you had messed up and bought the lower-end 15″ i5 Macbook Pro, there would also be at least an hour of labour on top. Typically that would run about $150.

I’m left with 2x 2GB DDR3 SODIMM modules, which might be hard to get rid of at any price, though they make a good upgrade for Mac Mini users. I’ve looked high and low for DDR3 SODIMM “RAMDisks” to no avail. I realize these aren’t the best devices, and never really had a following, but it would certainly be handy to have on one of the servers. One can only dream, I suppose.

So there you have it, cheap upgrade, easy install, no regrets. Preliminary testing tells me that the boot time has been halved, and Lightroom is much faster, though it’s not as fast as running it on my Mac Pro with SSD.

At some point I will probably look at replacing the second internal drive with a solid state boot drive when I replace the Intel X25-M G2 80GB in the Mac Pro with a SandForce SSD, and I will make sure to post some speeds when that frabjous day finally arrives.

Windows Home Server in VMware Fusion 3

I set off on a quest to get the home backup / media server / remote access solution Windows Home Server with Power Pack 3 running inside of VMware Fusion 3 running on top of Apple OSX Snow Leopard (10.6).

Why, you ask? Simply because I thought I could… A little while after downloading the Windows Home Server trial, it became apparent that there was no selection for this operating system. No matter, I thought, it’s based on Windows Server 2003, so I should simply be able to select that, right? Unfortunately not that easy. First, the hard disk type selected by default by VMware Fusion is SCSI. Without a driver disk (virtual floppy), you’ll have no luck. Also, the amount of memory available doesn’t meet the Windows Home Server requirements.

My method?

Try these settings:

– Windows Server 2003 Web Server

– No “easy install” settings

– 512MB RAM

– Remove the default HDD

– Add an 80GB IDE HDD

– Make sure the ISO is mounted

Things seem to be working at this point.

Hope this helps someone, I trawled Google and the Fusion forums with no luck.

Install Mac OS X Leopard on a G4 800mhz Quicksilver

If you have an old G4 sitting around that’s at the 800mhz mark, you probably should try installing Leopard, because most people agree it actually runs FASTER than Mac OS X 10.4 Tiger. Weird, huh? I guess they’ve optimized the code pretty well.
However, when you try to install the operating system, you are warned that Leopard cannot be installed on your G4. There are a few reasons for this:
1) Leopard requires 512MB of RAM – you have RAM, right?
2) Leopard requires over 867mhz processor

We can fix number 1 by simply getting more RAM. I find Craigslist to be of great use here. Number two is a bit more difficult as G4 processor upgrades are ridiculously expensive once you consider the cost of a Mac Mini, and also requires a bit of tech savvy under the hood as you’d be swapping CPUs.
Not to worry, though. Here’s a way to convince OpenFirmware that your CPU is 867mhz, and allow the installer to boot, install, and get you off and running:
Boot into Open Firmware, I have covered this extensively here:
Once in OpenFirmware, issue the following commands (for single CPU):
dev /cpus/PowerPC,G4@0
d# 867000000 encode-int " clock-frequency" property
boot cd:,\\:tbxi

For dual CPU:
dev /cpus/PowerPC,G4@0
d# 867000000 encode-int " clock-frequency" property
dev /cpus/PowerPC,G4@1
d# 867000000 encode-int " clock-frequency" property
boot cd:,\\:tbxi

Note that all we are doing is over-writing the CPU clock-frequency (speed) property for each CPU installed, at boot time.
Also, if you need to boot another device, try:
printenv boot-device
This will return a list of boot devices to use when booting the installer. I used this in order to boot a Firewire device that had had a disc image (DMG) restored to it, making things a bit easy and faster.

Good luck!

How do I install .kext files?

I hear this a lot, and I myself have also gone looking for it…

So without  further ado, here is the script that will install kext files for you – be warned – you’ll need to know how to get the kext file in the first place, as well as the filename.

Easy right?

Let’s get started.

Open the Terminal application by going to Applications / Utilities / Terminal.app – you will see it in the Utilities folder – it looks like a command prompt.

Once terminal has launched, type in the following command:

sudo -s

Enter the root or first user password that you inputted during the setup process.

This tells it to run any other commands after this one as the root or superuser account, allowing you to edit files you normally would not have permission to edit.

Here’s an example using IOATAFamily.kext, a popular ATA driver. You’ll want to replace this by your own driver name. Also, you’ll want to make sure the file is unzipped, and sitting on your desktop. Oh one more thing, you’ll want to edit YOURUSERNAME with… your username 🙂

mv /Users/(YOUR USERNAME)/Desktop/IOATAFamily.kext /System/Library/Extensions
chmod -R 755 /System/Library/Extensions/IOATAFamily.kext
sudo chown -R root:wheel /System/Library/Extensions/IOATAFamily.kext
cd /System/Library/Extensions
rm -rf Extensions.mkext
rm -rf Extensions.kextcache

Hope that helps!

Leopard Server on Leopard with VMware Fusion 2.0!

VMware has just announced support for their 61st OS supported by Fusion 2.0 – Mac OS X Server 10.5 (Leopard). This is great news for those looking to test things like the new Active Directory wizards, calendar server and enterprise blogging that come with the new version of the server. Not to mention that because it’s supported by Fusion 2.0, you can do it on your laptop.

Check out the full blog post on Fusion 2.0 Leopard Server support at the VMware VMTN blog site here.

Parallels Server Beta 2 Download

You can now register to download Parallels Server Beta 2!

From the announcement:

Key Features (Parallels Server Beta 2)

Hardware-optimized hypervisor-based virtualization solution.

Installable on host servers running Linux, Mac OS X and Windows, including the Windows Server 2008.

Bare metal version for non-OS server installation.

x64 (64-bit) and x86 (32-bit) host and guest OS support, including any combination of more than 50 different guest OSes in secure, high-performing VMs.

4-way guest SMP and multi-core support.

Integrated toolset includes Parallels Tools, VM backup and Parallels Transporter (the P2V migration tool).

Parallels Management Console, an easy-to-use, multi-server management tool is included.

Support for Intel VT-d hardware acceleration extension for hardware resource dedication to VMs.

Intel VT-x and AMD-V hardware-assisted acceleration support.

Open APIs and SDK for extensible management.

Command line interface (CLI) and scripting.

VMware Fusion 1.1.1 Maps Command Keys to Windows Control Keys

From the official announcement:

The VMware Fusion Team is happy to announce that VMware Fusion 1.1.1 is now available, addressing 15 issues reported by our customers.

VMware Fusion 1.1.1, a free update for current VMware Fusion customers and available in all the languages Fusion currently ships in, also adds a nifty new feature to transparently remap keyboard shortcuts when going back and forth between applications in the virtual machine and the Mac, regardless of what view the virtual machine is in.

For example, VMware Fusion now remaps Command –X from the keyboard to Ctrl-X in the virtual machine whether in Full Screen, Single Window or Unity. The same remapping happens for Command-Z/-C/-V/-P/-A/-F. Previously, VMware Fusion only did this remapping in Unity mode.

What this means to users, is that when copying something from the Mac side to paste into the virtual machine, and vice versa, you no longer have to remember “Is it Ctrl-V, or Command-V to paste here? Which machine am I interacting with?”

The effect is a more integrated blending of the two operating systems, so your Mac and Windows work together seamlessly, where the user only has to remember one set of keyboard shortcuts!

Keyboard remapping can be turned on and off in the VMware Fusion > Preferences dialog.