DVD Region Code Hell

So, I got this DVD and wanted to play it on a MacBook Pro (Mid 2009) - but what's this? A Drive Region chooser pops up, prompting me to set the "correct" DVD region for this DVD. And indeed, I've seen this chooser before and remember setting it to region 2 (Europe) a long time ago. Now this Drive Region window tells me that I have only 4 changes left, then the "region code" could not be changed any more.

What? I don't play a lot DVDs on this computer and while I've heard of "region codes" I thought this was a thing of the past and nowadays it was considered impractical to enforce or even honor this ridiculous craziness. Apparently not.

Of course, in most cases one can just kill the Drive Region chooser and use VLC to play the DVD, but this time VLC just couldn't play it. To put this stupidity to an end I decided to resort to more drastic measures. After all, I bought this DVD and I intended to buy even more DVDs, from all over the world - and I don't want to have to deal with shenanigans like "DVD region codes".

Searching the net on how to accomlish that brings quite a few results, but many of them are horribly dated (PowerPC Macs, remember those? :-)) or stop halfway how to actually get rid of this nonsense. After reading through a few related posts, here's how I did it.

We have to patch the firmware of the DVD drive our Mac was equipped with:

$ system_profiler -detailLevel mini | grep -A4 ^Disc
Disc Burning:
    MATSHITA DVD-R UJ-868:
      Firmware Revision: KB19
      Interconnect: ATAPI
Luckily, able people have already done this and provided tools and firmware images to accomplish this. Unfortunately, their links often lead to strange places and are not always accurate (any more). For your (and mine) convenience, I set up a small mirror site for these tools.

Grab MatshitaFlasher_0.6.zip and unzip it. The newer version, MatshitaFlasher.zip (Version 2.01) did not work and exited with:
  fatal: Selected drive (null) does not appear to be a matshita device
We also need the correct firmware for our device. In my case, I needed the one called UJ-868_KB19_Stock_RPC1 for this "MATSHITA DVD-R UJ-868" DVD drive. Grab it and unzip it.

With all that in place, we can finally start flashing. Make sure there is no disk in the drive!
$ unzip MatshitaFlasher_0.6.zip
$ cd MatshitaFlasher\ 0.6.app/Contents/Resources
$ unzip ~/UJ-868_KB19_Stock_RPC1.zip

$ sudo ./simple_flash 0 UJ-868_KB19_Stock_RPC1/KB19_rpc1.dat
compiled at Apr 14 2011 22:33:18
Selected device: MATSHITADVD-R   UJ-868  KB1
Continue? y
Finished

$ echo $?
0
The flashing took about 30 seconds to complete. Afterwards (and without a reboot!), the DVD could be played without the nag screen, just as I would've expected in the first place.