Jun 252008
 

Apple iPod Nano 2G Woe. My iPod Nano 1 GB is full. It is full of songs, and can’t hold one more. I’ve done everything I can to alleviate the situation, deleted random songs, albums, and podcasts, but to no avail. Clearly, the only proper solution is to get an iPhone. Because, you know, the iPhone has more storage space on it. That’s why I need one. But the iJuju will have to wait for my checkbook to reach Apple-compatible levels, no matter how many rationalizations I come up with for buying one.

Sansa e260 So, as a sort of nicotine patch for my iHabit, I recently bought a “throwaway” MP3 player, a refurbished Sansa e260 MP3 player ($45 including shipping from Woot.com). The e260 is a 4 GB iClone, with a shape, size, color, and button layout that are remarkably similar to my Nano, with the following exceptions–the e260:

  • Is about twice as thick as the Nano.
  • Is much heavier; 2.7 ounces versus the Nano’s featherlight 1.4.
  • Has a slightly larger screen, at 1.8″ diagonal 176 x 220 pixels, as compared to the Nano’s 1.5″ diagonal 176 x 132 screen. That’s enough to make Solitaire much easier to see on the e260.
  • Has the Play / Pause and Menu buttons reversed.
  • Has a light-up scroll wheel that actually turns.
  • Has an FM tuner.
  • Has a replaceable batter.
  • Has a slot for a microSD card, so that additional songs and videos can be stored there. Scroll down to read more about this.

It is otherwise a very faithful (if less elegant) replication of the second-generation Nano.

Overall, I am surprised and delighted to say that the e260, particularly when combined with the remarkable Rockbox F/OSS upgrade, is a great little player. With Rockbox installed, it can do everything the Nano can do, plus a lot more. My favorite things to do are to listen to a random selection of jazz while playing “Xobox” (a Qix clone), “Jewels” (a Bejeweled clone), or good old Solitaire. I can even play Doom, though the screen is a bit small to see exactly what’s going on.

There are, however, some major caveats.

Caveat #1: Officially, the e260 isn’t Mac-compatible. Sansa makes it extremely clear that the e200 series (which includes the e250, e260, e270, and e280, but no actual e200) are in no way compatible with Macintoshes, and that even contemplating putting both in the same room will lead to mass panic, fire in the skies, cats and dogs living together, and a world-ending event that would put the Large Hadron Collider to shame. Which is, of course, an open invitation to us Mac people to find out for ourselves. Clearly, the e260 appears to be a USB drive to Windows, so it probably will do the same for Macs, yes? Well, yes. Sort of. More about that under Caveat #3. (Note that there is a similar yet different e200R series, of which I know little except that they need additional tweaking to support Rockbox. And that they’re not Mac-compatible either.)

Caveat #2: You’re on your own. Which is to say, all the handy and useful Sansa utilties are Windows-only. For us iHeads, that’s business as usual, and no reason to get excited. Some sort of Windows capability (dual-boot via Boot Camp, virtualized Windows via Parallels or VMWare Fusion, etc.) is needed to run the Sansa utilities, mostly just to upgrade the e260’s firmware to the latest version. For Mac users who are comfortable with the UNIX command line, everything else can be done via the Mac. So, if you don’t care that your Sansa has old firmware, you can get by without needing Windows at all.

