Thursday, August 27, 2009

Fixing a hardware keyboard problem in Mobile Firefox for Windows Mobile

Finally, my patch was applied to the mainline of Mozilla and this cumbersome bug has been fixed. I am so happy to contribute to Mozilla. Here is the detail what the problem was fixed:

Windows Mobile keeps the status of hardware keyboard in the registry as follows:

"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Shell\HasKeyboard"

A software keyboard can pop-up if a device doesn't have a hardware keyboard. However, in the case that the device has a slide-out keyboard, the value should be changed according to the status of the slide-out keyboard.

For example:

1) When the keyboard does not slide out, the HasKeyboard value has to be "0"
2) Whenthe keyboard slides out, the HasKeyboard value has to be "1"

However, the above registry value, HasKeyboard, always returns 1 because it doesn't consider the status of slide-out keyboard. :-(

Windows Mobile doesn't have a standard API for detecting a status of slide-out keyboard so each device maker has to provide its own hidden or public API. For Samsung Windows Mobile devices, Samsung provides Windows Mobile SDK from the Samsung Mobile Innovator site so we can easily get a state of the slide-out keyboard on Samsung devices. However, HTC doesn't provide any document on how to use device APIs.

As a result, some hackers had tried to find out how to use hidden APIs for accessing hardware features of HTC devices, but there is no API about slide-out keyboard.

Anyway, Fennec has a bug with detecting the state of slide-out keyboard, which seemed easy to solve. At least, it was easy for my i780, but my first patch couldn't support HTC touch pro that has a side-out keyboard.

I tried to check most of the registry values if there is any change. Finally, I found the value from  HKEY_LOCAL_MACHINE\System\GDI\Rotation\Slidekey. That made me fix the bug easily. :-)


No comments: