Kansi's spinning cube, three frames as it draws them for the 130×130 cover display, zoomed 2×. These are PC renders: on the phone, the cube never made it to the screen.
The Nokia 9500 has two screens. Open it and you get the wide 640×200 Series 80 screen. Close it and the small colour display on the lid runs a little phone interface of its own. Third-party apps only ever get the inside screen. There's no public API for the cover, but Nokia's own cover software draws on it, so there has to be a way.
I wanted to find it. My camera app Linssi could use the cover as a viewfinder, and a spinning 3D cube on the outside of a 2004 Communicator is reason enough on its own. So I started Kansi, Finnish for "cover". As with my other projects on this blog, Claude (Anthropic's AI) wrote the code. I built it on my Windows 2000 VM and ran it on the phone.
The driver in the emulator
The Series 80 v2.0 SDK ships the PC emulator's copies of the cover system, even though the emulator itself can't show the cover. Among them is the cover's display driver, a kernel driver called CuiLcd. Claude took the emulator's x86 binaries apart and wrote down how a program talks to it: switch it on, pick 4K, 64K or 256 colours, and send a rectangle of pixels with a single call. The controller is 130×130 pixels, of which the glass shows about 128×128.
All of that fits in one small class in CuiLcd.h, and it needs nothing but EUSER, the most basic Symbian library.
Kansi
Kansi opens its own connection to that driver, switches it on, sends a test card, times a few full-screen updates and then spins a cube. Every step's return code goes on the screen and into a log file on the memory card. Each line is written to disk right away, in case something goes badly. That turned out to be a good idea.
The test cards, again PC renders. On the left, colour bars and 16-step ramps in 4K colour. On the right, 32 and 64-step ramps in 64K colour, to see how many colours the glass really shows. The thin coloured lines around the edges would have shown which of the controller's 130×130 pixels are actually visible.
The cube is drawn in software: six dice faces as 64×64 textures, eight levels of shading and fixed-point maths, straight into the cover's 12-bit colour format. You can put your own pictures on the faces with a kansi.mbm file on the memory card. Because the renderer only needs EUSER, the same code builds on a PC too. A test there draws the frames you see above and checks that the cube never draws outside the frame.
And then the phone rebooted
On 10 November I started Kansi, and the whole 9500 rebooted.
The log showed exactly where. Its last line was the step just before Kansi opens its connection to the driver, and the next line never got written. The cover's own interface already holds a connection to that driver. Every connection makes the kernel create a new object for the driver's hardware side, and the real phone's hardware side doesn't survive a second one. In the emulator it would just return an error. On the phone, the whole kernel goes down.
So none of the test cards, timings or cube frames ever reached the cover, and the driver notes are still untested on real hardware.
The other way in
Nokia's own cover apps don't open the driver at all. They ask the cover interface's own window server to draw for them. That's the route that should work, and Claude started mapping it. Then Anthropic's automatic safety system stopped Claude in the middle of it, and again later when Claude was writing about it. Claude wrote its own post about that. Either way, that route isn't worked out in Kansi.
We also searched the Symbian source code that was put on GitHub when the Symbian Foundation wound down. It's Symbian^3 and later, built on S60. Series 80 was never part of it, and neither is the 9500's cover system.
Why publish a program that reboots your phone
Because the rest of it is still useful:
CuiLcd.his the only public description I know of how the 9500's cover display driver works.Cube.cppis a small, self-contained software 3D renderer for a 130×130 frame, tested on a PC.- The logging, one line at a time and flushed to disk, found the crash on the very first run.
If you know how the cover's own apps draw, or you've drawn on a 9300 or 9500 cover from your own program, please open an issue on GitHub. Linssi is waiting too.
Get it
Kansi is on GitHub as Scorpizoid/Kansi9500, under the MIT licence. There's no SIS, on purpose. Built as it is, Kansi reboots your 9500 the moment it starts. Take out the OpenChannel() call at the end of CKansiAppUi::ConstructL() in Kansi.cpp first. Then build it with the Series 80 v2.0 SDK:
bldmake bldfiles abld build armi urel makesis Kansi.pkg
The cover is still dark, but at least now we know exactly why.


Ei kommentteja:
Lähetä kommentti