Monday, October 8, 2007

Interesting Design Principle

Design for extension. I think it's rare case when you need to override methods without being afraid to break something.

P.S. Eclipse project leverages this principle all over the sources.

Wednesday, September 19, 2007

Web programming

It is not as bad as I thought. I am even starting to get pleasure from using dojo (ajax framework) and firebug (plugin for firefox).

Update: Only thing disappointing me is a lack of javascript support in eclipse.

Monday, August 20, 2007

Portlets and AJAX: ZK, GWT, DOJO

I've tried to leverage ZK in a portal environment. Yes, it's possible, but there can be only one ZK portlet within portal's page becouse ZK uses global javascript variables. So it's sux. Anyway, don't try to use DhtmlPortlet otherwise you will end up with exception from tomcat telling about SRV spec violations. Instead, just include zk page from your custom portlet class.

The same is about GWT. It's pain to build a GWT project with maven. GWT plugin for maven looks immature and abandoned. The idea behind GWT is very hackish.

DOJO is a lowlevel set of javascript functions. That makes possible to implement custom widgets suitable for portal environment. Besides, there is DIJIT widgets collection built on top of DOJO. Injection of dijit css styles to portat theme is required to start using DIJIT widgets. Lack of real documentation for DOJO/DIJIT is the only thing really disappointing.

Sunday, August 5, 2007

SpringMeasure 1.0

I don't understand how I've ever been without Spring framework. It is so tasty. I will use it whenever I can. Do you think a step from EJB 2.1 to EJB 3.0 is a revolution? Then step from EJB 3.0 to Spring 2.0 is a revolution no less: flexible IoC, nasty testing out of box, standalone or web or whatever execution, annotations, if you prefer your app knows nothing about spring (no direct dependencies on spring classes) and so on. But that is not an issue of this post. As an example of spring ideas I am going to show you how spring can be easily extended for your needs. In my case I wanted to use measured values right in a bean property definition. I.e. instead of using a value 120013 calculated behind the scene (60*2*1000 + 13) I wanted a human suitable representation like a "2min 13ms". And to achive it I've created a small project.

Download the archive.
Uncompress it.
Do mvn install from command line inside the archive's folder.

Now you can use springmeasure as the dependency in your own project (artifactId: springmeasure, groupId: ru.toril.springmeasure, verision: 1.0).

In your application context xml add the following line:
<bean class="ru.toril.springmeasure.MeasureConfigurer" />

From now you can write following (as an example):

<bean class="some class you want"
p:value1="{${test.length}}m"
p:value2="{4GiB 200MiB}MiB"
p:value3="{400ms}s." />

The property value1 is configured with PropertyPlaceholderConfigurer in addition to MeasureConfigurer, whereas test.length property is set to "8km".

As you already noticed springmeasure is written to support symbols of Si. A format of value is as following:

{sequence of space-separated values with symbol suffix joined to value}outputSymbol

An output symbol may be followed by the dot marking that an output value is not to be rounded.
You may find out more about format looking at the following test lines:

// IT symbols (bits, bytes)
assertEquals ("2048", convert ("{2KiB}B"));
assertEquals ("16384", convert ("{2KiB}b"));
assertEquals ("11", convert ("{1B 3b}b"));
assertEquals ("10000000", convert ("{ 10MB }B"));
assertEquals ("500", convert ("{ 0.5kB }B"));
assertEquals ("2", convert (" { 2048B 100B 3b }KiB "));
assertEquals ("2.098", convert (" { 2048B 100B 3b }KiB. ").substring (0, 5));

// Time (minutes, seconds, hours, days)
assertEquals ("600", convert ("{10min}s"));
assertEquals ("615", convert ("{10min 15s}s"));
assertEquals ("615000", convert ("{10min 15s}ms"));
assertEquals ("615001000000003", convert ("{10min 15s 1ms 3ps}ps"));
assertEquals ("70", convert ("{1h 10min}min"));

// Length (meters)
assertEquals ("0.5", convert ("{5mm}cm."));
assertEquals ("2", convert ("{2000mm}m"));

// Any other Si value
assertEquals ("0.5", convert ("{5m*}c*."));
assertEquals ("2", convert ("{2000m*}*"));

Here is a real life usage examples:

<bean id="monitorTask" class="org.springframework.scheduling.timer.ScheduledTimerTask"
p:period="{30s}ms" ... />

<bean id="monitor"
class="ru.toril.....model.Monitor"
p:maxAllowedIdle="{2h}ms"
p:maxAllowedSize="{2MiB}B"
p:minFreeSize="{2GiB}B"
p:maxSleepTime="{1min}ms" ... />

Saturday, August 4, 2007

Wow

JBoss 4.2.1 uses 120M of memory running on Java 5, while only 91M on Java 6. Only what I can guess is that Java 6 leverages some new memory page allocation strategy or may be I just wrong and there is something completely different :).

Also it means I've replaced Sun Application Server 9 (based on glassfish) with jboss, becouse Sun AS has been eating twice as more memory than JBOSS 4.2.1 and I've read that Sun Portal requires 2 GB of memory to run and a lot of dependencies!

IDE

Eclipse 3.3 has won my heart. I just enjoy programming in it as I've never been enjoing in any other (jdeveloper, idea 7, eclipse 3.2).

Monday, June 4, 2007

