Resources | developer.brewmp.com Resources | developer.brewmp.com

Developer

resources

Developer Mode utility

Developer Mode is a USB settings utility application. Developer Mode allows the user to turn on the Qualcomm Developer Mode Gateway Driver on the device. This application works on the Simulator, as well as devices. However, it is recommended not to change the USB settings on the Simulator (leave setting as OFF).

Output

The Developer Mode screen sets radio buttons indicating the current setting of the USB device driver according to the registry. To change the setting, use the arrow keys or tap on the text adjacent to the radio button.

Requirements

To run ermodestresscpu, you need the following:

  • Brew MP 1.0 SDK rev 7.11.1 or higher
  • Brew MP-enabled device or a Simulator target
  • Installed copy of Sample Code from the SDK Manager

Sample code location

Filename

Location

Run application

ermodestresscpu

Sample code installation folder

  • Open the developermode.sln in Visual Studio.
  • Compile the applet.
  • Click the Click2Run icon.

Event handling

Developer Mode handles touch and keyboard events to allow the user to change the radio button settings for Developer Mode. Legacy mode allows the user to run the application on devices that do not support windows or widgets. For window and widget-enabled targets, the application also processes the rotation events.

Example

Developer Mode sets the USB setting on the device.

void SaveDefaultUSBSetting(USBController *pMe, char *pszCurrentSetting)
{
   int nErr = AEE_SUCCESS;
   IFile *pFile = NULL;
   ISettings* pISettings = NULL;
   const char szKey[] = {"/USBCompositor/USBCompSettings/Current/Value"};
   const char szKeyDefault[] = {"/USBCompositor/USBCompSettings/Default/Value"};
   char  szConfig[MAX_DISPLAY_STRING];
   char  szDefaultConfig[MAX_DISPLAY_STRING];
   boolean bWrite = FALSE;

   //if file already exists then leave
   IFileMgr *pIFileMgr = NULL;
   if (AEE_SUCCESS == ISHELL_CreateInstance(pMe->piShell, AEECLSID_FILEMGR,
                      (void**)&pIFileMgr) )
   {
      if (IFILEMGR_Test(pIFileMgr, "USBFactorySettings.bin") == AEE_SUCCESS)
      {
         bWrite = FALSE;
      }
      else
      {
         bWrite = TRUE;
      }
   }

   //open the class id file, and start reading the list
   if (bWrite)
   {
      pFile = IFILEMGR_OpenFile(pIFileMgr, "USBFactorySettings.bin",
              _OFM_CREATE);
      if (!pFile)
      {
         int iError = IFILEMGR_GetLastError(pIFileMgr);
         DBGPRINTF("USBFactorySettings.bin Open Error %d", iError);
         RELEASEIF(pIFileMgr);
         return;
      }
   }


   nErr = ISHELL_CreateInstance(pMe->piShell, AEECLSID_SettingsReg,
          (void **)&pISettings);
   if(AEE_SUCCESS != nErr)
   {
      DBGPRINTF("Error creating AEECLSID_SettingsReg");
      RELEASEIF(pFile);
      RELEASEIF(pIFileMgr);
      return;
   }

   nErr = ISettings_Get(pISettings,
                        szKey,
                        szConfig,
                        sizeof(szConfig),
                        NULL);
   if(AEE_SUCCESS != nErr)
   {       
      DBGPRINTF("ISettings_Get Error");
      ISettings_Release(pISettings);
      RELEASEIF(pFile);
      RELEASEIF(pIFileMgr);
      return;
   }

   STRCPY(pszCurrentSetting, szConfig);
   DBGPRINTF("Current setting : %s", pszCurrentSetting);

   if (bWrite)
   {
      if (0 == IFILE_Write(pFile, szConfig, STRLEN(szConfig) + 1))
      {
         int iError = IFILEMGR_GetLastError(pIFileMgr);
         DBGPRINTF("USBFactorySettings.bin Write Error %d", iError);
      }

      if (0 == IFILE_Write(pFile, "\n", STRLEN("\n")))
      {
         int iError = IFILEMGR_GetLastError(pIFileMgr);
         DBGPRINTF("USBFactorySettings.bin Write Error %d", iError);
      }
   }

   nErr = ISettings_Get(pISettings,
                        szKeyDefault,
                        szDefaultConfig,
                        sizeof(szDefaultConfig),
                        NULL);
   
  
   if(AEE_SUCCESS != nErr)
   {       
      DBGPRINTF("ISettings_Get Error");
      ISettings_Release(pISettings);
      RELEASEIF(pFile);
      RELEASEIF(pIFileMgr);
      return;
   }

   if (bWrite)
   {
      IFILE_Write(pFile, szConfig, STRLEN(szConfig) + 1);
   }
   if(AEE_SUCCESS != nErr)
   {       
      ISettings_Release(pISettings);
      IFILE_Release(pFile);
      RELEASEIF(pIFileMgr);
      return;
   }

   if (bWrite)
   {
      IFILE_Write(pFile, szConfig, STRLEN(szConfig) + 1);
   }

   ISettings_Release(pISettings);
   if (pFile)
   {
      IFILE_Release(pFile);
   }
   RELEASEIF(pIFileMgr);
}

Error handling

The application uses the following macros for error handling.

#define ERR_CATCH        __errcatch
#define ERR_TRY(x)  do{nErr = (x); 
   if(AEE_SUCCESS != nErr) goto ERR_CATCH;} while(0)
#define ERR_THROW(e) do { nErr = (e); goto ERR_CATCH; } while(0)
#define ERR_CHECK_PTR(p)      if (NULL == p) ERR_THROW(AEE_EFAILED);