Yesterday was the last day for my team mate Ankit in Accord.
He is all set to start off a new career and may be even in a new path in his new company - MindTree. All the best for you Ankit
Labels: accord, fun at work 2 comments
Hi guys,
Here is a code for changing the current usb client function from Serial to Mass storage dynamically.
/*
* #FUNCTION
*
* @Function: GetUfnController
* @Return: INVALID_HANDLE_VALUE - USB Function device was not found
* Otherwise, if found
* @Parameters:
* @Description:
* Function to get the handle of a USB Client device.
*/
HANDLE GetUfnController()
{
HANDLE hUfn = NULL;
// Get a handle to the bus driver
DEVMGR_DEVICE_INFORMATION di;
memset(&di, 0, sizeof(di));
di.dwSize = sizeof(di);
#ifdef _SEARCH_WITH_GUID_
BYTE rgbGuidBuffer[sizeof(GUID) + 4]; // +4 because scanf writes longs
memset(&rgbGuidBuffer[0],0,sizeof(GUID) + 4);
LPGUID pguidBus = (LPGUID) rgbGuidBuffer;
LPCTSTR pszBusGuid = _T("E2BDC372-598F-4619-BC50-54B3F7848D35");
// Parse the GUID
if (FALSE == ConvertStringToGuid(&pszBusGuid[0],pguidBus) )
return INVALID_HANDLE_VALUE;
HANDLE hf = FindFirstDevice(DeviceSearchByGuid, pguidBus, &di);
#else
HANDLE hf = FindFirstDevice(DeviceSearchByLegacyName, L"UFN1:", &di);
#endif /* _SEARCH_WITH_GUID_ */
if (hf != INVALID_HANDLE_VALUE) {
hUfn = CreateFile(di.szBusName, GENERIC_READ, FILE_SHARE_READ,NULL, OPEN_EXISTING, 0, NULL);
CloseHandle(hf);
}
else {
hUfn = INVALID_HANDLE_VALUE;
}
return hUfn;
} /* GetUfnController */
/*
* #FUNCTION
*
* @Function: ChangeClient
* @Return: TRUE - Client Function change was succesful
* FALSE - Client Function change failed
* @Parameters:
* hUfn - Handle to the USB client device
* pszNewClient - New usb function to be loaded
* @Description:
* Function to switch the active usb client function driver
*/
BOOL ChangeClient(HANDLE hUfn, LPCTSTR pszNewClient)
{
if(hUfn == INVALID_HANDLE_VALUE || pszNewClient == NULL)
return ERROR_INVALID_PARAMETER;
DWORD dwRet = ERROR_SUCCESS;
UFN_CLIENT_NAME ucn;
_tcscpy(ucn.szName, pszNewClient);
BOOL fSuccess = DeviceIoControl(hUfn,
IOCTL_UFN_CHANGE_CURRENT_CLIENT, &ucn, sizeof(ucn), NULL, 0, NULL, NULL);
return fSuccess;
} /* ChangeClient */
Labels: activesync, drivers, usbclient, wince 0 comments
/*
* #FUNCTION
*
* @Function: ConnectionStatus
* @Return: TRUE - Active sync session is active
* FALSE - Active sync session is not detected
* @Parameters:
* @Description:
* Function to Check the connection status of ActiveSync
*/
BOOL ConnectionStatus(VOID)
{
RASCONN rsconn[10];
DWORD dwcb, dwConnections;
RASCONNSTATUS rasStatus;
BOOL bConnected = FALSE;
// Enumerate active connections
dwcb = sizeof(rsconn);
rsconn[0].dwSize = sizeof(RASCONN);
if(RasEnumConnections(rsconn, &dwcb, &dwConnections) == 0) {
if(dwConnections == 0 || rsconn[0].hrasconn == NULL) {
DBG_PRINT ("No current connections\r\n");
}
else{
// Get first RAS connection status
rasStatus.dwSize = sizeof(rasStatus);
if(RasGetConnectStatus(rsconn[0].hrasconn, &rasStatus) != 0) {
DBG_PRINT ("Could not get RAS connection status\r\n");
}
else{
// Is it connected?
if(rasStatus.rasconnstate != RASCS_Connected) {
DBG_PRINT("Not connected\r\n");
}
else {
if ((0 == wcscmp(L"direct",rasStatus.szDeviceType)) &&
(0 == wcscmp(L"Serial on USB",rasStatus.szDeviceName))) {
DBG_PRINT(TEXT("Got an activesync connection..\r\n"));
bConnected = TRUE;
}
}
}
}
}
else {
DBG_PRINT ("Could not enumerate RAS connections\r\n");
}
return bConnected;
} /* ConnectionStatus */
Labels: activesync, tutorials, wince 0 comments
I will explain on how to connect development pc to a board running windows ce 6.0 os image using Activesync. The development board that I used is similar to the Mainstone III development platform (based on a Marvell PXA 270 processor) and activesync is configured to connect over the USB client port.
Previously when I was trying to connect to my development board using activesync from remote tools, i was getting error message that " Unable to load device side components". The samething happens while I was using CETK. But Sctivesync was connceting properly. Then I started digging into discussion forums for finding a solution to this problem. Here is what I found:
- Open C:\Program Files\Common Files\Microsoft Shared\Windows CE Tools\Platman\target\wce600.
- Create a folder armV4 and copy the contents of armV4i into this one.
- Now Open Kernel Tracker or any remote tools.
- Then follow the same steps specified by Sue in her blog post.
NOTE: Special Thanks to Sue Loh (Windows CE Base Team Blog) and Yan Sun (CE 6.0 and PlatMan remote tools)
Labels: cetk, debugging, performance monitor, wince 2 comments
In this post, I will explain about how I debugged a problem in which our development board was taking a lot of time to completly boot up into Windows CE.
If we are not clear with the source of the problem, then individually eliminating each component one-by-one and observing the behaviour is a straight forward but time consuming way.
Using Celog
[HKEY_LOCAL_MACHINE\init]"Launch05"="CeLogFlush.exe" -- include celog.dll[HKEY_LOCAL_MACHINE\System\CeLog]"Transport"="LocalFile""FileName"="celog.clg""BufferSize"=dword:100000 // 1MB"ZoneCE"=dword:815263"FlushTimeout"=dword:1388 // 5 seconds"FileFlags"=dword:1 // Keep file open"ThreadPriority"=dword:C8 // Priority increased to 200
Labels: celog, debugging, drivers, performance monitor, wince 0 comments
Here is another really informative article by the Windows CE Base team.:)http://blogs.msdn.com/ce_base/archive/2007/11/26/How-does-Windows-Embedded-CE-6.0-start_3F00_.aspx