From aa4ca70d07f4df040431c4e436033eb62cb7fae9 Mon Sep 17 00:00:00 2001 From: Matthew Date: Mon, 26 May 2025 12:03:01 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=84=9A=E6=9C=AC=E5=92=8C?= =?UTF-8?q?=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/assets/eth.sh | 9 ++++++++- app/src/main/cpp/PhoneDevice.cpp | 6 ++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/app/src/main/assets/eth.sh b/app/src/main/assets/eth.sh index 6cb68c27..009279de 100644 --- a/app/src/main/assets/eth.sh +++ b/app/src/main/assets/eth.sh @@ -16,6 +16,8 @@ MAX_ROUTE_WAIT=5 # Maximum seconds to wait for routing rules # For debugging only - comment out in production # set -x +ANDROID_VERSION=$(getprop ro.build.version.release 2>/dev/null | cut -d '.' -f1) + # Record script start time SCRIPT_START=$(date +%s) @@ -105,7 +107,12 @@ echo "IP configuration before UP: $PRE_UP_IP (1=configured, 0=missing)" # Enable interface and wait for UP echo "Bringing up interface..." /system/bin/ip link set eth0 up -sleep 1 +if [ "$ANDROID_VERSION" = "9" ]; then + sleep 3 +else + # Use standard configuration for other devices + sleep 1 +fi # Check if IP was lost after interface UP (common issue on MTK devices) POST_UP_IP=$(/system/bin/ip addr show eth0 | grep -c "inet $ETH_IP") diff --git a/app/src/main/cpp/PhoneDevice.cpp b/app/src/main/cpp/PhoneDevice.cpp index 9525573f..784f09f0 100644 --- a/app/src/main/cpp/PhoneDevice.cpp +++ b/app/src/main/cpp/PhoneDevice.cpp @@ -1610,7 +1610,7 @@ bool CPhoneDevice::TakePhotoWithNetCamera(IDevice::PHOTO_INFO& localPhotoInfo, c } #endif - XYLOG(XYLOG_SEVERITY_DEBUG, "Ethernet Power ON"); + std::shared_ptr ethernetPowerCtrl = std::make_shared(localPhotoInfo.closeDelayTime); uint64_t startTime = GetMicroTimeStamp(); @@ -1620,8 +1620,10 @@ bool CPhoneDevice::TakePhotoWithNetCamera(IDevice::PHOTO_INFO& localPhotoInfo, c { std::this_thread::sleep_for(std::chrono::milliseconds(5000 - ethDuration)); } - net_handle_t netHandle = GetEthnetHandle(); + + XYLOG(XYLOG_SEVERITY_DEBUG, "Ethernet Power ON Init Time=%u NetHandle=%lld", (uint32_t)ethDuration, netHandle); + std::string ip = GetIpStr(localPhotoInfo.ip); std::unique_ptr vendorCtrl(MakeVendorCtrl(localPhotoInfo.vendor, localPhotoInfo.channel, ip, localPhotoInfo.userName, localPhotoInfo.password, netHandle, false));