SetPowerRequirement for accelerometers - Windows Mobile Software Development

Hi!
My application uses the accelerometer in unattended mode, which requires me to set a power requirement on the hardware. Since I own a couple of HTC devices it was easy to figure out what I needed for those:
SetPowerRequirement("ecs1:", D0, POWER_NAME | POWER_FORCE, null, 0);
Where ecs1 is built up from the following registry keys:
HKLM\Drivers\BuiltIn\GSensor\Prefix
HKLM\Drivers\BuiltIn\GSensor\Index
But since I'm using the Windows Mobile Unified Sensor API (http://sensorapi.codeplex.com/), which supports both Samsung and HTC devices I have no idea what the G-sensor driver is named on Samsung devices.
Does anyone know this or could help me figure it out? (I can send a test application). Its most likely a key in HKLM\Drivers\BuiltIn\ that contains the Prefix and Index values.
In the Unified Sensor API they use CreateFile() on "ACS1:", so it might be a key in HKLM\Drivers\BuiltIn\ that contains the Prefix ACS and Index 1.
Thanks in advance.

To cover all Samsung devices you need to use ACC1: and ACS1: (depends on device), so just SetPowerRequirement on all 3 (ACC1, ACS1 and ECS1).
There may be some issue with original Omnia 1 device, but others should work.

Related

HTC HD2 and Month Calendar - CListCtrl

Hi,
I have a program that uses Month Calendar controls. It works fine on any Windows Mobile 6.5 device, except HTC HD2 (Leo), where nothing is shown where the Month Calendar must be shown and because of this, SendDlgItemMessage(IDC_ROUTEDAYCALENDAR, MCM_GETCURSEL, 0, (LPARAM) (LPSYSTEMTIME)&iDate); returns an invalid iDate (0-00-65535). The program was made with embedded Visual C++ 4.0 using the PocketPC 2003 SDK, but the Calendar control is not shown even when I use the Windows Mobile 6 SDK with Visual Studio 2005, the symptom is the same: nothing is shown (just the window behind the calendar dialog).
The other thing that works fine with any Windows Mobile device except this, is a control that is derived from CListCtrl. This control is implemented in a .dll and sends user defined windows message to the app when the user changes a value in it. On the HTC HD2, this message is not received by the app.
Do you have any idea that can take me closer to the solution for these problems ?
Thanks,
Viktor
Hi,
I got the same problem with c# and VS 2008. It looks like that HTC has replaced the standard windows monthcalendar control with a custom made one and a lot of properties haven´t been implemented propertly like size, location aso. However the datetimepicker is working but looks strange since the calendar is allways fullscreen. So if you want to pick one date you can try to use that one.
Greatings
Sascha
Hi,
thanks for your reply. Now I use the datetimepicker control, but the problem is that the month calendar of the datetimepicker is shown at about 200%, most of it is out of the screen:
It is displayed by default...
Do you have any idea?
Hi,
sorry I haven´t check the forum for a while now.
I haven´t seen that problem bevor but maybe the problem is the formfactor of your usercontrol or form? I guess the autoresize of the control is not working correct so I would suggest to set the FromFactor to Windows Mobile 6 Professional VGA. Maybe that helps.
Greatings
Sascha
HTC HD2 Calendar Bug
Hi,
I have the same problem
The simple code :
m_MonthCalCtl = CreateWindowEx(0, MONTHCAL_CLASS, _T(""),
WS_BORDER | WS_CHILD | WS_VISIBLE | MCS_DAYSTATE,
0, 0, 0, 0, m_hWnd, (HMENU)ID_MONTHCAL, hInst, NULL);
works perfectly with others devices like :
- HTC Touch2 (WM6.5)
- Samsung GT-I8000 (WM6.5)
- ACER E-101 (WM6.5)
- HTC Diamond (WM6.1)
But with the HTC HD2, calendar appears in zoom mode.
We can't resize it.
Here a link to an image ( remove the space in the word "http" )
ht tp://img8.imageshack.us/i/htchd2m.jpg
ROM = 1.66.483.0 FRE
Radio = 2.06.51.07
Does anyone have a solution ?
Thanks
Cgdm
HTC adds a registry key in
[HKEY_LOCAL_MACHINE\System\GWE\Commctrl\CustomDateTimeCtrl] = \windows\htcDTP.dll
if you remove this registry key on the HTC HD2, everything will be ok.
Thanks for the registry key! Couldn't figure out why the latest 6.5 ROMs for TP2 were no longer working with my .NET applications where MonthCalendar was used. Removed the key and now everything is working.
Thanks! I removed the line and now I can access the WM 6.5.3 normal common built-in functions.
Now I have:
- The normal date/week picker (since HTC:s own doesnt show weeks - and I need see the week numbers in my work)
- The normal time picker. (which is quite good in 6.5.3)
Why is always HTC always removning many of the built in functions. In this case it means that developers can not build applications for all WM-platforms.
Cgdm said:
HTC adds a registry key in
[HKEY_LOCAL_MACHINE\System\GWE\Commctrl\CustomDateTimeCtrl] = \windows\htcDTP.dll
if you remove this registry key on the HTC HD2, everything will be ok.
Click to expand...
Click to collapse
This entry isn't in the WM6.5.3 ROM
Replace HTC calendar with the default Windows Calendar control.
Good for Developers. Works great. Thanks for the tip

