@echo off
REM * Copyright 2012, 2013 Broadcom Corporation -- http://www.broadcom.com
REM * This program is the proprietary software of Broadcom Corporation and/or
REM * its licensors, and may only be used, duplicated, modified or distributed
REM * pursuant to the terms and conditions of a separate, written license
REM * agreement executed between you and Broadcom (an "Authorized License").
REM * Except as set forth in an Authorized License, Broadcom grants no license
REM * (express or implied), right to use, or waiver of any kind with respect to
REM * the Software, and Broadcom expressly reserves all rights in and to the
REM * Software and all intellectual property rights therein. IF YOU HAVE NO
REM * AUTHORIZED LICENSE, THEN YOU HAVE NO RIGHT TO USE THIS SOFTWARE IN ANY
REM * WAY, AND SHOULD IMMEDIATELY NOTIFY BROADCOM AND DISCONTINUE ALL USE OF
REM * THE SOFTWARE.

set DriverDir=%SystemRoot%\System32\Drivers\UMDF
set ConfigFile=%DriverDir%\BcmGnssConfig.xml
if not exist "%ConfigFile%" goto MUST_HAVE_SENSOR_INSTALLED

for /f "tokens=2 delims==" %%l in ('findstr acLogDirectory %ConfigFile%') do (
    set acLogDirectory=%%l
)

if %acLogDirectory% == %acLogDirectory:APPDATA=% goto SHOW_LOG_PATH
set acLogDirectory=%acLogDirectory:APPDATA=%
set acLogDirectory=%acLogDirectory:~3,-1%
if defined ALLUSERSPROFILE (set LogPath=%ALLUSERSPROFILE%%acLogDirectory%)
if defined ProgramData (set LogPath=%ProgramData%%acLogDirectory%)

:SHOW_LOG_PATH
set LogPath
for /F "tokens=3 delims= " %%a in ('reg query HKLM\SOFTWARE\Broadcom\Location\HAL /v LogEnabled') do (
    set LogEnabled=%%a
)
echo.
if "%LogEnabled%"=="00" goto LOG_DISABLED
goto LOG_ENABLED

:MUST_HAVE_SENSOR_INSTALLED
echo ================================= Error ==================================
echo "Sensors\BcmGnssLocationSensor*" must be successfully installed
echo %ConfigFile% must exist
pause
goto FINISH

:LOG_DISABLED
echo Log is currently disabled
goto LOG_PROCEDURE

:LOG_ENABLED
echo Log is currently enabled

:LOG_PROCEDURE
echo Import LogOn.reg to enable
echo Import LogOff.reg to disable
pause

goto FINISH

:FINISH

