Back / Home


Turn on the backlight automatically

13.02.2021

This a is very small application and it already exists, but the one I found (https://www.whizoo.com/apps/backlight.php) didn't worked for me, so I wrote my own one.

The problem is simple: If you have a Sony Clie S3x0 or a SL10 you know the problem, that screen is very hard to read in low-light conditions. Of course you can manually turn on the backlight, but I would say, you need to turn it on very often. So why not autmate this step and turning it on everytime the screen gets turned on? With this application installed, the backlight is on by default (it gets turned on every time the device gets turned on). The app works only on b/w-devices with backlight. So far: only tested on a Sony CliƩ S320 (succesfully).

Requirements: Palm OS 4.0 (or higher)

Here is the application:

EverBacklight.prc

If you want to use this application: It is important, that you install it via a hotsync or do a soft-reset after copying it on your device. And this is the Source-Code:

/*
 * EverBacklight.cpp
 *
 * main file for EverBacklight
 *
 */
 
#include <PalmOS.h>
#include <PalmOSGlue.h>

#include "EverBacklight.h"
#include "EverBacklight_Rsc.h"

/* Define the minimum OS version we support */
#define ourMinVersion    sysMakeROMVersion(3,0,0,sysROMStageDevelopment,0)

static void RegisterForNotifications()
{
 UInt16   cardNo=0;
 UInt32   romVersion=0;
 LocalID dbID=0;

  FtrGet(sysFtrCreator, sysFtrNumROMVersion, &romVersion);
  if(romVersion < ourMinVersion){
      return;
  }
  
  if(SysCurAppDatabase(&cardNo, &dbID)!=0){
      return;
  }
   
 SysNotifyRegister(cardNo, dbID, sysNotifyLateWakeupEvent, NULL, sysNotifyNormalPriority, 0);
}

static void HandleNotifications(SysNotifyParamType *np)
{
  if(np->notifyType==sysNotifyLateWakeupEvent)
  {
    UIBrightnessAdjust(); // Toggle Backlight
  }
}


UInt32 PilotMain(UInt16 cmd, MemPtr cmdPBP, UInt16 launchFlags)
{
    switch (cmd)
    {    
        case sysAppLaunchCmdSystemReset: 
          case sysAppLaunchCmdSyncNotify:
                RegisterForNotifications();
        break;

           case sysAppLaunchCmdNotify:
            HandleNotifications((SysNotifyParamType *)cmdPBP);
        break;
    }

    return errNone;
}    

Of course there is a lot of room for improvements. But currently I'm do not have the time for optimization.


Misc