Windows Embedded CE and Windows Mobile (August 26, 2008)
Chat Topic: Windows Embedded CE and Windows Mobile
Date: Tuesday, August 26, 2008
Please note: portions of this chat have been edited for clarity.
Sue Loh [MS] (Moderator):
Welcome to today’s public chat. Our chat today covers the topic of Windows Embedded CE and Windows Mobile!
We are pleased to welcome our Experts for today’s chat. I will have them introduce themselves now.
Introductions:
MikeCal [msft] (Expert):
I'm Mike Calligaro and I'm a developer on the kernel debugger team.
Sing Wee [MS] (Expert):
Hi, I'm Sing Wee, part of the General Embedded BSP Test Team.
Greg Scott [MS] (Expert):
Hi, I'm Greg Scott, a developer on the Windows Mobile networking team.
Ryan Ward [MSFT] (Expert):
Hello, I'm Ryan Ward, a Test Developer for the Platform Builder IDE team.
Sue Loh [MS] (Moderator):
Hi, I’m Sue Loh, a developer in the Windows Devices Core team at Microsoft. I work on the remote tools team, and have previous experience with the kernel and file system. I’m also moderating today’s chat. I hope we can answer some questions for you today!
Neil [MS] (Expert):
Hi, I'm Neil Coles the developer lead for the Windows Mobile Security team.
GLanger_MS (Expert):
Hi, I'm Glen Langer, lead program manager for BSPs on the Windows Embedded CE Team.
russellk_MSFT (Expert):
Hi, I'm Russ Keldorph. I work on native C++ compilers and runtime libraries.
Matt Gosline [MSFT] (Expert):
Hi - my name is Matt and I am a developer on the CE base drivers team.
Rajran_MS (Expert):
Hi, I'm Rajeev Rangappa, a BSP PM in GE team.
Sue Loh [MS] (Moderator):
Let’s begin the chat!
Start of chat:
MikeCal [msft] (Expert):
Q: How to re-enable display backlight from code? Pressing the touch-screen works, pressing USB-keyboard keys doesn't.
A: Are you the OEM writing the keyboard driver or as ISV trying to write an app that uses the keyboard?
MikeCal [msft] (Expert):
Q: I'm bit of both; I have customers that want to enable their backlight because of some serial bytes coming in. to be exact: they want to be able to re-enable backlight from native code...
A: Okay, I believe you have two options. If you want to make the device think a key was pressed (so the backlight will come on and then time out after the normal amount of time) call PowerPolicyNotify with PPN_APPBUTTONPRESSED. If you want to force the backlight to turn on and keep it on until you tell it to go back off (ie, the user is watching a movie and not touching buttons) you can call SetPowerRequirement on the backlight driver (which will be named "BKL1:")
Sue Loh [MS] (Moderator):
Q: Why does it take so long to get the transcripts for these chats posted?
A: Sorry, I should take some of the responsibility for that. It is because our chat tools are not very sophisticated, so we have to manually post process the discussion to turn it into a coherent Q&A stream. I have to do that, and it means I have to find time out of my "day job" to do it. I am several months behind right now, and I apologize.
Matt Gosline [MSFT] (Expert):
Q: If I'm booting Windows CE (debug build) from USB flash, should I be able to see the debug messages from the serial port? What baud rate should I be using? Also, do you know which file controls the debug output if I want to change the IO address?
A: Are you using loadcepc on an x86 platform? The default for CEPC is 38400 baud.
Matt Gosline [MSFT] (Expert):
Q: Yes, I'm using loadcepc on x86. Do you know where I can change the IO address for the serial port if I want to send serial debug to another port?
A: Shawn, only the legacy COM1 and COM2 ports are supported.
Matt Gosline [MSFT] (Expert):
Q: Can someone point me to which file sends the debug characters out the serial port in the kernel?
A: Take a look at OEMInitDebugSerial and OEMWriteDebugByte.
jaspet_MSFT (Expert):
Q: Can someone point me to which file sends the debug characters out the serial port in the kernel?
A: There are a few files where the debug output is sent to the serial port. Most of it is in the OAL. Look for the functions OEMWriteDebugString and OEMWriteDebugByte in the OAL. OEMWriteDebugString is in public\common\src\common\other\debug.c, and OEMWriteDebugByte is in platform dependent code (for X86 it is at public\common\src\x86\common\other\debug.c)
Sue Loh [MS] (Moderator):
Q: How do I know if the PB is using multiprocessor compilation? I see "BUILD:[01:000000007: PROGC ]", does the "01" indicate that it's using processor #1, etc.?
A: Close, the "01" is the thread number, not the processor number. You can open a command line window and check the value of the BUILD_DEFAULT variable; mine is set to use 3 threads, so my BUILD_DEFAULT value includes "-M 3". (I have a 2-proc PC, and the recommended setting is 1 greater than your # of processors)
MikeCal [msft] (Expert):
Q: On the multiprocessor build, if I have a machine with hyperthread capabilities, should "-M" still be 1 greater than the number of processors or 1 greater than the number of "virtual" processors?
A: Hi Monique. Hyperthreading is effectively multiproc, so you should use the number of "virtual" processors. Here's something else that you might try. In our current environment, setting -M to 0 makes the system figure out how many procs to use automatically. We can't remember when that feature went in though, so we don't know if you have it. You might give it a try though and see if it works for you.
Sue Loh [MS] (Moderator):
Q: Porting from CE 5.0 to CE 6.0: how bad is to simply put ALL the drivers in kernel mode?
A: We can't really give you a solid answer on that... How many security bugs do those drivers have? :-) It's all about managing risk. If your device is locked down in other ways, like it'll never run 3rd party software or allow miscellaneous hardware to be connected to the ports, maybe it's not so bad. I know the majority of drivers still DO run in kernel mode, but we try to limit risk where we can, by moving drivers which are either highly risky or simply easy to move, to user mode.
Sue Loh [MS] (Moderator):
Q: Does CE 6 handle the Hive registry different than CE 5? On the same platform, a CE 6 flush to the registry takes quite a bit longer than it did on CE 5. Could you recommend any places to look?
A: The code is about the same, but I think we might have recently found a bug in the CE6 code that was preventing it from using "gathered" flushes (WriteFileGather()) which are a lot more efficient. I'm not entirely sure -- I think I will have to take this onto email with you and double check with the file system team. I'll private-message you my email address.
Andrew Rogers [MS] (Expert):
Q: Does CE 6 handle the Hive registry different than CE 5? On the same platform, a CE 6 flush to the registry takes quite a bit longer than it did on CE 5. Could you recommend any places to look?
A: We did recently find a bug in the memory-mapped file code which prevented the faster WriteFileGather flush mechanism from being used for registry and CEDB flushing. This issue has not yet been fixed in CE6, so my recommendation would be to work with Microsoft product support to request a patch be released for issue. This is a fairly easy fix for us to make, but it requires your going through the official support request channel.
MikeCal [msft] (Expert):
Q: I am getting some filesystem corruption (TFAT) during power on/off. I suppose that it happen when the flash writing is broken. Could you give me advice about a wait to handle this problem? Mainly I am getting corruption in my hive registry...
A: We'll need more information about what kind of device you're using. Is it Windows Mobile or General Embedded? If WM, is it PocketPC (suspend/resume) or Smartphone (always on)? Are you the OEM who is writing the flash driver or are you seeing this on someone else's BSP?
MikeCal [msft] (Expert):
Q: Hi Mike, is a NOR Flash WinCE 5.0 device, I do not implement any special PW (only power on/off). and yes, I have the sources of the FMD driver... The driver writes some signatures in the flash sectors...
A: NOR has the ability to execute in place (XIP). If you do that, you need to either make sure the code that's XIPing is on a different flash chip than the storage, or you need to use intel's IPSM flash driver instead of TFAT. Do you know if your code is being XIPed or if any code is running in place (maybe the radio stack)?
MikeCal [msft] (Expert):
Q: Hi again Mike, I do not use XIP... AFASK I need to implement some kind of transaction at the FMD level, since the FS only protect the FAT table..
A: Not XIPing makes things easier, yes. (-: You're correct that TFAT only transacts the FAT table. You won't be able to really add a higher level trasaction because the apps would need to be changed to take advantage of it. At best you could transact a single call to WriteFile, but imagine an app that calls WriteFile once at the beginning of a file to refer to something it's about to write later in the file and then calls WriteFile again with the later data. If power is cut between those two writes, the file is corrupted no matter how transacted the filesystem is. To protect against something like that, the app would need to do something like say, "I need everything from now until I say I'm done to be transacted." Back to your problem, on power down, the registry should be getting flushed. You should check your driver and see if you're allowing the flush to complete before the system shuts down. As a driver, you have the ability to keep the system from suspending until you're done.
MikeCal [msft] (Expert):
Q: Hi again Mike, I do not use XIP... AFASK I need to implement some kind of transaction at the FMD level, since the FS only protect the FAT table..
A: I got more information from one of our FMD guys. "Since they’re using NOR they need to implement a block signature mechanism in their FMD to make sure that FMD_EraseBlock operations are atomic. Losing power in the middle of an erase can lead to file system corruption unless they do this. The sample stratafmd code included with WM5 does this, but I believe the sample code shipped with CE 5 does not."
murtuzab_MSFT (Expert):
Q: We develop a media application using DirectShow on CE touch panel. Sometimes, during playback of WMA lossless songs, the CE device's CPU usage goes to 100% and the playback sound starts jittering. Can you advice what can cause this to happen?
A: Hi George, this can happen due to a number of reasons. What else is running on the system? Are you using the WMA codec on the system or is the codec from another source?
murtuzab_MSFT (Expert):
Q: I'm working with CE 6R2, and I'm writing a DS Filter with IOverlayNotifyInterface. The matter is that if I'm able to receive OnPositionChange notifications, I'm not advised of OnClipChange? Yet, I ask the IOverlay to advise me with ADVISE_ALL.
A: Can you try enabling the first three debug zones for quartz.dll and running your scenario again.
murtuzab_MSFT (Expert):
Q: Thx. I tried to call "IOverlay::GetClipList" manually, but it fails with an undefined error (0x8004005)? I reach a debugbreak in COverlay::GetVideoClipInfo, but I don't have the source code and can't debug deeper.
A: This is the right behaviour, unfortunately the documentation on MSDN is wrong. I'll work on getting the documentation updated.
Sue Loh [MS] (Moderator):
Q: Can anyone please provide direction on remote display the devices? I mean something like PoweToys. I need to build using .NET CF 2.0 so that I can see the activities on device screen on a desktop. well, yeah I am talking abt Pocket PC. I know by installing powertoys on devices and my desktop I can do that. Powertoys requires .NET 3.5 CF
A: The PowerToy can let you see the display, and there are other 3rd party solutions (I think there's one from SPB Software and another from Entrek) to let you view and control the device screen. I guess I don't understand what you mean about building using .NET CF 2.0. You want to programmatically control it from the desktop side using managed code...?
MikeCal [msft] (Expert):
Q: Hello everybody how can I debug Mobile App using Windbg?
A: Mobile apps are written in ARM and, to my knowledge, WinDbg only supports x86. The right way to debug Mobile apps is to use either Visual Studio (if you're an ISV) or Platform Builder (if you're an OEM).
Sing Wee [MS] (Expert):
Q: Hello everybody how can I debug Mobile App using Windbg?
A: Also, if you're doing debugging when the device is halted (in break state), be sure to look into using the CeDebugX debugger extension: https://msdn.microsoft.com/en-us/library/bb509784.aspx
MikeCal [msft] (Expert):
Q: How can I generate minidumps from crashed apps? (Windows Mobile)
A: If you're connected to PB, you can pull down the "Debug" menu and select "Capture Dump File." If you're not connected to PB, you need to have Watson set up on your device. Then you can either generate an exception or call CaptureDumpFileOnDevice() from your code.
Greg Scott [MS] (Expert):
Q: I want to support RNDIS client in my device. I read in the NGs that it is very tricky to configure it under WinCE 5.0/6.0, due to the assignment of the IP address. It is true? It is so, how can I handle it?
A: I'm not aware of any specific addressing issues regarding RNDIS. IP address assignment happens at a higher level in the stack and should be agnostic to the underlying miniport driver. There are different ways to handle this (static IP, DHCP, auto-IP). I'm not an expert on this but you should be able to find more info on MSDN and follow up on the newsgroups if you have questions or issues.
Neil [MS] (Expert):
Q: How can I write SmartCard applications in Windows CE?
A: For an overview of Smartcard support on Windows CE, see https://msdn.microsoft.com/en-us/library/aa925922.aspx.
MikeCal [msft] (Expert):
Q: For ActiveSync, which gives best throughput to the remote device - USB Serial or USB RNDIS? Is there any white paper or other report on factors to consider when choosing between the two?
A: We've had a lot of difficulty with RNDIS. We've found that many desktop machines don't handle it well, which caused a lot of active sync users headaches. We generally prefer USB Serial, especially the new WinUSB model in Vista.
Travis Hobrla [MS] (Expert):
Q: Why is IOCTL_SERIAL_SET_QUEUE_SIZE not implemented in mdd.c of the PQ Serial driver, but still returns a success code even though it does nothing?
A: Is this CE5? Looking at the CE6 code it sets INVALID PARAMETER and returns false.
Sing Wee [MS] (Expert):
Q: what is CETK Tests ?
A: This is the Windows Embedded CE Test Kit: https://msdn.microsoft.com/en-us/library/aa934065.aspx
MikeCal [msft] (Expert):
Q: If designing a new portable device/OAL for CE, is a software based device reset preferred over hardware based reset or some sort of hybrid (from experience, best practices)?
A: Software based reset won't help if you have a spinner running at higher priority than the reset software. If you're going to go to the trouble of putting in a reset, I'd make it hardware. That said, if you have persistent storage and a removable battery, I'd skip the reset alltogether. The majority of users pull their battery out when the device hangs. It's a smaller subset that understand that the little pinhole on the side is a reset button. Since they're going to pull their battery anyway, you don't need the reset.
Sue Loh [MS] (Moderator):
Q: is there any spy++ application for Mobile?
A: If you're an OEM, Platform Builder 5 came with Remote Spy, which could list windows etc. on the remote device, but that was only available to OEMs, and it stopped being supported in Platform Builder 6. There is the Entrek (3rd party) CodeSnitch which is similar (and may also not work on CE6? I'm not sure). You can look around for other 3rd party solutions but those are the ones I know of. What kind of app spying are you trying to do?
KenSadah_MSFT (Expert):
Q: is there any spy++ application for Mobile?
A: Visual Studio also has a version of Remote Spy. However, message trapping capabilities are limited...
Sing Wee [MS] (Expert):
Q: is there any spy++ application for Mobile?
A: Another thing to look into is using CeDebugX in break state to enumerate the list of windows (and gdi objects): https://msdn.microsoft.com/en-us/library/bb509961.aspx
Sue Loh [MS] (Moderator):
Hello everyone, we are just about out of time. Thank you for joining us for our Windows Embedded CE 6.0 and Windows Mobile chat today!
A sepcial thank you to the product group members for coming out. We’ll see you again for another chat next month. Please check https://msdn.microsoft.com/chats for the list of upcoming chats.
If you still have unanswered questions, let me suggest that you post them on one of our newsgroups, such as Microsoft.public.windowsce.platbuilder.