Skip to content

Commit

Permalink
Disable debug log
Browse files Browse the repository at this point in the history
  • Loading branch information
yufengwangca committed Dec 9, 2024
1 parent 73cc4f1 commit bf553d0
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 2 deletions.
76 changes: 76 additions & 0 deletions examples/fabric-sync/scripts/run_fabric_sync.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
#!/bin/bash

# Default paths
DEFAULT_SYNC_CHOICES=(
"./fabric-sync"
"out/debug/standalone/fabric-sync"
"out/linux-x64-fabric-sync/fabric-sync"
)

FABRIC_SYNC_PATH=""
FABRIC_BRIDGE_APP_PATH="fabric-bridge"

# Function to find a binary
find_binary() {
local choices=("$@")
for path in "${choices[@]}"; do
if [[ -e "$path" ]]; then
echo "$path"
return 0
fi
done
return 1
}

# Parse arguments
DEBUG=false
SPECIFIED_SYNC_PATH=""

for arg in "$@"; do
case $arg in
--debug)
DEBUG=true
;;
--sync-path=*)
SPECIFIED_SYNC_PATH="${arg#*=}"
;;
esac
done

# Use specified paths if provided
if [[ -n "$SPECIFIED_SYNC_PATH" ]]; then
if [[ -e "$SPECIFIED_SYNC_PATH" ]]; then
FABRIC_SYNC_PATH="$SPECIFIED_SYNC_PATH"
else
echo >&2 "Specified fabric sync path does not exist: $SPECIFIED_SYNC_PATH"
exit 1
fi
else
FABRIC_SYNC_PATH=$(find_binary "${DEFAULT_SYNC_CHOICES[@]}")
if [[ $? -ne 0 ]]; then
echo >&2 "Could not find the fabric-sync binary"
exit 1
fi
fi

echo "Fabric Sync path: $FABRIC_SYNC_PATH"

# Kill fabric-bridge-app if it is running
fabric_bridge_app_pid=$(pgrep "$FABRIC_BRIDGE_APP_PATH")
echo "Found fabric-bridge-app PID: $fabric_bridge_app_pid"
if [ ! -z "$fabric_bridge_app_pid" ]; then
kill -9 "$fabric_bridge_app_pid"
echo "Killed fabric-bridge-app with PID $fabric_bridge_app_pid"
fi

# Remove /tmp/chip_* files and directories
rm -rf /tmp/chip_*
rm -rf /tmp/fabric_sync.log
echo "Removed /tmp/chip_* files and directories."

# Start fabric-admin with or without log file path based on --verbose option
if [ "$DEBUG" = true ]; then
code .
else
"$FABRIC_SYNC_PATH"
fi
2 changes: 1 addition & 1 deletion src/platform/Linux/BLEManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event)
void BLEManagerImpl::HandlePlatformSpecificBLEEvent(const ChipDeviceEvent * apEvent)
{
CHIP_ERROR err = CHIP_NO_ERROR;
ChipLogDetail(DeviceLayer, "HandlePlatformSpecificBLEEvent %d", apEvent->Type);
// ChipLogDetail(DeviceLayer, "HandlePlatformSpecificBLEEvent %d", apEvent->Type);
switch (apEvent->Type)
{
case DeviceEventType::kPlatformLinuxBLEAdapterAdded:
Expand Down
2 changes: 1 addition & 1 deletion src/platform/Linux/PlatformManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ gboolean WiFiIPChangeListener(GIOChannel * ch, GIOCondition /* condition */, voi

char ipStrBuf[chip::Inet::IPAddress::kMaxStringLength] = { 0 };
inet_ntop(AF_INET, RTA_DATA(routeInfo), ipStrBuf, sizeof(ipStrBuf));
ChipLogDetail(DeviceLayer, "Got IP address on interface: %s IP: %s", name, ipStrBuf);
// ChipLogDetail(DeviceLayer, "Got IP address on interface: %s IP: %s", name, ipStrBuf);

ChipDeviceEvent event{ .Type = DeviceEventType::kInternetConnectivityChange,
.InternetConnectivityChange = { .IPv4 = kConnectivity_Established,
Expand Down

0 comments on commit bf553d0

Please sign in to comment.