Recent Upgrade of Debian (intel's video driver problem)

Yesterday I did apt-get dist-upgrade. ion3 as usually rejected to work properly for its API changes. I was not surprised and fixed this technically. But next, what I had noticed right after upgrade, was the large fonts in opposite to ones before upgrade. Quickly I discovered that DPI was incorrect due to a wrong display size. But it took me an enormous amout of time to fix. At first, I tried obvious DisplaySize declaration in a Monitor section of xorg.conf file, yet with no luck. Reading forums, I found one mentioning xrandr util that controls X's RandR extension that, in turn, responsible for DPI. I modified my ~/.xsession adding "xrandr --screen 0 --fbmm 300x225" as the first command. Most of the fonts became smaller, yet fonts of GTK remanined the same. And only today I found out why. I had been using GDM. GTK (GDM relied on it) loaded DPI values before an execution of ~/.xsession took place. So, I added xrandr command into /etc/gdm/Init/Default. It helped.

Next I discovered XV was not working now (no picture, just blue rectangle instead), becouse of bug in intel's driver. This bug exists in xserver-xorg-video-intel-2.0.0-1, and it has been definitely fixed in xserver-xorg-video-intel-2.0.0-3.

Saturday, May 26, 2007

LooxLight & GoodWavPower

Minor update of utilities for PDA Fujitsu Siemens C550/N560.

Here is the new LooxLight version (2007-05-26). You may try it if you are enough annoyed with this message:
Error while starting: Return status 2 of ReqQueryValueEx
for hnd indicates error
lasterror=0
lasterror=0


Here is the new GoodWavPower version (2007-05-26). Message 'GoodWavPower: error play sound' is simply disabled.

New versions and latest news about LooxLight will be published right here.
Check for GoodWavPower updates here.

Recovering of Encfs Password

Whew. I've found all forgotten passwords for encfs with a help of the perl script:


#!/usr/bin/perl

use strict;
use warnings;

# these words are used as password components
my @words = (
"example", " ", "word", "123", "666", "pwd", "part1"
);

my @l = ();

sub mindex {
my $x = shift;

for (my $i = 0; $i <= $#words; $i++) {
if ($words[$i] eq $x) {
return $i;
}
}

return -1;
};

sub inc {
my $p = shift;
my $v = $l[$p];

unless (defined $v) {
$l[$p] = $words[0];
} else {
my $i = mindex ($v);
if ($i == $#words) {
$l[$p] = $words[0];
inc ($p+1);
} else {
$l[$p] = $words[$i+1];
}
}
};

while (1) {
inc (0);
my @ll = reverse @l;
my $pwd = join '', @ll;

open F, ">/tmp/1233";
print F "pwd\n";
close F;

print "$pwd\n";
system "encfs -S /tmp/encfsdir /tmp/mountpoint < /tmp/1233";
}


You may use it if you still know a vague shape of password you have lost.

Friday, May 18, 2007

Combinations

It seems to be simple, but it took me two hours to write this function. And now I know the true nature of things!
combr :: [[a]] -> [[a]]
combr [l] = map (\x -> [x]) l
combr (l : tl) = concat $ map (\ll -> map (:ll) l) $ combr tl

print $ combr [[1,2], [3,4], [5,6,7]]

[[1,3,5],[2,3,5],[1,4,5],[2,4,5],[1,3,6],[2,3,6],[1,4,6],
[2,4,6],[1,3,7],[2,3,7],[1,4,7],[2,4,7]]

Wednesday, April 18, 2007

Sat Underground

Indeed, there is a sad situation. If you want to watch Pay-TV you are going either to buy smart-card or to find a way to hack it. But you can't just hack it yourself. It is so much sophisticated, you need expensive equipment (card reader at least and card itself) and a HUGE amount of time. On one hand, it is obvious, if information concerning protocols/encryptions has been made public, soon it will be used by geeks to watch TV for free (if they have time for it at all). The number of geeks is vanishingly small and this amount of freebie-junkies doesn't affect a compony's income. Yet on other hand, it reveals ability for people to make illigal-cards and sell them. But it is still hard-core business. So what have we actually? Sadness and grief, that is what we have actually. Groups of commercial hackers fight each other for place under the sun. When one group has made enough money, it publishes algorithm and an EMU. EMUs are made as easy as everybody could use it! It hurts a cash of TV providers and they changes algorithm of encryptions as soon as possible... What can one do alone? The one can start from scratch inventing all wheels along a way of hacking. Or the one can join one of hacker-groups, having his worthy proved. I want to digg inside a new TPS algo, but I don't want to invent old wheels, spending my time :(. Money is evil!

Wednesday, April 4, 2007

Dreambox

After two days of using I broke my dreambox 500 (receiver for sat tv). It loops on booting. I have no ideas how to repair it, so I've chosen it to reflash. It is flashing now. Linux rocks.

The following crap appears on boot:
[...]
Multiplex thread got Data
Command='ZAP'
Zap data ,
Multiplex thread got Data
Dropping connection
active count=0
rc=0 '0,'
------------> changed! 0
no transponder 1 444
[TUNE] tune failed
Segmentation fault

Sunday, March 25, 2007

mmc

I've made a patch for MMC (mud client). With this patch, mmc supports 256 color space of xterm/rxvt/putty/..., broken terminals (no more "terminal cannot insert/delete characters") and keypad characters. Screenshort.

Tuesday, March 13, 2007

wtf

The code snippet from former coworker of mine. There are about dozen things like that:
if (System.getProperty("time.to.sleep").equals("null")) {
timeToThreadSleep = prefs.getLong(TAG_SLEEP, timeToThreadSleep);
System.out.println("....p: " + timeToThreadSleep + " millis" + " \t");
} else {
timeToThreadSleep = new Integer(System.getProperty("time.to.sleep")).intValue();
System.out.println("...p: " + timeToThreadSleep + " millis" + " \t");
}

OSD Desktop

Yet Another Long Deferred (for years) Post. At last I've recorded how a working upon my desktop looks like (640x480 10fps 2mb or 1024x768 10fps 6mb). The idea concerning osd'ish desktop had floated around for long, before I sat and wrote first lines of code. Due to a logical evolution of my desktop I had gotten used to work with any application in fullscreen mode. Things like clocks, bars and meters had quickly been rid from my desktop. Although I found myself in a world without notifications. I was happy. Then, OSD came to me as a solution to keep fullscreenness and be aware of events. Using python and osd library for it, I've implemented an events daemon. The daemon reads lines from the ~/log/events file and parses them using one of the following patterns:
  • string - add this string into a list of displaying strings.
  • [][][]\d\d\d\d: string - the same as previous case, but the string is visible for the \d\d\d\d (four digits) ms.
  • \d\d\:\d\d:\d\d: string - the same as first case, but with a date preceeding string. The date is not visible on OSD.
  • \d\d\:\d\d:\d\d: [][][]\d\d\d\d: string - The same as second case with the mark as in third case.
    Now it was a time to implement programs that would write to the ~/log/events file. First such program became aktimelog that writes time into the events log every 25 minutes. Others I've made: plugin for irssi to see either public, private or both messages, monitoring of keyboard layout changes, workspace switching, mail notifications, shell notifications. Also it is not needless to say that workspace switching is driven by shortcuts. For instance, if you press the MOD-e shortcut, in addition to switching workspace, ion3 checks whether emacs is runned and run it if it is not yet and you confirmed it for. I usually know where I have to switch to, and don't waste my time running through the list of open programs. So MOD-e is for emacs, MOD-p -- revelation, MOD-c -- eclipse, MOD-b -- browser, MOD-1 -- first terminal, MOD-2 -- second terminal... and so on. That is how my desktop works. But how does yours work? :)

    Sources.
  • Friday, March 9, 2007

    LPTRA

    And for EE fanatics I've implemented the resource adapter (JCA 1.5 with CCI), a right-way to access parallel port from inside EE applications. To use it, you need UParPort library installed. Then, simply deploy this RAR (resource adapter archive) into your application server. When you have done it, create a datasource for the LPTRA. You will have to specify pin names, while you are creating the datasource, like this: 1PinName=eye1, 2PinName=eye2 and so on. That's all. You may download the sources of the LPTRA as well.

    Example:

    @Resource (name = "eis/ParPort")
    private ConnectionFactory connFactory;

    Connection conn = null;
    try {
    conn = connFactory.getConnection();
    Interaction interaction = conn.createInteraction ();
    MappedRecord r =
    connFactory.getRecordFactory ().createMappedRecord ("");

    r.put ("eye1", true); // turn eye1 pin into the on state
    r.put ("eye2", false); // turn eye2 off
    interaction.execute (null, r);
    } catch (ResourceException e) {
    e.printStackTrace (); // Not sexy
    } finally {
    if (conn != null) {
    try {
    conn.close();
    } catch (ResourceException e) {
    e.printStackTrace (); // Not sexy
    }
    }
    }

    UParPort

    It had been a long time since I planned to publish this piece of software. Now here it is. UParPort - is the java library for accessing the parallel port (printer port) from inside a Java program. But unlike parport, it doesn't require root privileges. There is the main class UParPort in package ru.toril.uparport. It takes a device name as the constructor's agruments. And the device name should look similar to "/dev/par0" or "lpt1". When an instance of the UParPort class has been created, the following methods can be called on it: getData, getStatus setData, close. isClosed, toString. There are the binaries and the sources of the UParPort.

    Monday, March 5, 2007

    WM5DevSpy

    Here I've published the program intended to monitor device drivers of WM5. Actually, you don't need it if you are not a programmer-hacker. Thus you need it, if you are interested in an information about calls to a device drivers, such as function's arguments and a transferring data. The program has to be compiled before using (and yet again, if you don't know how, you don't need it). A device name is located in the WM5DevSpy.c and you would find it without extra work. I feel too lazy to write a good gui interface for it. As a bonus, this program describes each interrupt, showing a process and a thread of the process that handle interrupt. Feel free to ask.

    Instance of log:
    2007.02.22 00:15:32: Starting ------------------------------------------------------
    2007.02.22 00:15:33: interrupt 5 (abs 13): event struct at 8ffb2818, thread struct at 8efb4024, owner proc at 8c5976d0, proc name=NK.EXE, thread start addr=8c215240
    2007.02.22 00:15:33: interrupt 8 (abs 16): event struct at 8f7a5xf0, thread struct at 8e7a2a64, owner proc at 8c597ad0, proc name=gwes.exe, thread start addr=015c39b4
    2007.02.22 00:15:33: interrupt 9 (abs 17): event struct at 8f796yc4, thread struct at 8e785400, owner proc at 8c597ad0, proc name=gwes.exe, thread start addr=01e944e4
    [...]
    2007.02.22 00:15:34: fsDev_t at: 06048c50
    2007.02.22 00:15:34: LegalName: BAT1:
    2007.02.22 00:15:34: DeviceName: BAT1
    2007.02.22 00:15:34: BusName: BuiltInPhase1_0_26_0
    2007.02.22 00:15:34: DeviceKey: Drivers\BuiltIn\Battery
    2007.02.22 00:15:34: control (openData=0x00000001, code=0x00290400, inBuf=0x0806fa8c, inSize=0x00000004, outBuf=0x0806fa60, outSize=0x00000014, outUsed=0x0806fa20) -> 0x00000001
    2007.02.22 00:15:34: [ *outUsed : 0x00000018 ]
    2007.02.22 00:15:34: IN:
    2007.02.22 00:15:34: 01 00 00 00
    2007.02.22 00:15:34: OUT:
    2007.02.22 00:15:34: 00 08 5a 00 ff ff ff ff
    2007.02.22 00:15:34: ff ff ff ff 00 ff 00 00
    2007.02.22 00:15:34: ff ff ff ff ff ff ff ff
    2007.02.22 00:15:37: Calls to open function: 0
    2007.02.22 00:15:37: Calls to close function: 0
    2007.02.22 00:15:38: Calls to control function: 1
    2007.02.22 00:15:38: Calls to read function: 0
    2007.02.22 00:15:38: Calls to write function: 0
    2007.02.22 00:15:38: Calls to seek function: 0
    2007.02.22 00:15:38: Calls to powerup function: 0
    2007.02.22 00:15:38: Calls to powerdn function: 0
    2007.02.22 00:15:38: ----------------------- stop -------------------------

    Sunday, March 4, 2007

    LooxLight 2007-03-04

    LooxLight is a tool for PDA Fujitsu Siemens C550/N560 (click here to find more information).

    I've released new version of LooxLight. Changelog:
  • Full support for the GPS led.
  • Support for the Broadcom Bluetooth Stack.
  • Full support for the power led.
  • Better support for the keyboard led (it survives brightness changing).
  • The LooxLight service is not an EXE, but a DLL now. It is an improvement becouse wince has the limitation on amount of proccesses -- 32 processes.
  • Twice as smaller footprint than even before.

    The CAB archive zipped: here.
    The source code (GPLed): here.

  • New versions and latest news about LooxLight will be published right here.
    Another project helps reduce power consumption on Fujitsu-Siemens Loox N560/C550.

    Monday, February 19, 2007

    Virus 4 WinCE

    I have learned an internals of WM5 deeply. May be I have to recall older days and write a virus for it? Is it needed to enter kernel mode? No problem, there is the function SetKMode. Is it needed to read a memory of an application? No problem, just read it! Is it needed to intercept a system call, a driver, or an interrupt? And it is possible too. :)

    Sunday, February 11, 2007

    WM5EventSpy

    Today is the very productive day. Today I have implemented an util to monitor system events of Windows Mobile 5 (2005). If you run WM5EventSpy, it will create a file with the name \SD-MMCard\WM5EventSpy.log. There it will write names of all events registered by applications. Then it will wait for these events and then notify about signalled events to the log file. Here is a zip archive with the WM5EventSpy executable file inside (run it on your PPC). And here are its sources. Undocumented structures of WM5 kernel has been used in implemenation of this tool, that is why it doesn't work on other versions of OS.

    The following in an example of log file produced by WM5EventSpy:
    2007.02.11 22:28:36: Started ------------------------------------------------------
    2007.02.11 22:28:36: - - - - Start of event list - - - -
    2007.02.11 22:28:36: 1: 'WM5EventSpy/SomeEvent', manualreset=0, pIntrProxy=00000000
    2007.02.11 22:28:36: 2: '50650_ConnMgr', manualreset=1, pIntrProxy=00000000
    2007.02.11 22:28:36: 3: 'PluginInitialized', manualreset=0, pIntrProxy=00000000
    2007.02.11 22:28:36: 4: 'HistoryMappingsClosedEvent', manualreset=1, pIntrProxy=00000000
    2007.02.11 22:28:36: 5: 'CookiesMappingsClosedEvent', manualreset=1, pIntrProxy=00000000
    2007.02.11 22:28:36: 6: 'ContentMappingsClosedEvent', manualreset=1, pIntrProxy=00000000
    2007.02.11 22:28:36: 7: 'HistoryCloseMappingsEvent', manualreset=1, pIntrProxy=00000000
    2007.02.11 22:28:36: 8: 'CookiesCloseMappingsEvent', manualreset=1, pIntrProxy=00000000
    2007.02.11 22:28:36: 9: 'ContentCloseMappingsEvent', manualreset=1, pIntrProxy=00000000
    2007.02.11 22:28:36: 10: 'ActiveSync:Started', manualreset=1, pIntrProxy=00000000
    2007.02.11 22:28:36: 11: 'CE2STATEEVENT1', manualreset=0, pIntrProxy=00000000
    2007.02.11 22:28:36: 12: 'CE2COMMANDDONEEVENT', manualreset=0, pIntrProxy=00000000
    2007.02.11 22:28:36: 13: 'CE2COMMANDEVENT', manualreset=0, pIntrProxy=00000000
    2007.02.11 22:28:36: 14: '__SD_CARD_INOUT', manualreset=0, pIntrProxy=00000000
    2007.02.11 22:28:36: 15: 'tiacwlnControlReady', manualreset=0, pIntrProxy=00000000
    2007.02.11 22:28:36: 16: 'tiacwlnResponseToControlReady', manualreset=0, pIntrProxy=00000000
    2007.02.11 22:28:36: 17: '_LEAP_LIST_CHANGE', manualreset=0, pIntrProxy=00000000
    2007.02.11 22:28:36: 18: '_BT_STATE_OFF', manualreset=0, pIntrProxy=00000000
    2007.02.11 22:28:36: 19: '_BT_STATE_ON', manualreset=0, pIntrProxy=00000000
    2007.02.11 22:28:36: 20: 'WLANStateNotified', manualreset=0, pIntrProxy=00000000
    2007.02.11 22:28:36: 21: 'LooxLight/FlashlightEvent', manualreset=0, pIntrProxy=00000000
    2007.02.11 22:28:36: 22: 'LooxLight/SetupEvent', manualreset=0, pIntrProxy=00000000
    2007.02.11 22:28:36: 23: 'LooxLight/ExitEvent', manualreset=0, pIntrProxy=00000000
    2007.02.11 22:28:36: 24: 'SYSTEM\netui-TNETWLN1', manualreset=0, pIntrProxy=00000000
    2007.02.11 22:28:36: 25: 'WLANStatusHasChanged', manualreset=0, pIntrProxy=00000000
    2007.02.11 22:28:36: 26: 'ProfileStatusEvent', manualreset=0, pIntrProxy=00000000
    2007.02.11 22:28:36: 27: 'ConnMgrApiReady', manualreset=1, pIntrProxy=00000000
    2007.02.11 22:28:36: 28: 'DTPT_SRV_STARTED', manualreset=1, pIntrProxy=00000000
    2007.02.11 22:28:36: 29: 'BindingMapSharedMemoryEvent', manualreset=1, pIntrProxy=00000000
    2007.02.11 22:28:36: 30: 'All_Awake', manualreset=1, pIntrProxy=00000000
    2007.02.11 22:28:36: 31: 'BT_EVENT_SECURITY', manualreset=0, pIntrProxy=00000000
    2007.02.11 22:28:36: 32: '_KeyPress', manualreset=0, pIntrProxy=00000000
    2007.02.11 22:28:36: 33: 'Shell_Ready', manualreset=1, pIntrProxy=00000000
    2007.02.11 22:28:36: 34: '$*@DBChanged#%&', manualreset=1, pIntrProxy=00000000
    2007.02.11 22:28:36: 35: '$*@RegChanged#%&', manualreset=1, pIntrProxy=00000000
    2007.02.11 22:28:36: 36: 'SSTimeChange', manualreset=0, pIntrProxy=00000000
    2007.02.11 22:28:36: 37: 'SSUpdatePower', manualreset=0, pIntrProxy=00000000
    2007.02.11 22:28:36: 38: '$*EventInboxEnableSound*$', manualreset=1, pIntrProxy=00000000
    2007.02.11 22:28:36: 39: '$*EventInboxDisableSound*$', manualreset=1, pIntrProxy=00000000
    2007.02.11 22:28:36: 40: 'SSUpdateRecalc', manualreset=0, pIntrProxy=00000000
    2007.02.11 22:28:36: 41: 'SYSTEM\SipTimerActive', manualreset=1, pIntrProxy=00000000
    2007.02.11 22:28:36: 42: 'EventSounds_GlobalStopEvent', manualreset=1, pIntrProxy=00000000
    2007.02.11 22:28:36: 43: 'MS_GWE_TPC_cont_startup', manualreset=1, pIntrProxy=00000000
    2007.02.11 22:28:36: 44: 'MS_GWE_TPC_startup', manualreset=1, pIntrProxy=00000000
    2007.02.11 22:28:36: 45: 'TouchPanelCommandEvent', manualreset=0, pIntrProxy=00000000
    2007.02.11 22:28:36: 46: 'CgrTabletInnerEvent', manualreset=1, pIntrProxy=00000000
    2007.02.11 22:28:36: 47: 'CgrTabletEvent', manualreset=1, pIntrProxy=00000000
    2007.02.11 22:28:36: 48: '_SSP_INIT_OK_EVENT3', manualreset=1, pIntrProxy=00000000
    2007.02.11 22:28:36: 49: 'WatsonUploadClientReady', manualreset=0, pIntrProxy=00000000
    2007.02.11 22:28:36: 50: 'WALNStatusChangeEvent', manualreset=0, pIntrProxy=8f9fba3c
    2007.02.11 22:28:36: 50: 'system/events/bluetooth/PairingChange', manualreset=1, pIntrProxy=00000000
    2007.02.11 22:28:36: 51: 'system/events/bluetooth/HardwareChange', manualreset=1, pIntrProxy=00000000
    2007.02.11 22:28:36: 52: 'system/events/bluetooth/DeviceIdChange', manualreset=1, pIntrProxy=00000000
    2007.02.11 22:28:36: 53: 'system/events/bluetooth/ConnectivityChange', manualreset=1, pIntrProxy=00000000
    2007.02.11 22:28:36: 54: 'system/events/bluetooth/SecurityChange', manualreset=1, pIntrProxy=00000000
    2007.02.11 22:28:36: 55: 'system/events/bluetooth/ConnectionsChange', manualreset=1, pIntrProxy=00000000
    2007.02.11 22:28:36: 56: 'system/events/bluetooth/BasebandChange', manualreset=1, pIntrProxy=00000000
    2007.02.11 22:28:36: 57: 'system/events/bluetooth/StackInitialized', manualreset=1, pIntrProxy=00000000
    2007.02.11 22:28:36: 58: 'IP6_ROUTE_CHANGE_EVENT', manualreset=1, pIntrProxy=00000000
    2007.02.11 22:28:36: 59: 'IP6_ADDR_CHANGE_EVENT', manualreset=1, pIntrProxy=00000000
    2007.02.11 22:28:36: 60: 'TAPILINE00000000', manualreset=0, pIntrProxy=00000000
    2007.02.11 22:28:36: 61: 'IP_ROUTE_CHANGE_EVENT', manualreset=1, pIntrProxy=00000000
    2007.02.11 22:28:36: 62: 'IP_ADDR_CHANGE_EVENT', manualreset=1, pIntrProxy=00000000
    2007.02.11 22:28:36: 63: 'BTWCEShimShutdownThread', manualreset=0, pIntrProxy=00000000
    2007.02.11 22:28:36: 64: 'BTWCEShimFreeLibs', manualreset=0, pIntrProxy=00000000
    2007.02.11 22:28:36: 65: 'BTWCEShimLoadLibs', manualreset=0, pIntrProxy=00000000
    2007.02.11 22:28:36: 66: '_SSP_INIT_OK_EVENT2', manualreset=1, pIntrProxy=00000000
    2007.02.11 22:28:36: 67: 'Event_HS_PTT_Down', manualreset=0, pIntrProxy=00000000
    2007.02.11 22:28:36: 68: 'Event_HS_PTT_Up', manualreset=0, pIntrProxy=00000000
    2007.02.11 22:28:36: 69: 'CPUSpeed4lter', manualreset=0, pIntrProxy=00000000
    2007.02.11 22:28:36: 70: '_SSP_INIT_OK_EVENT', manualreset=1, pIntrProxy=00000000
    2007.02.11 22:28:36: 71: '_hLedChangeEvent_Name_', manualreset=0, pIntrProxy=00000000
    2007.02.11 22:28:36: 72: 'BackLightOverTempEvent', manualreset=0, pIntrProxy=00000000
    2007.02.11 22:28:36: 73: 'BackLightNormTempEvent', manualreset=0, pIntrProxy=00000000
    2007.02.11 22:28:36: 74: 'BackLightHighTempEvent', manualreset=0, pIntrProxy=00000000
    2007.02.11 22:28:36: 75: 'BackLightChangeEvent', manualreset=0, pIntrProxy=00000000
    2007.02.11 22:28:36: 76: 'BackLightActiveEvent', manualreset=0, pIntrProxy=00000000
    2007.02.11 22:28:36: 77: 'BackLightNotifyEvent', manualreset=0, pIntrProxy=00000000
    2007.02.11 22:28:36: 78: 'PowerManager/SystemIdleTimerReset', manualreset=0, pIntrProxy=00000000
    2007.02.11 22:28:36: 79: 'PowerManager/ReloadActivityTimeouts', manualreset=0, pIntrProxy=00000000
    2007.02.11 22:28:36: 80: 'PowerManager/UserActivity_Inactive', manualreset=1, pIntrProxy=00000000
    2007.02.11 22:28:36: 81: 'PowerManager/UserActivity_Active', manualreset=1, pIntrProxy=00000000
    2007.02.11 22:28:36: 82: 'PowerManager/ActivityTimer/UserActivity', manualreset=0, pIntrProxy=00000000
    2007.02.11 22:28:36: 83: 'SYSTEM/SystemStarted', manualreset=1, pIntrProxy=00000000
    2007.02.11 22:28:36: 84: 'system/events/notify/APIReady', manualreset=1, pIntrProxy=00000000
    2007.02.11 22:28:36: 85: 'SYSTEM/ShellAPIReady', manualreset=1, pIntrProxy=00000000
    2007.02.11 22:28:36: 86: 'SYSTEM/BatteryAPIsReady', manualreset=1, pIntrProxy=00000000
    2007.02.11 22:28:36: 87: 'SYSTEM/NLedAPIsReady', manualreset=1, pIntrProxy=00000000
    2007.02.11 22:28:36: 88: 'SYSTEM/CertChange', manualreset=0, pIntrProxy=00000000
    2007.02.11 22:28:36: 89: 'SYSTEM/BootPhase2', manualreset=1, pIntrProxy=00000000
    2007.02.11 22:28:36: 90: 'SYSTEM/DevMgrApiSetReady', manualreset=1, pIntrProxy=00000000
    2007.02.11 22:28:36: 91: 'SYSTEM/PowerManagerReady', manualreset=1, pIntrProxy=00000000
    2007.02.11 22:28:36: 92: 'SYSTEM/GweApiSetReady', manualreset=1, pIntrProxy=00000000
    2007.02.11 22:28:36: 93: 'LASS_SRV_STARTED', manualreset=1, pIntrProxy=00000000
    2007.02.11 22:28:36: 94: 'WatsonEventDumpFileReady', manualreset=0, pIntrProxy=00000000
    2007.02.11 22:28:36: - - - - End of event list - --- - - -
    2007.02.11 22:28:37: We are going to monitor 63 events!
    2007.02.11 22:28:37: We are going to monitor 31 events!
    [...]
    2007.02.11 22:28:56: Event 'PowerManager/ActivityTimer/UserActivity' is signaled, avgDelay = 54, count=10!
    2007.02.11 22:28:56: Event 'PowerManager/ActivityTimer/UserActivity' is signaled, avgDelay = 46, count=11!
    2007.02.11 22:28:56: Monitoring of 'PowerManager/ActivityTimer/UserActivity' is disabled, current count of monitoring events=69!
    2007.02.11 22:29:16: Event '$*@RegChanged#%&' is signaled, avgDelay = 0, count=1!
    2007.02.11 22:29:17: Event '$*@RegChanged#%&' is signaled, avgDelay = 24, count=2!

    Friday, February 9, 2007

    Synce & Linux & WM5 & Password

    In a time I developed for WM5 under linux, I found that it was hard and tiresome to copy executable file to PDA for testing. Files were copied to PDA either by using of MMC card or by mounting of PDA as USB Storage. Both ways are not convenient at all when you do such actions every five minutes. In addition, the executable had to be executed to see how it did its job. I executed it by my hands. Indeed, there is no need to say that after I had developed in windows and such actions had been done by batch files there, I was annoyed in linux enough. Then when I tried to find a better solution for testing process, I came to synce project. At first, it seemed that usb-rndis driver for kernel had to be downloaded, compiled and installed. I did it, but it failed on compilation. Short studies of site were needed to found out that there was the new driver "usb-rndis-lite" It did well this time. As the result of installation I got new network device: rndis0. Then it was needed to setup synce utils and libs. It was hardest thing to complete. I tried to follow to the instruction from the wiki. But odccm gave me errors about d-bus, hal and so on. Error were dumb.. i.e. they were without any meaning of what really happened wrong. Then I tried vdccm... and it seemed that success was not even near to partitial... There was only one good thing - vdccm started without errors :). It was silent and sad. I started to google for the word vdccm and after a while I found out that one had used triggerconnection util to notify ActiveSync. But in my hands triggerconnection had no effect neither on vdccm nor on ActiveSync. I had walked through sources of the triggerconnection, it looked like it sends a pocket to the port 5679 of PPC. Then PPC was scanned by nmap. And nmap told me that there was no open ports on PPC!! I had no idea why port 5679 was not opened while ActiveSync had been started. I was exhausted and tired. Alas, I had spent a lot of time trying to figure out why port 5679 had been closed, although, at last, it came to me that the port could stay open for a few seconds after a device was plugged into a cradle. Indeed, vdcomm detected plug-event when I had started triggerconnection right after a PPC was plugged into a cradle. This time it made clear that one problem hid another one. At once, vdccm was able to detect a plugged PDA, but it was unable to hold connection more than a several seconds. And none of synce utils worked while it was connected these seconds. Again I googled. Somewhere someone wrote that vdccm doesn't work when device is protected by password. "@!#%@#%*#$!!!" cried me. I didn't wish to have device unprotected or to unlock it each time I plug it into my cradle. I made this patch for vdccm, when I had done reverse engineering of ActiveSync authorization protocol and synce sources had been explored enough for it. And ourtime time had came, patched vdccm worked great! Wheee! So, what I have done at last:
    1. Installed usb-rndis-lite.
    2. Installed libs: librapi2, libsynce.
    3. Patched vdccm.
    4. Installed ifplugd. It runs ifup/ifdown for rndis0 as needed.
    5. Appended to /etc/network/interfaces:
    iface rndis0 inet static
    address 169.254.2.2
    netmask 255.255.255.0
    post-up /usr/local/bin/triggerconnection-delayed local-pda

    6. Added line '169.254.2.1 local-pda' into /etc/hosts.
    7. Wrote /usr/local/bin/triggerconnection-delayed:
    #!/bin/sh

    sleep 2
    exec /usr/local/bin/triggerconnection $@

    8. Following lineds added to ~/.xsession:
    vdccm -d 3 -f -t -p `cat ~/.pda-pwd` 1>>~/logs/vdccm 2>>~/logs/vdccm &

    9. Wrote my secret password into ~/.pda-pwd file (chmod 0600).

    Now I could enjoy with all useful utils like pls, pstatus..., install cabs and etc.

    It is all. Please, leave a comment if it was useful for you, or you have something to say about. Fell free to leave any kind of comment.

    P.S. The patch I made is not fully featured. I wrote it in a very straightforward way. It does not support pending of password, so you must specify your password with the -p key-option. I really have no time to implement it well, sorry.

    Tuesday, February 6, 2007

    Emulation of Fork in Windows OS

    The less we know, the better we sleep!

    It is terrible:
    Set up a pid in the shared memory area for the new child. Use setjmp() to capture state. First time (parent), set up some stuff and use CreateProcess to run a second copy of the same executable. The second copy will note in the shared memory area that it's a fork, and do the longjmp. They sync up and the parent copies all it's program memory to the child's address space. There's also code to reload dlls, map shared memory and mmap'd files, etc.

    Sunday, February 4, 2007

    LooxLight-2007-02-03

    LooxLight is a tool for PDA Fujitsu Siemens C550/N560 (click here to find more information).

    Update. I hope I fixed problem: owners of localized versions of WM5 were unable to install LooxLight. The error message is much more detailed now - it must help to understand cause of the problem if the problem still exists.

    Zipped CAB file (2007-02-03).

    New versions and latest news about LooxLight will be published right here.
    Another project helps reduce power consumption on Fujitsu-Siemens Loox N560/C550.

    Friday, February 2, 2007

    GoodWavPower

    It is my third program for pocketpc. It is simple and sudden even for me. While reading firstloox forum, I found that "When you suspend your Fujitsu-Siemens Loox N560 or C550 with power button (with some application executed) and then resume the PDA again, it will consume after resume ~40 mA more power than before!". One suggested to use "Start" button. I tried to discover why "Start" button helped and soon it made clear for me that it was due to a bug in the audio driver! The program is wrotten just to simplify workaround and make it more convenient and not annoying at all. Just install it and forget about mentioned problem. It will prolong your book reading time to about 3 hrs more.

    Zipped cab file (3k).
    Sources (GPL, 11k).

    Check for updates here.

    (another program that helps you reduce power consumption (drops 15 ... 40mA) is here)

    As usually, you are welcome for feedback.

    Thursday, February 1, 2007

    LooxLight


    I've done it! I wrote my second application for pocketpc. LooxLight is a tiny application which is intended to help you control lights (LEDs) of your FSC PPC.

    Features:
  • LooxLight provides controls for leds of: keyboard, wifi, bluetooth, gps, power. You can keep each led in its individual state. LooxLight can be set to continuosly keep led in ON/OFF state or just temporarily switch led to a desired state.
  • Small footprint. LooxLight service takes only 3.5k of memory when it is loaded. LooxLight doesn't waste CPU cycles: it does nothing, when there is nothing for it to do.
  • Command line operations. You can control leds from your scripts. No resident service needed to be loaded for command line operations. For instance, "LooxLightCtrl +keyb sleep100 -keyb sleep100 +keyb" winks you with keyboard.
  • Tested on Fujitsu-Siemens Loox N560 and Fujitsu-Siemens Loox C550. But AFAIK it must work on Loox 720 or Loox 718 as well.
  • I'll open it under GPL in a next few weeks, as soon as everything I plan to implement has been implemented.


  • Download zipped cab archive (17k).

    How to install and setup.
    1. Download the CAB file and copy it into your LOOX.
    2. Run the CAB on LOOX. Proceed with an installation process as usually.
    3. Go to Programs menu and click on the LooxLight Control icon.
    4. Setup it in accordance with your desires.

    Short description of dialog controls.
    KBD stands for KEYBOARD, BTH is abbr of BLUETOOTH word, PWR is the POWER word as you already suppose. Each line of controls is prefixed with name of led.
    "On" button just switches LED on and "Off" button switches LED off :). Blink means blink.
    "KEEP ON"/"KEEP OFF" means that LooxLight must reset state to required when some other program changed it to unwanted.

    Some controls are disabled for now, becouse they are not yet implemented.

    Command line options:
    LooxLightCtrl.exe ... , where opN is one of:
  • stop - tell service to exit
  • setup - tell service to reload settings from registry
  • sleep123 - sleep 123 milliseconds (where 123 is positive any integer)
  • flashlight - switch all lights on
  • +wifi - switch wifi indicator on
  • -wifi - switch wifi indicator off
  • +bluetooth - switch bluetooth indicator on
  • -bluetooth - switch bluetooth indicator off
  • +gps - switch gps indicator on
  • -gps - switch gps indicator off
  • +keyboard - switch keyboard light on
  • -keyboard - switch keyboard light off
  • +power - switch power indicator on
  • -power - switch power indicator off
  • =power - switch power indicator to blink mode


  • History:
    Oneday, I found out KeyLightC. It was useful program but it lacked in ability to turn on/off individual led without touching others. Also I had to run the KeyLightC when some program was changed state of leds or just after PPC was awaked. I mailed Phill McManus. I asked him for command line options like +keyboard or -keyboard. I asked him to open KeyLightC sources in order to add these features by myself. But he didn't answered me. So I started my own research. It took nearly twenty evenings, before I found how to control leds in right way. Then it took ten evenings to find out how to program for PPC in MS Visual Studio and to learn WinCE API. Next it took three days to abandon that ugly MS Visual Studio and migrate to nice mingw32ce under linux. After all, I have to say I hate Win32 API for its tons of caveats.

    TODO:
  • Implement flashlight mode (Sometimes darkness is not a friend of me).
  • Implement mechanism to keep power/gps leds in choosen mode.
  • Implement backlight control.


  • About firmware of Loox N560/C550.
    I am too tired of this post. I am going to describe it in a next post.

    Feel free to leave a comment with suggestions or information about how it works on your PPC (I am still not sure about 720/718).

    Latest news about LooxLight are HERE.
    Another project helps reduce power consumption on Fujitsu-Siemens Loox N560/C550.