[DEV] Interacting with Htc Blackstone Camera.

Hi all,
I'm trying to develop a program (VB and C.F.)for htc blackstone that would capture an image from his builted camera. The command for capturing image must be done programmatically and not manually. I want also obtain to set others capturing parameters (i.e. image size etc.) also programmatically.
Does anyone know if this is possible?
I am a little discouraged because it seems that this is not easyly possible (for Htc devices) because need specific Htc drivers and dll's (and is not available any documentation).
Is it true?
Thanks.

Debugging applications direct on device

Hello
What do I have to do, to debug the applications in Visual Studio 2008 direct on my smartphone, instead of using the emulators?
No problem. Switch the build to Debug and the target to the device itself, (depends on the SDK installed for your device), and build it. When you select Debug->Start, VS will install a few programs on the device, cemon.exe and a few others, if they are not aready there, which it uses to remotely control the app across the ActiveSync bridge.
In all honesty, the emulators are that good, there is virtually no difference between them and the phone itself. But the above method may be required to get some particularly troublesome bug uncovered.
Thanks, that is the answer I was searching for! It works great.

Thoughts on Unlocking custom GPU programs...

Hey,
Currently I've been working on a game for the Windows Phone but a couple things have really irritated me during porting, one of which is they don't allow custom GPU programs...which is very stupid considering there basiceffect class is completely useless.
The Windows Phone has some awesome hardware and it sucks that its being restricted by the dev team.
So right now I'm looking at microsoft.xna.framework.graphics in reflector(the GAC version not the reference version). The effect class itself is NOT marked as security critical, but the constructor is(because it requires compiled GPU bytecode to be passed down), so the logical why would be to load it via the contentmanager, but the damn thing spits out("You are unable to compile custom effects for winphone7).
My question is does anyone know where that error is actually located?
It looks like XNA is using a custom content importer to import some kind of template called "BasicEffectReader" , and "BuiltInEffectReader" . I don't know if I'm allowed to post reflected code on here, but if you open up BasicEffectReader.cs youll find that it creates a "cloned effect" from the BuiltInEffectReader.
My other questions are, is the bytecode for Windows Phone 7 different from the 360/Windows(I'd assume so), and if so is XNA actually compiling bytecode on the fly, is it using a template for basiceffect?
If it is requires its own bytecode, what kind of methods do you guys think would be feasible to be able to create custom effects? The graphics card on the phone should follow the DX9 specs, unless its a 9.5 hybrid like the 360.
EDIT3:
Alright it looks like if you compile it on another platform, strip out the contentmanager stuff at the start of the file, it will load(passes all the header checks) but it fails because UnsafeNativeMethods.Effect.GetGlobal(graphicsDevice).CreateEffect(pEffectCode, ((uint) effectCode.Length) - num2, graphicsDevice.pComPtr, out effect_desc); returns a invalid handle...
Very surprised they don't let you use custom GPU shader programs.
Yeah I know :/ anyway I kind of got a custom program loaded, but I'm not sure about the OpCodes, so I don't know how to customize it yet.
_effect = new Effect(device, Code);
static byte[] Code = new byte[] {
0xcf, 11, 240, 0xbc, 12, 0, 0, 0, 0, 0, 0, 0, 1, 9, 0xff, 0xfe,
0x62, 0x61, 0x73, 0x69
};
Click to expand...
Click to collapse
First Int(4 bytes) are the XNA header magic number,
Next Int(4bytes) byte offset to the code(from start of the buffer).
(Offset 12) - 1, 9, 0xff, 0xfe - FX Magic Number dx9 i believe.
Next 4 bytes are the IDENTIFIER for the effect. basi <-- basiceffect, skin <-- skinable effect etc.
Click to expand...
Click to collapse
Also what version of Direct3D is the phone running? Is it a 10/11 hybrid? cause in XNAFrameworkCore.dll it references D3D11CreateDeviceAndSwapChain and it also references CreateDXGIFactory1
Has anyone got PInvoke to work? The only way to get access to the HLSL compiler for the phone is through non-exposed API's in XnaFrameworkCore.dll.
When it creates the effect it looks for the unique four byte effect iden to create the shader internally(D3D_Effect_CreateHandle in XnaFrameworkCore.dll). So to get access to the HLSL compiler and compile our own effects it looks like we have to call some of the non-exported API's from the DLL. Which shouldn't be a problem if someone has found out how to get PInvoke to work( Not the COM dll hack but actually calling PInvoke. ).
EDIT
For anyone thats interested here are the different ID's(remember the hex is actually in reverse order):
.text:1003DF68 mov eax, [ebp+var_4]
.text:1003DF6B cmp eax, 69727073h
.text:1003DF70 jz loc_1003E086
.text:1003DF76 cmp eax, 69736162h
.text:1003DF7B jz loc_1003E05F
.text:1003DF81 cmp eax, 6C617564h
.text:1003DF86 jz loc_1003E038
.text:1003DF8C cmp eax, 6D766E65h
.text:1003DF91 jz short loc_1003E009
.text:1003DF93 cmp eax, 6E696B73h
.text:1003DF98 jz short loc_1003DFD7
.text:1003DF9A cmp eax, 74736574h
.text:1003DF9F jnz loc_1003E0B5
Click to expand...
Click to collapse
crozzbreed23 said:
Has anyone got PInvoke to work? The only way to get access to the HLSL compiler for the phone is through non-exposed API's in XnaFrameworkCore.dll.
Click to expand...
Click to collapse
A number of us have tried to do it, but have failed. The correct path is probably '\Windows\X.dll.' I haven't tried that yet. It's probably worth mentioning that even if you do get it working, Microsoft has sworn to reject any app that uses PInvoke.
I know the app would be rejected, I only want to build a portfolio project that I can take with me to a job interview.
Even though a lot of the HLSL code is in XnaFrameworkCore.dll, there is a d3dcompiler dll(which is compiled against D3D10). I know this is probably something that has been answered before, but is there a method for opening up the WM ARM dll's in IDA?
My thinking is this, we can launch executables but to get access to the OS dll's we have to build valid OS libraries. I wanted to try the COM dll method, but I don't have the phone yet and the emulator obviously won't load COM dll's.
If we can get as far as calling LoadLibrary than we can call:
D3D11CreateDeviceAndSwapChain
and
CreateFactory1
Click to expand...
Click to collapse
Than ASSUMING D3DCompiler.dll works(its not referenced in the XNAFrameworkCore except for loading in the HLSL sig), we can load custom GPU programs(that are HLSL based not effect based which is just fine...) as well as exposing more of the Direct3D API.
The only reason why I want all the graphics API's is so I don't have to create a portfolio project with baked lightmaps with bumpmapping built in. Its such a shame that the GPU on the phone is going to waste because they designed a very restrictive effect interface :/.
Its a pain but it has been but there are lots of reason why they are doing that. for one when the chassis requirements where released the minimum requirement is that the gpu had to do opengl. xna is built for direct x and hence the problem, some stuff had to be ported to opengl for it to work properly, the problem wiht this is that the new chips now have directx gpus with them, and i am not sure but i believe none of the wp7 phones that have been released has any of the directx acceleration. Becuase of this and compatibility with the later phones (atleast up to next year) some stuff had to go, custom shaders for one. But i believe if you work close with microsoft they actually give you the the ability to create custom shader. I have not played much with xna for windows phone, just on xbox so i am not to sure what i can do and not do. But your post was enlightening and i will go back to it after i finish my few apps.
Yeah your right. I just read up that they are using the ADRENO 200 GPU(http://developer.qualcomm.com/dev/gpu/processors), which supports opengl es, and "Direct3D Mobile" whatever that means. But that still doesn't explain why they didn't allow custom GPU programs because everything is still being compiled down to bytecode. If the GPU can do per-pixel lighting it is more than capable of bump mapping that reacts to lighting which is why I really want to see if I can maybe extend one of the .net effect classes, but I still haven't figured out if that would mess with any of the internal core functions.
But as I did with the XNA 360 code, I got access to the UnsafeNativeMethod classes inside the framework dll that expose all the native interfaces to the core. So basically I just skip passed all the XNA init code. The only thing that creates a problem with on the phone is that they use a "messaging service" to communicate with the framework, they build a byte[] array in the .NET code and pass it to the framework which parses it and does whatever it needs to do. On the phone, pointers aren't allowed, but I might just be able to use reflection to get the messaging code.
Also I thought of something, sense the GPU supports OpenGL ES and I know that someone has been able to create a window(the FS example on Chris's site), I wonder if we create a COM dll and link against the OpenGL ES library that we can just use OpenGL rather than the "non finished" d3d api? I would try that myself but I'm not going to be able to get the phone for a couple weeks and I havent found a way to get COM dll's to work in the emulator :/
Yeah your right. I just read up that they are using the ADRENO 200 GPU(http://developer.qualcomm.com/dev/gpu/processors), which supports opengl es, and "Direct3D Mobile" whatever that means. But that still doesn't explain why they didn't allow custom GPU programs because everything is still being compiled down to bytecode. If the GPU can do per-pixel lighting it is more than capable of bump mapping that reacts to lighting which is why I really want to see if I can maybe extend one of the .net effect classes, but I still haven't figured out if that would mess with any of the internal core functions.
But as I did with the XNA 360 code, I got access to the UnsafeNativeMethod classes inside the framework dll that expose all the native interfaces to the core. So basically I just skip passed all the XNA init code. The only thing that creates a problem with on the phone is that they use a "messaging service" to communicate with the framework, they build a byte[] array in the .NET code and pass it to the framework which parses it and does whatever it needs to do. On the phone, pointers aren't allowed, but I might just be able to use reflection to get the messaging code.
Also I thought of something, sense the GPU supports OpenGL ES and I know that someone has been able to create a window(the FS example on Chris's site), I wonder if we create a COM dll and link against the OpenGL ES library that we can just use OpenGL rather than the "non finished" d3d api? I would try that myself but I'm not going to be able to get the phone for a couple weeks and I havent found a way to get COM dll's to work in the emulator :/
You can pretty much give up on that one, the COM dlls for the phone are ARM assembly, but the emulator runs on x86. Not likely to work.

Registry Edit Apps for Dell Venue Pro

Have there been any tools written to work with the Dell Venue Pro for editing Registry?
All the registry hacks and programs written so far seems to be HTC specific, or at least only HTC compatible.
I can unlock my Dell Venue Pro with Chevron, deploy XAPs but I cannot modify the registry. Argh! No program I have tried can modify it.
Basically, I want to be able to spoof my Dell Venue Pro to an HD7 (just like what we've done with the HD2). - Maybe then my web2go plan can work the DVP after?
If not, IMEI spoofing is another consideration (but we all know why I can't ) - unless....
rebump. anyone?
Bump. I'm also interested in this. I would prefer a general WP7 registry hack though. It would help to keep development free flowing across devices.
dell - no com dlls...
ergo no provxml
no registry...it sucks
domineus said:
dell - no com dlls...
ergo no provxml
no registry...it sucks
Click to expand...
Click to collapse
sorry, i didnt understand that. can you reiterate? in layman's terms?
A com dll is a library for storing files that are shared between programs. Which brings me to my question. How can there be no com dll? We have read access to the registry but the write access is blocked right now. They are sharing essentially the exact same code with minor customizations for drivers and such. This does not remove the dll files from the device though. Or am I completely misunderstanding the idea of a dll file?
The LG, Samsung, and HTC phones have OEM-specific apps. To make those apps do useful work, the manufacturer has some COM DLLs exposing functionality not otherwise available to applications. Those COM DLLs are being exploited to create the hacks you see for other phones.
There are no Dell-specific apps and therefore no COM DLLs to exploit.
they do have some tmobile apps that come preloaded. can those work?
gosh! there must be some common exploit. this is stupid!
This is as close as an explot we can get the:
http://forum.xda-developers.com/showthread.php?t=929211
that is Dell's hidden diagnostic menu.
please someone find a way to hack this device!
Thanks for the clarification. I was not aware that the work around for ALL devices was coming from the pre installed manufacturer apps. Would the supposed password for the composite mode on the venue pro diagnostic mode be of any help? This is supposed to allow access to tethering according to pocketnow.com. The composite mode password is supposedly *#301# from what I have read.
Extremely unlikely.
The functionality exposed by the COM DLLs on Samsung HTC LG are things like being able to write to the registry and filesystem with elevated privs (to support provisioning apps and the like).
There is a com dll in the "connection setting" app from the store. Search for that title or "Dell" in the marketplace. Someone also posted the EM mode app. You could use that com dll as well

Categories

Resources