Caveat #3: The e260 does indeed show up as a removable USB drive on the Mac (on the Desktop as “Sansa e260″ and on the command line as /Volumes/Sansa e260), but it takes a little futzing. If you go into the Settings menu on the e260, there is a “USB Mode” setting, which by default is set to the Windows-friendly but Mac-hostile “MTP” mode. To work with a Mac, it needs to be set to “MSC” mode. In fact, my experience has been that both modes need to be used to get a reliable connection between my Mac and the Sansa. Here’s the dance that always works for me:

  1. Before connecting the USB cable between the Mac and Sansa, power up the Sansa. (If you’ve installed Rockbox, be sure to press and hold the “<<" button while pressing the Power button. Don't let the Sansa automatically turn itself on when you connect the USB cable. This is a complex tango and the Sansa will refuse to cooperate if you don't follow each step precisely and in order.)
  2. On the Sansa, go to “Settings”, then “USB Mode”, and select “MTP” (yes, the one that doesn’t work). Press the “Menu” button to leave “Settings”.
  3. Connect the Mac and Sansa with the USB cable.
  4. Wait a few seconds for nothing to happen. The Sansa will show “Connected”, but it won’t show up on the Mac.
  5. Unplug the USB cable.
  6. On the Sansa, go to “Settings”, then “USB Mode”, and select “MSC”. Press the “Menu” button to leave “Settings”.
  7. Connect the Mac and Sansa with the USB cable.
  8. Wait a few seconds. The Sansa should show “Connected”, then “Writing”. It’ll show “Writing” for the rest of the time it is connected. The “Sansa e260″ removable drive should show up on the Mac’s Desktop. If this doesn’t happen, start over from step 1. Don’t skip any steps.
  9. Drag files from the Mac to the Sansa drive, music into the “MUSIC” folder, photos into the “PHOTO” folder, videos into the “VIDEO” folder.
  10. When done, use the “Eject” icon next to the “Sansa e260″ icon in the Finder on the Mac to close down the connection.
  11. Disconnect the USB cable.
  12. The Sansa will probably restart and then do its “Refresh Database” navel-gazing.

Caveat #4: The Sansa really likes to do a “Refresh Database” operation every single time you add or delete any files from it. Every single time. The e260 will start up, show the “Refresh Database” window with a progress bar below it, and slowly do the update. Once you’ve got a few gigs of stuff on it, this will take over a minute. And will quickly transform from cute quirk into an annoying time-waster.

Caveat #5: Music from the iTunes store? Officially, no. You can transfer songs from the iTunes Store to your iPod, but not to the Sansa, because they’re in a M4P or M4A format that the Sansa can’t handle, and because they’re encrypted to protect them from Music Pirates, yarrr. However, the Sansa can handle standard MP3 files, and there are ways to convert the iTunes songs into generic MP3s. (Hint: iTunes can be set to burn playlists of songs onto a standard audio CD. This can be a good way to safeguard your iTunes investment by making a safety backup of your purchases. iTunes can also be set to import standard audio CDs into generic MP3 files. And those generic MP3 files can be copied from iTunes to other places on the Mac, like, say, removeable USB drives.)

Rockbox So, with the Sansa caveats out of the way, it’s time to look at Rockbox. Rockbox is, like many F/OSS efforts, both amazing and frustrating. It works very well, has a ton of features, and has a user interface that takes a bit of getting used to. Here are a few important things to know about the combination of the Sansa e200 series, Rockbox, and the Mac:

  • It’s easiest to use the Rockbox installer / utility and do a complete installation of Rockbox rather than to download the latest build of Rockbox itself and install it by hand. The installer will download and correctly install all of the zillion and one bits that make up the Rockbox universe, including all the themes (skins), fonts, games, everything. You can do this by hand on the Mac, but you’ll be downloading, unzipping, and copying a lot of files. The Windows version of the utility seems to work a little better than the Mac version, but they both get the job done.
  • Once you’ve installed Rockbox, the original Sansa firmware will still be on the e260. Rockbox doesn’t overwrite it, but does a sort of Boot Camp type of dual-boot. To cause the Sansa to bypass Rockbox and run normally do this:
    • Press the Power button to turn the Sansa off.
    • Press and hold the “<<" (Previous or Left) button.
    • While continuing to hold the “<<" button, press the Power button. The Sansa's screen will show the SanDisk logo, then turn white, then show a bunch of techie-looking text starting with "Rockbox boot loader", then will start up normally.
    • Release both the “<<" and Power buttons.

  • Rockbox is playlist oriented. Every time you select a song, Rockbox creates a playlist on the fly made up of the album that the song is part of. You can add songs to playlists and save the playlists right on the Sansa, but it’s kind of a pain to do. However, it is possible to create playlists using the Mac.
  • Rockbox uses the very simple text-based M3U format for playlists. Essentially, the M3U playlist file is just a list of filenames, one filename per line. You can edit an M3U playlist in TextEdit. The contents will look something like this:
    ./MUSIC/Eagles/Their Greatest Hits/Eagles—Tequila-Sunrise.mp3
    ./MUSIC/OMC/How Bizzare/02 How Bizarre (Mix).mp3
    ./MUSIC/Denis Leary/No Cure for Cancer/03 A_____e.mp3
    ./MUSIC/Elvis Costello/My Aim Is True/Elvis-Costello—-The-Angels-Wanna-Wear-My
    –Red-Shoes.mp3
  • To create a “master” playlist which contains every song on your Sansa, you can do this:
    • Start the Terminal app.
    • Type the following into Terminal, substituting “e240″ or “e280″ for “e260″ if you have a different model, and be careful to include the quotes and to make sure that the slashes all tilt the right way:
    • cd “/Volumes/Sansa e260″
      find . -name “*.mp3″ > all.m3u
      find . -name “*.MP3″ >> all.m3u

  • Now you can use the Finder to make copies of “all.m3u” (make sure to create the copies in the same folder on the Sansa as the “all.m3u” file, and not on the Mac), and edit the copies with TextEdit. For example, you can make a copy and call it “jazz.m3u”, then edit the “jazz.m3u” copy in TextEdit and delete all the songs from it that are not jazz. You can make similar copies for different musical genres, country, world music, whatever. Just be sure to edit the copies and to not edit the original “all.m3u”.
  • To edit the M3U files in TextEdit, DO NOT double-click on them. This will open them in iTunes, which will take forever and will cause iTunes to attempt to import all the songs. Instead, right-click or cntl-click on the M3U file to bring up the pop-up menu, then select “Open With”. Select “Other…”, and choose TextEdit. You’ll need to do this with every file, since the Mac is convinced that M3U files should be opened with iTunes, even if you click on the “Always Open With” box.
  • Note that you’ll need to recreate the “all.m3u” file each time you add new music to your Sansa. And you’ll need to copy and paste the new songs from the “all.m3u” files to the appropriate playlists.
  • You might think, “Wait a second. iTunes can export playlists, even as text files. Why can’t I just use my iTunes playlists instead of going through all this hassle?” Well, the problem is that iTunes can’t export an M3U format playlist. And the other problem is even if you use one of the iTunes-M3U translation apps out there, you’ll still need to hand-edit the resulting M3U files to fix the pathnames of the files, since they’ll have the Mac pathnames instead of the Sansa pathnames. And the other other problem is that if you use the workaround hinted at in Caveat #5, the track numbers embedded in the filenames won’t match up between the Mac and the Sansa, so you’ll have to hand-edit those as well. By the time you do all that editing, you might as well do it this way. Once you’ve done it a couple of times, it is easy, if a little tedious.
  • To play your newly created playlists in Rockbox, you need to do something a little odd. Don’t select “Playlists” from the main menu, as you might expect to do. Rather, select “Files”. Scroll down to the M3U playlist file that you want to listen to, and click the Select button. Rockbox will immediately start playing the first song in the playlist. You can press the Menu button and turn Shuffle and Repeat modes on if you want.
  • You can also go to the “Plugins” menu, then “Games”, and then play a game like Solitaire or Jewels while your music continues to play. (Hint: In Solitaire, to get the next card from the deck, press the “Record” button on the side of the Sansa. Everything else is done with the front buttons and scrollwheel.)
  • Rockbox is highly configurable. You can change the theme (or skin), fonts, and just about everything else. But be prepared to edit some configuration files to really tweak your Rockbox settings. The most important one is in /Volumes/Sansa e260/.rockbox and is called “config.cfg”. If you want to change the background image under Rockbox (to, say, a picture of your dogs or kids), you’ll need to edit this file, and you’ll need to use Terminal to get to it, since the “.rockbox” folder won’t show up in the Finder. You’ll also need to resize or crop the picture to exactly 176 x 220 (176 pixels wide by 220 tall) and save it as a BMP file on the Sansa. You can do this in Preview or another photo editing app. Then add or change this line in “config.cfg” to reflect the name and location of your picture:
    backdrop: /cutepups.bmp

Kingston 2 GB microSD card and USB AdapterThe Sansa e200 series comes with a microSD card slot. I purchased a Kingston 2 GB microSD card (which came with a USB adapter for the card), plus a SanDisk 4 GB microSDHC card to see how the Sansa handles them.

You can put additional music or videos on a microSD or microSDHC card and play them in the Sansa player. This capacity of the cards supported by this slot appears to be a source of great confusion. I’ve read that some versions of the e200 series can only support microSD cards that are 2 GB in capacity or smaller, while newer versions can support the larger microSDHC cards. I’ve also read that using Rockbox gives all of the e200 versions the ability to handle the microSDHC cards. Here’s my experience so far:

Card Capacity 2 GB 2 GB 4 GB
Card Format FAT-16 FAT-32 FAT-32
Card Type microSD microSD microSDHC
Mac Can Read/Write Card via Kingston microSD USB Adapter? Yes Yes Yes
Sansa Can See Card? Yes Yes NO
Sansa Can Play Music From Card? Yes Yes NO
Mac Can Read/Write It via Sansa USB Cable ? Yes Yes (If card is inserted after Mac “sees” Sansa) NO
Rockbox Can See Card? Yes Yes Yes
Rockbox Can Read Card? Yes Yes Yes
Rockbox Can Write Files To Card? Yes Yes Yes

I have a “version 1″ e260 (as opposed to the newer e200R and “version 2″ series). When i put a 2 GB microSD card into the e260 and connect it to my Mac via USB, I see two disks show up: “Sansa e260″ (the e260’s built-in flash drive) and “NO NAME” (the microSD card). The disks appear to be similar except that “Sansa e260″ is 4 GB in size and “NO NAME” is 2 GB.

Here’s the important difference: When I click on “Get Info” for “Sansa e260″, it is reported as FAT-32 format. This is the Microsoft format that was used in Windows 95 and newer versions of Windows. FAT-32 formatted disks can be up to 2 terabytes in size. However, “NO NAME” is reported as FAT-16 format, and FAT-16 disks can only be 2 GB in size or less.

So, does the Sansa only support FAT-16 formatted microSD cards? Yes and no.

As an experiment, I connected “NO NAME” directly to my computer via the Kingston microSD USB adapter, and reformatted it as FAT-32. Then I copied some music onto it, disconnected it from the computer, and plugged it back into the e260. The e260 was still able to read FAT-32-formatted “NO NAME” and could play the songs on it. However, when I connected the e260 to my computer via its USB adapter, it would lock up and wouldn’t show up on my computer. But when I inserted “NO NAME” into the e260 after the e260 was already connected to the computer and “Sansa e260″ was showing up on the computer’s desktop, then “NO NAME” showed up, and I could copy files to it just fine.

So, in other words, if a 2 GB microSD card is FAT-16 formatted, the e260 handles it just fine. If the 2 GB microSD card is FAT-32 formatted, the e260 almost handles it just fine, except during the initial handhaking when connecting to a computer via the Sansa USB cable.

This leads me to believe that the (“version 1″, at least) Sansa e200 series can’t support the larger microSDHC cards, not because they’re larger, but because they aren’t FAT-16 formatted (nor can the cards be, since they’re too big for FAT-16). Rather, my guess is that it almost supports them, because it mostly (but not quite totally) supports FAT-32. It possibly can read them and play music and videos on them. It possibly can show them on a connected computer’s desktop if they’re inserted into the e200 after it is connected to the computer.

Now, when I put a true microSDHC 4 GB card (which is of course formatted FAT-32 because it is too big for FAT-16) into the Sansa, the Sansa doesn’t see the 4 GB card at all. It acts as if the card simply isn’t there.

As for Rockbox and the 2 GB microSD card, everything works fine. I can create M3U playlist files at the top of the “NO NAME” disk exactly like I can for “Sansa e260″ and Rockbox sees them and plays them:

cd “/Volumes/NO NAME”
find . -name “*.mp3″ > noname.m3u
find . -name “*.MP3″ >> noname.m3u

The only oddity is that Rockbox’s “Files” app ignores the volume name “NO NAME” and instead displays the disk as “<microsd1>”.

The same is true for Rockbox and the 4 GB microSDHC card. Rockbox sees the card, can play music from the card, and can even write files to the card. (Note: since the Sansa can’t use Rockbox during USB transfers to and from the Mac, the Sansa can’t be used to copy music or video files to the microSDHC card–the microSD USB Adapter must be used for that.)

Overall, the 2 GB microSD card is quite useful, since I can connect it directly to my computer and quickly copy files to it without involving the Sansa (or the Sansa’s need to do the full “Refresh Database” process every time I copy over a single file). The 4 GB microSDHC card is almost as useful, but is slightly limited since the Sansa in native (non-Rockbox) mode can’t use it. However, I rarely use the Sansa in native mode, since Rockbox makes the Sansa so much more versatile–and Rockbox accesses the microSDHC card just fine.

And that’s it. There’s some hassle involved, but in the end the Sansa e260 and Rockbox can be used with the Mac, and will have all the capabilities of the iPod Nano plus a lot more, for a fraction of the price.

 Posted by at 5:54 AM
May 162008
 

This post on Lifehacker made me slap my head. I had recently spent a while trying to figure out how to automate having the Mac “read” a book–use its excellent built-in Text-To-Speech system to convert an eBook into an audiobook. The Mac voices aren’t going to replace Derek Jacobi or Bob Inglis for nuanced and powerful reading of great books, but they will get the job done when there’s no other option for creating an audiobook short of reading it aloud yourself.

My first attempt at automatic eBook-to-audiobook translation was to use Automator. I created serveral Workflows, one per speaking voice, with the following Actions:

1. Open Finder Item (the eBook in
text format) with TextEdit.

2. Get Contents of TextEdit. Send
output to:

3. Text To Audio File. Save as
“vickispeak” (for voice “Vicki”)
on the Desktop.

This works quite well, but is a little slow. To run it, I right-click on the input text file in a Finder window, then select Automator from the pop-up menu, and the desired voice’s Workflow from the Automator submenu. It creates an AIFF audio file called “vickispeak” on the Desktop. It does exactly the same thing as the single ‘say’ command, which can be run with much less theatrics from Terminal (type this in all on one line):

say -v Vicki -o ~/Desktop/vickispeak
-f ~/Desktop/ebook.txt

The options to ‘say’ are:

  • -v voiceName
    One of Agnes, Kathy, Princess, Vicki, Victoria, Bruce, Fred, Junior, Ralph, Albert, or one of the many “novelty” voices; there are supposed to be more and better voice options under OS X 10.5. If not specified, the current “System Voice” is used; this is set under the “Text To Speech” tab under “Speech” System Preferences.
  • -o outputSoundFileName
    If not specified, the input text is spoken aloud.
  • -f inputTextFileName
    If not specified, the text to be spoken can be listed as arguments on the command line.

Further details on ‘say’s arguments can be found by typing this in Terminal:

man say

But that’s not the end of things. You can import the resulting (potentially huge) AIFF file into iTunes and convert it to MP3 format (and use very low-quality conversion options to save disk space). You can then copy the (much smaller) MP3 file to your iPod or other portable music player, and play your new audiobook back while commuting, etc.

And you can add some useful commands at the top of your eBook text file that will instruct the Mac books to speak more quickly or at a different pace. According to the Apple Developer’s website, these commands are deprecated, so they may not work under OS X 10.5. The handiest one I’ve found is to add this single line at the very top of the eBook text file:

[[rate +40]]

I’ve found that when using the Vicki voice, “+40″ makes her speak much faster, but she’s still comprehensible. This is completely a matter of taste. To make the rate of speaking slower, use a negative number instead of a positive one. More details on the speech commands you can embed in your text files can be found at this Apple Developer webpage.

Now, of course, all of this presumes that you’ve got an eBook in a raw text file or in some format that can be converted to text. You can find these kinds of books at websites like Project Gutenburg that sponsor copyright-free and otherwise non-restricted texts. A handy list of these sites is on the OLPC News Forum.

Note that if the eBook you want to convert into an audiobook is only in PDF format and not in raw text, using the Automator Workflow instead of the ‘say’ command may make things easier, as Automator has an “Extract Text From PDF” Action built-in, which makes dealing with PDF files relatively easy. More details can be found in this Apple Support discussion.

Note that there are commercial / shareware / freeware applications which will help you create audiobooks more easily and with greater control than these DIY methods:

  • GhostReader is an audiobook recording suite; it even includes more voices.
  • Audiobook Builder will help you organize your audiobook recordings into chapters, and convert your sound files into audiobook formats that iPods and some other MP3 players support bookmarking and other enhanced playback capabilities for.
  • Charles Kelly’s Text-To-Speech to MP3 free application combines all of the steps outlined above into a single step.
  • TypeIt ReadIt is a shareware app that can convert text files to MP3 audio files, and can help visually challenged readers with other tasks.
  • Wizzard / AT&T Natural Voices Text-To-Speech SDK helps you create your own multiplatform applications.
  • iSpeak-it converts many document types, including web pages and RSS feeds, to spoken audio files.
  • MaxPod converts web pages to spoken audio files for use on your iPod.
  • Narrator helps you script your audiobooks by changing the speaking voice, pitch, and other qualities.
 Posted by at 8:47 PM
May 162008
 

ControllerMate showed me something interesting about the Frisby keyboard: The keyboard actually reports itself as two separate USB devices, a keyboard and a mouse. I suppose that this isn’t terribly surprising considering that the keyboard includes a scroll wheel. What is a little surprising is that all of the 20-odd buttons around the edges of the keyboard are tied to the mouse device. (The standard function keys are tied to the keyboard device.) The strange thing is that some of the mouse buttons still work after the Mac sleeps, but most don’t. The scrollwheel still works, for instance. This is one funky keyboard. But it works well, I like it, and it was really cheap on eBay.

I plugged my PS3’s SIXAXIS controller into the Mac to see if ControllerMate could see it. Yes, CM does, and it sees all the buttons and even the tilt sensors. But CM doesn’t see any of the button presses from the controller. According to people on the CM forum, this is likely because the controller is both USB and BlueTooth, and it is still paired with the PS3 overall; the Mac needs to send some sort of handshake signal to the controller to get it talking over USB.

 Posted by at 9:26 AM
May 162008
 


I just bought a cheap Frisby illuminated keyboard on eBay. Not only is it illuminated, but it has a scrollwheel, volume knob, and like 20 extra buttons (in addition to the usual 16 or so function keys). The only thing it lacks is indicator lights for the Caps Lock, Num Lock, and Scroll Lock keys.

When I first plugged it into my Mac, it didn’t work. Well, actually, it did. In fact, the scroll wheel, volume knob, and mute button all “just worked”. But the keyboard wouldn’t light up. The instructions that came with the keyboard (all 1/8 page of them) indicated that the Scroll Lock key was the On/Off switch for the keyboard’s backlight. Pushing it didn’t do anything, even when pressed in combo with Shift, Ctrl, Alt, Windows/Command, or any gaggle of the above. But, when I first plugged the keyboard into the USB port (or into a powered USB hub), it did light up for about 1/2 second or so. What was going on?

A lot of googling led me to believe that this problem is fairly common on Macs, Linux PCs, and even under Windows, although not many people have found a solution.

Here’s apparently what’s going on: The Frisby keyboard (along with many other budget illuminated keyboards) uses the Scroll Lock key as a switch for the backlight because it essentially replaces the Scroll Lock indicator light with the entire keyboard backlight. At first glance, this seems like a clever idea, except for a couple of problems: Some applications (Excel for one) and gadgets (many low-price KVM switches) also make use of the Scroll Lock key, and expect it to be available. Worse, some operating systems (Mac OS X mainly) don’t really know about or care about the Scroll Lock key and don’t support it; OS X doesn’t keep track of the Scroll Lock’s on/off toggle state, and doesn’t tell the keyboard to turn the Scroll Lock LED on and off. So, when the Frisby keyboard is hooked up to a Mac, pressing the Scroll Lock key is ignored by OS X, and thus OS X never tells the keyboard to turn the backlight on. Doh.

Well, once I figured this out, I was faced with a choice: return the keyboard for a refund, or try to figure out how to get the Mac to support the Scroll Lock key. As with many eBay bargains, the price of the keyboard wasn’t much more than the shipping cost, so if I paid for the shipping to return it, I’d only net a few bucks after getting my refund. So, that was enough of an excuse for me to start hacking away at the problem.

After many false starts and dead ends, I stumbled across a wonderful product called ControllerMate. CM plugs into OS X and allows it to see inputs from various USB gadgets like joysticks and game controllers. CM also supports all of the standard keys and buttons from USB keyboards and mice, plus a ton of esoteric ones. It uses a “connect the blocks” graphical design system to let you assign key / button presses to various sorts of actions, including things like: running AppleScript scripts; telling keyboard lights to turn on and off (!); sending single keystrokes (in other words, remapping keys on the keyboard–handy for Windows-Mac “switchers” and those with keyboards that are missing some of the function keys); sending strings of key presses, mouse movements/clicks, and delays (shades of QuicKeys, which it would be an excellent adjunct to); application launches; and nifty add-ons like logic and arithmetic. ControllerMate is free to try out, and $15 to buy, which is an incredible bargain.

I was able to use ControllerMate to build a simple connection of three blocks:

Scroll Lock keypress
|
V
“Toggle” Logic Block
|
V
Scroll Lock Light on / off.

ControllerMate then runs in the background under OS X, watches the Scroll Lock key, keeps track of it’s on/off state with the “Toggle”, and tells the keyboard’s Scroll Lock light (aka the keyboard backlight) to stay on after I press the Scroll Lock key, then stay off after I press it again. In other words, to make the Mac treat the Scroll Lock key like a Windows PC does. Problem solved!

I also used CM to program functions for all of the zillion extra buttons the keyboard has. Some of the buttons were simple. For example, I made the button with a picture of a calculator on it tell the Finder to launch the Calculator app. Others are a little more complicated. For example, the Play/Pause button tells the Finder to launch iTunes (or select iTunes if it is already running), and then sends a “spacebar” keystroke, which is what iTunes uses for play/pause. This way, the Play/Pause button works correctly even if I press it while running another application.

The one button that stumped me so far is the “Email” button. I’d like to have it use the Google Notifier toolbar’s menu item to “Go To Inbox”. I’ve messed around for quite a while trying to get an AppleScript script that reliably does this, but it is proving very difficult, since the name of the menu item is actually “Go to Inbox – 12 Unread”, where of course “12” changes all the time, since it’s the number of unread messages, and GN’s heirarchy of menus and items is mostly unnamed. Plus, GN’s AppleScript API doesn’t have a function / call / whatever for “Go To Inbox”.

Another AppleScripted button that seemed to work for a while but doesn’t today attempts to have the Finder open up a window with the Applications folder selected. Here’s the AppleScript script that sorta kinda sometimes works:

tell application “Finder”
activate
end tell

tell application “System Events”
tell process “Finder”
tell menu bar 1
tell menu bar item “Go”
tell menu 1
click menu item “Applications”
end tell
end tell
end tell
end tell
end tell

Anyways, the keyboard ended up having one more serious problem. It would stop responding after the Mac went to sleep and woke back up. I discovered that having CM do a USB bus probe made the keyboard work again, and didn’t seem to have any harmful side effects. So, the question became: How to tell the Mac to do some sort of USB bus probe after waking from sleep mode?

The best answer I’ve come up with so far is a hacky combination of Apple’s developer tool called “USB Prober” (included free with XCode, which is included with most–all?–Macs on the installer disks, and which lives in /Developer/Applications/Utilities), an AppleScript script that tells it to run and then immediately quit, and another nifty (and free!) application called SleepWatcher. SW runs in the background on the Mac, and is able to run shell scripts immediately before the Mac sleeps and directly after it wakes up.

So, I made the following simple AppleScript script, which I saved as an Application, turned on the “Run Only” flag, turned off the “Startup Screen” flag, and named “USBProberRunNQuit.app”:

tell application “USB Prober”
quit
end tell

tell application “USB Prober”
activate
end tell

tell application “USB Prober”
quit
end tell

It is run by a one-line shell script called “.wakeup” in my home directory:

/Users/joviko/USBProberRunNQuit.app

So, when my Mac wakes up, SleepWatcher runs the “.wakeup” script, which runs my “USBProberRunNQuit.app” AppleScript app, which runs Apple’s USB Prober app, which probes the USB bus then immediately quits, which makes the Frisby keyboard work. Simple, eh?

 Posted by at 7:57 AM