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));