Recently, I posted a review of the Logitech Z-10 interactive speakers. Great speakers, but far more interactive for Windows users than for Mac. That is, until Marc Liyanage dived in and wrote the LogitechLCDTool. Now Mac users can use the Z-10’s LCD display too.
I’ve test the LogitechLCDTool, and it’s terrific. I decided to find out more about Marc and how he did this. So here’s a brief interview with a peek behind the scenes.
Derrick: Can you talk briefly about the process you went through when you decided that you wanted to add Mac capability to the Z-10 speaker system?
Marc: I first wanted to wait and see if lots of Mac users would buy these speakers and ask Logitech for Mac drivers. However, past experience (still can’t program the middle button of my V270 Bluetooth mouse using Logitech Control Center) and your note about the Logitech PR person’s statement didn’t make that look likely.
I contacted Logitech asking for either Mac drivers or some USB protocol specification to write my own software. I never heard back. Like with all big companies it is between hard and impossible to get past the contact forms on their website and get a useful answer. Then I decided to give it a try anyway, hoping to learn something about USB programming.
Derrick: Once you decided that you were going to have to do this on your own, how did you evaluate the challenge and figure out what steps to take?
Marc: I had plenty of experience writing Mac OS X Cocoa applications, so I knew that the hard part would be the USB communications and not the GUI. The only real show-stopper would have been deliberate attempts to block reverse engineering the protocol, like encryption. To learn more about this USB communication, I fired up Parallels VM and set up Logitech’s Z-10 software in my virtual Windows XP installation. I also installed a freeware USB bus sniffer for Windows and then played around with the Z-10, pressing buttons and triggering screen updates.
I studied the captured raw data for a while to find patterns. For example I expected large transfers when the screen was updated and tiny ones when a button was pressed. It was quite easy to recognize and isolate the larger display update transfers. Before I started to write any software, I first spent some time analyzing this display data format to make sure that I fully understood it so I could produce my own images in the format expected by the display (Initially, I was only interested in supporting the display, not any of the buttons).
While the screen image format was not encrypted, the pixels were arranged in an unexpected way. I’m sure it would have taken me a while to figure it out, but here I got some help. Logitech sells the G-15, a gaming keyboard which has the same display, and there is open source software available for it, the “g15tools” package, which contained a conversion function which contained all the necessary logic. I talked to the authors and they even allowed me to reuse this function.
Derrick: Did your previous programming experience provide you with the knowledge you needed for this project?
I did not have the slightest clue about how the USB bus or Apple’s USB programming interfaces work. That was quite a steep learning curve, especially since the terminology is unfamiliar and the interfaces are complex.
One thing which was *extremely* helpful is a developer tool provided by Apple called “USB Prober.” I don’t think I would have been able to finish the project without it, especially when I decided to add the button functionality.
Derrick: What’s next for this project?
Marc: That depends on what users ask for :-)
I plan to write some more example HTML files which display things unrelated to iTunes.
GUI improvements are probably a good idea, it’s pretty rough right now. However, since interaction is minimal and the program stays hidden in the background most of the time, that doesn’t seem too important.
Most of all, I really hope that some users will write interesting scripts and use the system in unusual ways :-)
Derrick: Thanks Marc for your hard work and sharing your knowledge with the Mac developer community. You’ve done a great job with this.
Marc: It’s been fun.