Francis Devereux

November 6, 2008

S60 Remote Control API Weirdness

Filed under: Software Development, Symbian — frankoid @ 10:24 pm

I have been using Symbian OggPlay (a music player for mobile phones) for quite a while, first on a Nokia N70 and now on an N95. It doesn’t have support for the volume buttons on the N95, so I decided to add it. The N95 has a volume control on the side of the phone, and another one on the remote control in the headphone chord.

I used the remote control API to handle the volume controls, and noticed something strange: the actions reported to my code when the volume control on the headphone remote is used are different to the actions reported when the volume control on the phone is used. Here’s what is sent to my code’s MrccatoCommand method:

Volume control on headphone remote

When the volume up (or down) button is pressed, an ERemConCoreApiVolumeUp (or ERemConCoreApiVolumeDown) command is immediately sent with a button action of ERemConCoreApiButtonPress. When the button is released, another ERemConCoreApiVolumeUp (or ERemConCoreApiVolumeDown) command is sent with an action of ERemConCoreApiButtonRelease.

The headphone remote never generates commands with action set to ERemConCoreApiButtonClick.

Volume control on the side of phone

When this volume control is used, a different sequence of commands is reported depending on whether the button is held down for a short or a long time.

When the button is held down for a short time, only one command is sent and its action is set to ERemConCoreApiButtonClick.

When the button is held down for a long time, first a command with action ERemConCoreApiButtonClick is sent as soon as the button is pressed, then there is a short delay and a command with action ERemConCoreApiButtonPress is sent. When the button is released a command with action ERemConCoreApiButtonRelease is sent.

If you would like to look at my code, the patch to OggPlay is at http://www.devrx.org/software/symbian/oggplay/symbianoggplay-mediakeys.diff.

Advertisements

October 29, 2008

Installing gcc 3.3 on Mac OS X Leopard/Intel

Filed under: Computers, Mac OS X, Software Development — frankoid @ 5:01 pm

In order to build applications that run on Mac OS versions prior to 10.3.9, you need to use gcc 3.3 (see this Apple documentation for details). This is a problem if you have an Intel Mac running Leopard, because the Xcode 2.5 installer will only allow you to install gcc 3.3 on Tiger. However, there is a way to get it to install anyway… Be warned that Apple probably had a good reason to prevent gcc 3.3 from being installed on Leopard, so this may break your system and/or the binaries that you compile. However, it did work for me and allowed me to compile a small application that ran OK on OS X 10.3.7/PPC. Here’s how to do it:

  1. Install Xcode 2.5, including the 10.3.9 SDK.
  2. Copy gcc3.3.pkg from the Packages/Packages directory in the Xcode Tools disk image to your desktop.
  3. Open the copy of gcc3.3.pkg (right click it and choose “Show Package Contents”).
  4. Open gcc3.3.pkg/Resources/VolumeCheck in a text editor.
  5. Change if( CheckVersion("$SYSTEM_VERS", "10.5", "ProductVersion", ">=" )) to if( CheckVersion("$SYSTEM_VERS", "10.6", "ProductVersion", ">=" )) and save the file.
  6. Double-click on your modified copy of gcc3.3.pkg. You will now be able to install it like any standard Installer package.
  7. “If it breaks you get to keep both pieces.”

Blog at WordPress.com.