PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

PocketHAL 1.0.5 Released

PocketHAL 1.0.5 is available.

- Fixed orientation issue with the following devices (all 320x240): Blackjack SGH-i601, Asus M530w, Samsung i320, Ubiquio 503g
- Fixed timer drift issue on the SPV E200

You can download PocketHAL here: http://www.droneship.com/downloads.html

Donators can obtain the registered copy (without the logo/banner) by e-mailing us.
We've got the problem on E-Ten X500 which happens on all versions of PocketHAL (tested 1.02, 1.04, 1.05).

We have lock-screen application, which consists of PowerDaemon (windowless unix-like executable which monitors power status) and PocketHAL application with user interface.

PowerDaemon uses
PowerPolicyNotify(PPN_UNATTENDEDMODE, TRUE);
to tell device is should go into unattended mode instead of power off.
When the device is about to power off, it notices someone wants unattended mode and instead of power off it switches screen off and tells powerdaemon, which in turn launches PocketHAL application, which after successful start tells PowerDaemon "screen is now locked" so PowerDaemon uses.
PowerPolicyNotify(PPN_UNATTENDEDMODE, FALSE);
to tell device it can finally turn off. This complicated approach is neccessary, we cannot simplify it.

It works 100% nice on all our test devices (2 HTC, 1 ASUS) except E-Ten X500 where the PocketHAL application laucnhed in unattended mode crashes on first display->Swap();

display->BeginScene() returns true
display->GetBackBuffer() returns some backbuffer and we successfully paint to it.
display->Swap() crashes...

My idea is you do some check in BeginScene but omit it in Swap, not expecting that between these methods device state can change so that Swap will crash?

I attach simplified PowerDaemon source code where it launches Fireworks.exe from /Temp. We use Fireworks as a "paragon" of an PocketHAL application for test, because it is obviously "doing everything as Kzinti supposed",
Attachments:
powerdeamon.zip (18 KB)
I cannot find anything wrong with EndScene(). I am wondering if the framebuffer address returned by GETRAWFRAMEBUFFER doesn't get unmapped / invalidated somehow.

What kind of crash is this? Access violation? Something else?

Do you have a callstack and/or address for the access violation?
OK, here is PocketHAL log together with information on access violation.
You were right - access violation writing framebuffer.

OEM String: "X500V03"
PocketHAL (Version 1.0.4)
Display::Create( hwnd = 7C08A3B0, W:0, H:0, O:0, S:1 )
Initializing display...
VideoDetect::DetectDrivers()
GDIDriver: Detect()
GDIDriver: Found W:240, H:320, D:16
VideoDetect: OS Version is 5.2
DriverVGA: Detect()
DriverVGA: Raw info: W:240, H:320, X:2, Y:480, FB:00410020
DriverVGA: Native orientation is 0
DriverVGA: Found W:240, H:320, D:16
DriverVGA: Offset is 0
DriverVGA: Final framebuffer address = 00410020
CreateDriver( 00000008 )
Initializing video driver...
DriverVGA: Initialize()
Driver initialized!
Success, returning display params to caller (W:240, H:320, O:0, S:2)
(...)
0040EB50 str r4, [r0], #4 <-- access violation - r0 points to 00410020 (framebuffer address)
Interesting. So the first log file you sent me says the framebuffer is at 003b0020. Now this second one says it is at 00410020. Both log files have the same OEM ID "x500v3", meaning it is indeed the same device.

I am wondering if the framebuffer gets remapped to a different address when you power off the device (or while you are shutting it down).

Or worst: what if you can't use GETRAWFRAMEBUFFER will shutting down? Then we would be in a pickle...

Question your "normal" log file also says its the x500v3 and the framebuffer is 47D00000... Does that mean it sometimes work and when it does, the address is 47D00000? I am confused.
The device is the same. And it was not soft-reset between tests.

If we run in normal power mode, frame buffer always starts at 0x47d00000

If we run in unattended power mode, frame buffer starts in diiferent locations, but all of them are close to application virtual addresses, it definetely does not look like memory-mapped hardware area.

I have just run Fireworks in unattended mode about 20 times. Most often I got 442000 but also 441000 and sometimes other similar values.

This all looks like bug in WM code specific to E-Ten, so may be we should just forget about it and just accept that PocketHAL applications cannot start on E-Ten in unattended mode.
BTW: May be this address is close to application heap address, because it is just some garbage remained in stack?

