I sort of grew used to unsteady OSD menus, taking their flickering as natural. But is it natural? Of course not, as
mil22 reminded us recently. Inspired by
mil22 and
cail, here's a quick fix to tame the touchwheel task TouchW and get perfectly steady menus and smooth navigation. The necessary tools, taskNameToId(), taskSuspend(), and taskResume(), are provided by VxWorks. The last two have been known since long; the first has to be identified by hand in stubs_entry_2.S:
NHSTUB(taskNameToId, 0xFF935A64)
Then, in platform\ixus950_sd850\kbd.c:
void my_kbd_read_keys()
{
kbd_prev_state[0] = kbd_new_state[0];
kbd_prev_state[1] = kbd_new_state[1];
kbd_prev_state[2] = kbd_new_state[2];
_kbd_pwr_on();
kbd_fetch_data(kbd_new_state);
///////////// ADD THIS: /////////////
static int handle_taskTouchW = 0, isRunning_taskTouchW = 1;
extern int _taskNameToId(void*);
extern void _taskSuspend(int), _taskResume(int);
if (handle_taskTouchW == 0) { handle_taskTouchW = _taskNameToId("tTouchW"); }
////////////////////////////////////////
if (kbd_process() == 0){
// leave it alone...
physw_status[0] = kbd_new_state[0];
physw_status[1] = kbd_new_state[1];
physw_status[2] = kbd_new_state[2];
//physw_status[1] |= alt_mode_key_mask;
///////////// ADD THIS: /////////////
if (!isRunning_taskTouchW) { _taskResume(handle_taskTouchW); isRunning_taskTouchW = 1; }
////////////////////////////////////////
} else {
// override keys
physw_status[0] = (kbd_new_state[0] & (~KEYS_MASK0)) |
(kbd_mod_state[0] & KEYS_MASK0);
physw_status[1] = (kbd_new_state[1] & (~KEYS_MASK1)) |
(kbd_mod_state[1] & KEYS_MASK1);
physw_status[2] = (kbd_new_state[2] & (~KEYS_MASK2)) |
(kbd_mod_state[2] & KEYS_MASK2);
///////////// ADD THIS: /////////////
if (isRunning_taskTouchW && !state_kbd_script_run)
{ _taskSuspend(handle_taskTouchW); isRunning_taskTouchW = 0; }
else if (!isRunning_taskTouchW && state_kbd_script_run)
{ _taskResume(handle_taskTouchW); isRunning_taskTouchW = 1; }
////////////////////////////////////////
}
_kbd_read_keys_r2(physw_status);
if (conf.remote_enable) {
remote_key = (physw_status[USB_REG] & USB_MASK)==USB_MASK;
if (remote_key)
remote_count += 1;
else if (remote_count) {
usb_power = remote_count;
remote_count = 0;
}
physw_status[USB_REG] = physw_status[USB_REG] & ~USB_MASK;
}
physw_status[2] = physw_status[2] & ~SD_READONLY_FLAG;
_kbd_pwr_off();
}
This suspends the wheel task in ALT-mode unless a script is running that might need to emulate navigation keys.
Attached are precompiled binaries, should anybody wish to try it out.