RawFrameBufferInfo rfbi = {0}; <-- Do you have this zero out?

ExtEscape(hdc, GETRAWFRAMEBUFFER, 0, NULL,
sizeof(RawFrameBufferInfo), (char *) &rfbi);

Excuse me if I discuss subjects I know very little about...
Yes I do clear that structure to zero properly.

It does look like a problem with the device and I am not sure I can do much about it.
OK, so be it, We'll just add this incompatibility to our product FAQ.
zzz · 14 May 2008, 12:11 UTC — Orientation on MotoQ 9C
Hi!

The orientation problems seem to be back again :( Now on Moto Q9C - it starts rotated 90 degrees, not in landscape mode.

Here s the log (from a logged RC2 version I had):

Code:
OEM String: "MotoQ9c"
PocketHAL (Version 1.0.4)
Display::Create( hwnd = 7C08E830, W:320, H:240, O:0, S:1 )
Initializing display...
VideoDetect::DetectDrivers()
GDIDriver: Detect()
GDIDriver: Found W:240, H:320, D:16
VideoDetect: OS Version is 5.2
DriverVGA: Detect()
DriverVGA: Raw info: W:240, H:320, X:2, Y:480, FB:49A00080
DriverVGA: Native orientation is 0
DriverVGA: Found W:240, H:320, D:16
DriverVGA: Offset is 0
DriverVGA: Final framebuffer address = 49a00080
CreateDriver( 00000008 )
Initializing video driver...
DriverVGA: Initialize()
Driver initialized!
Success, returning display params to caller (W:240, H:320, O:0, S:2)


Unfortunately, I don't own this device, it's a support request from one of the customers, but I hope this info would be enough.

Thanks in advance,
Anatoliy
Yes, this does look like the same problem the original MotoQ has. Stay tuned, I should be able to post a test version here tonight.
I can't believe companies are still releasing devices without testing them properly... Anyways.

I have implemented the classic Motorola Q fix for the Motorola Q9C. Can you give this version a try and let me know if it works properly? I have enabled logging so we can get updated information about the device.

<Deleted Test attachment>
Kzinti wrote:I have implemented the classic Motorola Q fix for the Motorola Q9C. Can you give this version a try and let me know if it works properly? I have enabled logging so we can get updated information about the device.


Thanks, Kzinti, but unfortunately it still starts rotated. Here is the new log:

Code:
OEM String: "MotoQ9c"
PocketHAL (Version 1.0.5)
Display::Create( hwnd = 7C0898D0, W:320, H:240, O:0, S:1 )
Initializing display...
VideoDetect::DetectDrivers()
GDIDriver: Detect()
GDIDriver: Found W:240, H:320, D:16
VideoDetect: OS Version is 5.2
DriverVGA: Detect()
DriverVGA: Raw info: W:240, H:320, X:2, Y:480, FB:49A00080
DriverVGA: Native orientation is 0
DriverVGA: Found W:240, H:320, D:16
DriverVGA: Offset is 0
DriverVGA: Final framebuffer address = 49a00080
CreateDriver( 00000008 )
Initializing video driver...
DriverVGA: Initialize()
Driver initialized!
Success, returning display params to caller (W:240, H:320, O:0, S:2)
That is weird, it didn't detect the device at all (hence no patch applied). Might be a bad build, I am not sure.

Here is another try:

<Deleted Test2 attachment>
OK, I found the problem. I did something really stupid in the detection code. Try this version and it should work this time.
Thanks again, Kzinti!!! it works like a charm now!

Here is the log:
Code:
OEM String: "MotoQ9c"
CoreDLL: Applying orientation fix for Motorola Q, Blackjack and friends
PocketHAL (Version 1.0.6)
Display::Create( hwnd = 7C085690, W:320, H:240, O:0, S:1 )
Initializing display...
VideoDetect::DetectDrivers()
GDIDriver: Detect()
GDIDriver: Found W:320, H:240, D:16
VideoDetect: OS Version is 5.2
DriverVGA: Detect()
DriverVGA: Raw info: W:240, H:320, X:2, Y:480, FB:49A00080
DriverVGA: Native orientation is 0
DriverVGA: Found W:240, H:320, D:16
DriverVGA: Offset is 0
DriverVGA: Final framebuffer address = 49a00080
DriverVGA: Motorola Q detected, overriding orientation to ORIENTATION_ROTATE90CW
CoreDLL: Applying orientation fix for Motorola Q, Blackjack and friends
CreateDriver( 00000008 )
Initializing video driver...
DriverVGA: Initialize()
Driver initialized!
RotationDriver: Initialize()
Success, returning display params to caller (W:320, H:240, O:0, S:2)


Could we have a non-logged version?
There is another bug I am trackin down. As soon as it is resolved, I will release 1.0.6.
Hi,

could you please remind me if there was already an orientation fix for MotoQ 9H? I'm a bit confused if the glitch is on my side or if it is like with all new MotoQs that PocketHAL does not know about.

Thanks,
Anatoliy
There isn't any MotoQ 9H specific code in PocketHAL. But I am also unaware of any problem with it.

Let me know if you need help tracking this down.
well, it looks like there is the same orientation problem as with other Qs. I'll check if I can get a log from one of those.
hrissan · 10 Mar 2009, 07:40 UTC — Orientation wrong on new device i-mate hummer
https://www.imate.com/product.aspx?product=810f

https://www.imate.com/support/Specs/SpecSheet_810-F.pdf

PocketHAL applications appear rotated so the application bottom is to the right. :(

The log is from version 1.0.4, but the problem is the same as on 1.0.5

OEM String: "ONTIM"
PocketHAL (Version 1.0.4)
Display::Create( hwnd = 7C07BE70, W:0, H:0, O:1, S:1 )
Initializing display...
VideoDetect::DetectDrivers()
GDIDriver: Detect()
GDIDriver: Found W:240, H:320, D:16
VideoDetect: OS Version is 5.2
DriverVGA: Detect()
DriverVGA: Raw info: W:320, H:240, X:2, Y:640, FB:4F626080
DriverVGA: Native orientation is 0
DriverVGA: Found W:320, H:240, D:16
DriverVGA: Offset is 0
DriverVGA: Final framebuffer address = 4f626080
CreateDriver( 00000008 )
Initializing video driver...
DriverVGA: Initialize()
Driver initialized!
RotationDriver: Initialize()
Success, returning display params to caller (W:240, H:320, O:1, S:2)
PocketHAL (Version 1.0.4)
Display::Create( hwnd = 7C07BE70, W:240, H:320, O:1, S:2 )
Initializing display...
CreateDriver( 00000008 )
Initializing video driver...
DriverVGA: Initialize()
Driver initialized!
RotationDriver: Initialize()
Success, returning display params to caller (W:240, H:320, O:1, S:2)
PocketHAL (Version 1.0.4)
Display::Create( hwnd = 7C07BE70, W:240, H:320, O:0, S:2 )
Initializing display...
CreateDriver( 00000008 )
Initializing video driver...
DriverVGA: Initialize()
Driver initialized!
Success, returning display params to caller (W:320, H:240, O:0, S:2)
The log looks normal...

hrissan wrote:PocketHAL applications appear rotated so the application bottom is to the right.


Can you be more specific? Is it upside-down? Rotated clockwise? Rotated counter-clockwise?

The above log shows that PocketHAL was initialized twice.
OK, attached is the picture of what happens on device.

We always call PHAL::Display::Create() with orientation returned by PHAL::GetShellOrientation(). If shell orientation changes, we destroy display and call Create again.

When we start on other devices, Create is called once.

But when we start on hummer, it looks like GetShellOrientation returns different values before and after Display::Create. (?) We do not have access to device, so we are not sure what happens exactly.

Also to help you some comments from i-mate: i-mate 810-F is one of the only phones in the world that has a "native landscape screen". Whilst other devices have screens that are positioned in a landscape orientation they are actually portrait screens rotated 90 degrees - ours is actually natively landscape. What this means is that our screen is 320 x 240 - whilst others are 240 x 320. The thing that may confuse your app is that 320x240 is considered the natural position of the screen (i.e. 0 degrees)
Attachments:
screenshot.PNG.zip (22 KB)
So then the display works properly... You initialize with orientation = 1 at first (and you get a 240x320 screens).

Then you initialize again with orientation = 0, which gets you a 320x240 screen. Again as expected.

There might be a problem with GetShellOrientation(). I will investigate tonight.
Ok, I compiled the yet-unreleased 1.0.6 with logging enabled. I also added some more logging for the shell orientation.

Can you give this one a try? I believe it will work as-is...
Attachments:
test_imate_810f.zip (61 KB)
Finally some feedback from i-mate team: "When the application started it was in portrait mode. Once I went to “MENU-ADD-APPLICATIONS” the screen rotated to the CORRECT landscape orientation."

We check ShellOrientation (and reset display if changed) in WM_SETTINGCHANGE (but this message did not fire) and also before opening any form or menu (exactly the described case).

Here is the log of new version from hummer (bad guy) and from qtek (good guy). It seems hummer is returning garbage instead of screen orientation? It fluctuates randomly... :(:(:(

We have an icon in Winterface which reads device orientation periodically to show it to the user, (but does not reset display if changed) that's why all this GetShellOrientations in the log.
Attachments:
hummer.TXT (8 KB)
qtek.txt (3 KB)
OK it sounds like PocketHAL thinks this is the usual 320x240 device that reports the wrong orientation (MotoQ, Blackjack, etc) and compensate for it (when it shouldn't).

I will take a look at the code over the weekend.

Isn't Windows Mobile development fun? Every device does it differently... =(
OK I just spend an hour on this and I think I understand what is going on. I found a bug in PocketHAL where GetShellOrientation() will return the wrong result (90 degrees of) until the first call to Display::Create().

You first call GetShellOrientation() and it returns "1" when it should be returning "0". You then initialize the display
Code:

Display::Create( hwnd = 7C08E780, W:0, H:0, O:1, S:1 )


That correctly returns you a portrait display:
Code:

Success, returning display params to caller (W:240, H:320, O:1, S:2)


You then call GetShellOrientation() and it now reports "0" where it was reporting "1" before.

See the next post for a fix.

As for why GetShellOrientation() changes over time... I have no idea. Perhaps something else on the device is changing the orientation?
OK, I implemented a fix. Please give it a try and let me know how it goes.

If this works, I will release this as 1.0.6.

This version will also produce a log.
Attachments:
testfix_imate_810f.zip (81 KB)
Finally this version WORKS FINE on i-mate hummer! :)

Here is another bug report from LG incite (this report is from products all running PocketHAL 1.0.5).
We'll try to send this user something assembled with latest 1.0.6 prerelease and get log files.

Winterface - This freezes in full screen mode but can work very smoothly (and fast) as a Today Plugin (in windowed mode without PocketHAL) showing the taskbar.
Weather - Freezes
FunContact - Freezes
SMS-Chat - Freezes
EyePhoto - Freezes

I wanted to try your applications due to their uniform interface and wanted to find better alternatives to S2U2, S2V, iContact and Pocket CM Contacts. Also, all of your applications a finger friendly and consistent in their looks (very simple yet sleek interface) which appeals to me very much.

My Device is :LG Incite (CT810)
Screen: WQVGA (240x400)
OS: Windows Mobile 6.1

It appears that the applications do work but the screen seems frozen, if I minimize the application using a hardware button and switch to it using the taskmanager, I can see that the screen has been updated with the latest button I tried to press within the application.
Eg:

I load up winterface and it freezes during startup loading animation. After this, I minimize it and switch back to it using taskmanager. Now I can see winterface menu. I press the options button (no screen update, seems frozen) and minimize the application and switch back to it. Winterface has actually shows the modal options dialog.
That's great news about the imate! I will release 1.0.6 shortly.

For the LG 810, see this thread:

http://pocketmatrix.com/forums/viewtopic.php?t=29054

I haven't been able to figure out what the problem is... But PocketHAL logs come back normal...
I'm going to disable optimizations on this device and just use GDI. Sounds like the only option until someone figure out what is wrong with that device.
We see interesting bug on the new i-mate devices (like Ultimate 6150).

If we launch any PocketHAL application and while it is running, the device is allowed to sleep (automatically by not touching anything) and spend about 20 minutes in sleep, then when the device is awoken, the screen contains the last rendered picture but no more rendering is happening. The application is running perfectly in "blind mode", so if we manage to blindly press appropriate buttons, appropriate actions take place. If this action switches off PocketHAL and goes into windowed mode (for example in SMS-chat, we press button to edit new message), then rendering continues in windowed mode without PocketHAL and then when PocketHAL device is recreated, everything works fine again.

Any ideas how to understand what's happening? Am I right that PocketHAL logs are no use to you, because they just report things at startup?
Yes the logs look normal and I can't see anything wrong with the imate.

I have disabled optimizations on the imate in 1.0.6. Give it a try and let me know if it works or not.