diff --git a/android/app/.cxx/RelWithDebInfo/3x5j4n2e/arm64-v8a/.ninja_log b/android/app/.cxx/RelWithDebInfo/3x5j4n2e/arm64-v8a/.ninja_log index 7ef0b9e3..eba29aa8 100644 --- a/android/app/.cxx/RelWithDebInfo/3x5j4n2e/arm64-v8a/.ninja_log +++ b/android/app/.cxx/RelWithDebInfo/3x5j4n2e/arm64-v8a/.ninja_log @@ -68,3 +68,5 @@ 3 37 0 C:/GitHub/Schnappix/android/app/.cxx/RelWithDebInfo/3x5j4n2e/arm64-v8a/CMakeFiles/cmake.verify_globs 5250f1b80cb55465 6 44 0 C:/GitHub/Schnappix/android/app/.cxx/RelWithDebInfo/3x5j4n2e/arm64-v8a/CMakeFiles/cmake.verify_globs 5250f1b80cb55465 5 43 0 C:/GitHub/Schnappix/android/app/.cxx/RelWithDebInfo/3x5j4n2e/arm64-v8a/CMakeFiles/cmake.verify_globs 5250f1b80cb55465 +20 79 0 C:/GitHub/Schnappix/android/app/.cxx/RelWithDebInfo/3x5j4n2e/arm64-v8a/CMakeFiles/cmake.verify_globs 5250f1b80cb55465 +4 35 0 C:/GitHub/Schnappix/android/app/.cxx/RelWithDebInfo/3x5j4n2e/arm64-v8a/CMakeFiles/cmake.verify_globs 5250f1b80cb55465 diff --git a/android/app/.cxx/RelWithDebInfo/3x5j4n2e/arm64-v8a/configure_fingerprint.bin b/android/app/.cxx/RelWithDebInfo/3x5j4n2e/arm64-v8a/configure_fingerprint.bin index 66d85898..65f1a04f 100644 --- a/android/app/.cxx/RelWithDebInfo/3x5j4n2e/arm64-v8a/configure_fingerprint.bin +++ b/android/app/.cxx/RelWithDebInfo/3x5j4n2e/arm64-v8a/configure_fingerprint.bin @@ -2,41 +2,41 @@ C/C++ Structured Logg e cC:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\arm64-v8a\additional_project_files.txtC A -?com.android.build.gradle.internal.cxx.io.EncodedFileFingerPrint  ø“žÃ�4Å, ½Ñªðò3d +?com.android.build.gradle.internal.cxx.io.EncodedFileFingerPrint  œ½›Ô�4Å, ½Ñªðò3d b -`C:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\arm64-v8a\android_gradle_build.json  ø“žÃ�4û" ÂѪðò3i +`C:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\arm64-v8a\android_gradle_build.json  œ½›Ô�4û" ÂѪðò3i g -eC:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\arm64-v8a\android_gradle_build_mini.json  ø“žÃ�4ï  Òªðò3V +eC:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\arm64-v8a\android_gradle_build_mini.json  œ½›Ô�4ï  Òªðò3V T -RC:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\arm64-v8a\build.ninja  ø“žÃ�4œÞ åͪðò3Z +RC:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\arm64-v8a\build.ninja  œ½›Ô�4œÞ åͪðò3Z X -VC:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\arm64-v8a\build.ninja.txt  ø“žÃ�4_ +VC:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\arm64-v8a\build.ninja.txt  œ½›Ô�4_ ] -[C:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\arm64-v8a\build_file_index.txt  ø“žÃ�4� ¨Òªðò3` +[C:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\arm64-v8a\build_file_index.txt  œ½›Ô�4� ¨Òªðò3` ^ -\C:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\arm64-v8a\compile_commands.json  ø“žÃ�4‘Ø ãͪðò3d +\C:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\arm64-v8a\compile_commands.json  œ½›Ô�4‘Ø ãͪðò3d b -`C:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\arm64-v8a\compile_commands.json.bin  ø“žÃ�4 Ê„ ãͪðò3j +`C:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\arm64-v8a\compile_commands.json.bin  œ½›Ô�4 Ê„ ãͪðò3j h -fC:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\arm64-v8a\metadata_generation_command.txt  ø“žÃ�4 +fC:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\arm64-v8a\metadata_generation_command.txt  œ½›Ô�4 ¸ §Òªðò3] [ -YC:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\arm64-v8a\prefab_config.json  ø“žÃ�4 € ¨Òªðò3b +YC:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\arm64-v8a\prefab_config.json  œ½›Ô�4 € ¨Òªðò3b ` -^C:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\arm64-v8a\symbol_folder_index.txt  ø“žÃ�4  ] ¨Òªðò3{ +^C:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\arm64-v8a\symbol_folder_index.txt  œ½›Ô�4  ] ¨Òªðò3{ y -wC:\GitHub\Schnappix\node_modules\react-native-gesture-handler\android\build\generated\source\codegen\jni\CMakeLists.txt  ø“žÃ�4 ¾ Ü…§ðò3v +wC:\GitHub\Schnappix\node_modules\react-native-gesture-handler\android\build\generated\source\codegen\jni\CMakeLists.txt  œ½›Ô�4 ¾ Ü…§ðò3v t -rC:\GitHub\Schnappix\node_modules\react-native-reanimated\android\build\generated\source\codegen\jni\CMakeLists.txt  ø“žÃ�4ö ùާðò3µ +rC:\GitHub\Schnappix\node_modules\react-native-reanimated\android\build\generated\source\codegen\jni\CMakeLists.txt  œ½›Ô�4ö ùާðò3µ ² -¯C:\GitHub\Schnappix\node_modules\react-native-reanimated\android\build\intermediates\prefab_package_configuration\release\prefabReleaseConfigurePackage\prefab_publication.json  ø“žÃ�4Y +¯C:\GitHub\Schnappix\node_modules\react-native-reanimated\android\build\intermediates\prefab_package_configuration\release\prefabReleaseConfigurePackage\prefab_publication.json  œ½›Ô�4Y W -UC:\GitHub\Schnappix\node_modules\react-native-svg\android\src\main\jni\CMakeLists.txt  ø“žÃ�4½ œ§ØÖç3u +UC:\GitHub\Schnappix\node_modules\react-native-svg\android\src\main\jni\CMakeLists.txt  œ½›Ô�4½ œ§ØÖç3u s -qC:\GitHub\Schnappix\node_modules\react-native-view-shot\android\build\generated\source\codegen\jni\CMakeLists.txt  ø“žÃ�4ê ú„§ðò3t +qC:\GitHub\Schnappix\node_modules\react-native-view-shot\android\build\generated\source\codegen\jni\CMakeLists.txt  œ½›Ô�4ê ú„§ðò3t r -pC:\GitHub\Schnappix\node_modules\react-native-worklets\android\build\generated\source\codegen\jni\CMakeLists.txt  ø“žÃ�4ê è„§ðò3³ +pC:\GitHub\Schnappix\node_modules\react-native-worklets\android\build\generated\source\codegen\jni\CMakeLists.txt  œ½›Ô�4ê è„§ðò3³ ° -­C:\GitHub\Schnappix\node_modules\react-native-worklets\android\build\intermediates\prefab_package_configuration\release\prefabReleaseConfigurePackage\prefab_publication.json  ø“žÃ�4k +­C:\GitHub\Schnappix\node_modules\react-native-worklets\android\build\intermediates\prefab_package_configuration\release\prefabReleaseConfigurePackage\prefab_publication.json  œ½›Ô�4k i -gC:\GitHub\Schnappix\node_modules\react-native\ReactAndroid\cmake-utils\default-app-setup\CMakeLists.txt  ø“žÃ�4ð ®¡ÈÑç3 \ No newline at end of file +gC:\GitHub\Schnappix\node_modules\react-native\ReactAndroid\cmake-utils\default-app-setup\CMakeLists.txt  œ½›Ô�4ð ®¡ÈÑç3 \ No newline at end of file diff --git a/android/app/.cxx/RelWithDebInfo/3x5j4n2e/armeabi-v7a/.ninja_log b/android/app/.cxx/RelWithDebInfo/3x5j4n2e/armeabi-v7a/.ninja_log index 11533c22..47d5e928 100644 --- a/android/app/.cxx/RelWithDebInfo/3x5j4n2e/armeabi-v7a/.ninja_log +++ b/android/app/.cxx/RelWithDebInfo/3x5j4n2e/armeabi-v7a/.ninja_log @@ -68,3 +68,5 @@ 4 42 0 C:/GitHub/Schnappix/android/app/.cxx/RelWithDebInfo/3x5j4n2e/armeabi-v7a/CMakeFiles/cmake.verify_globs 1eb2d1da6ebc2e74 4 42 0 C:/GitHub/Schnappix/android/app/.cxx/RelWithDebInfo/3x5j4n2e/armeabi-v7a/CMakeFiles/cmake.verify_globs 1eb2d1da6ebc2e74 3 48 0 C:/GitHub/Schnappix/android/app/.cxx/RelWithDebInfo/3x5j4n2e/armeabi-v7a/CMakeFiles/cmake.verify_globs 1eb2d1da6ebc2e74 +5 72 0 C:/GitHub/Schnappix/android/app/.cxx/RelWithDebInfo/3x5j4n2e/armeabi-v7a/CMakeFiles/cmake.verify_globs 1eb2d1da6ebc2e74 +3 32 0 C:/GitHub/Schnappix/android/app/.cxx/RelWithDebInfo/3x5j4n2e/armeabi-v7a/CMakeFiles/cmake.verify_globs 1eb2d1da6ebc2e74 diff --git a/android/app/.cxx/RelWithDebInfo/3x5j4n2e/armeabi-v7a/configure_fingerprint.bin b/android/app/.cxx/RelWithDebInfo/3x5j4n2e/armeabi-v7a/configure_fingerprint.bin index e294d785..dcbbc88e 100644 --- a/android/app/.cxx/RelWithDebInfo/3x5j4n2e/armeabi-v7a/configure_fingerprint.bin +++ b/android/app/.cxx/RelWithDebInfo/3x5j4n2e/armeabi-v7a/configure_fingerprint.bin @@ -2,41 +2,41 @@ C/C++ Structured Logi g eC:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\armeabi-v7a\additional_project_files.txtC A -?com.android.build.gradle.internal.cxx.io.EncodedFileFingerPrint  §—žÃ�4ý, ÷íðò3f +?com.android.build.gradle.internal.cxx.io.EncodedFileFingerPrint  ŽÀ›Ô�4ý, ÷íðò3f d -bC:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\armeabi-v7a\android_gradle_build.json  §—žÃ�4�# øÃ­ðò3k +bC:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\armeabi-v7a\android_gradle_build.json  ŽÀ›Ô�4�# øÃ­ðò3k i -gC:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\armeabi-v7a\android_gradle_build_mini.json  §—žÃ�4‘ ŸÄ­ðò3X +gC:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\armeabi-v7a\android_gradle_build_mini.json  ŽÀ›Ô�4‘ ŸÄ­ðò3X V -TC:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\armeabi-v7a\build.ninja  §—žÃ�4Áå âÀ­ðò3\ +TC:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\armeabi-v7a\build.ninja  ŽÀ›Ô�4Áå âÀ­ðò3\ Z -XC:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\armeabi-v7a\build.ninja.txt  §—žÃ�4a +XC:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\armeabi-v7a\build.ninja.txt  ŽÀ›Ô�4a _ -]C:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\armeabi-v7a\build_file_index.txt  §—žÃ�4�  Ä­ðò3b +]C:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\armeabi-v7a\build_file_index.txt  ŽÀ›Ô�4�  Ä­ðò3b ` -^C:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\armeabi-v7a\compile_commands.json  §—žÃ�4´à àÀ­ðò3f +^C:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\armeabi-v7a\compile_commands.json  ŽÀ›Ô�4´à àÀ­ðò3f d -bC:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\armeabi-v7a\compile_commands.json.bin  §—žÃ�4 ò„ àÀ­ðò3l +bC:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\armeabi-v7a\compile_commands.json.bin  ŽÀ›Ô�4 ò„ àÀ­ðò3l j -hC:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\armeabi-v7a\metadata_generation_command.txt  §—žÃ�4 +hC:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\armeabi-v7a\metadata_generation_command.txt  ŽÀ›Ô�4 Ä ŸÄ­ðò3_ ] -[C:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\armeabi-v7a\prefab_config.json  §—žÃ�4 € ŸÄ­ðò3d +[C:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\armeabi-v7a\prefab_config.json  ŽÀ›Ô�4 € ŸÄ­ðò3d b -`C:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\armeabi-v7a\symbol_folder_index.txt  §—žÃ�4  _  Ä­ðò3{ +`C:\GitHub\Schnappix\android\app\.cxx\RelWithDebInfo\3x5j4n2e\armeabi-v7a\symbol_folder_index.txt  ŽÀ›Ô�4  _  Ä­ðò3{ y -wC:\GitHub\Schnappix\node_modules\react-native-gesture-handler\android\build\generated\source\codegen\jni\CMakeLists.txt  §—žÃ�4 ¾ Ü…§ðò3v +wC:\GitHub\Schnappix\node_modules\react-native-gesture-handler\android\build\generated\source\codegen\jni\CMakeLists.txt  ŽÀ›Ô�4 ¾ Ü…§ðò3v t -rC:\GitHub\Schnappix\node_modules\react-native-reanimated\android\build\generated\source\codegen\jni\CMakeLists.txt  §—žÃ�4ö ùާðò3µ +rC:\GitHub\Schnappix\node_modules\react-native-reanimated\android\build\generated\source\codegen\jni\CMakeLists.txt  ŽÀ›Ô�4ö ùާðò3µ ² -¯C:\GitHub\Schnappix\node_modules\react-native-reanimated\android\build\intermediates\prefab_package_configuration\release\prefabReleaseConfigurePackage\prefab_publication.json  §—žÃ�4Y +¯C:\GitHub\Schnappix\node_modules\react-native-reanimated\android\build\intermediates\prefab_package_configuration\release\prefabReleaseConfigurePackage\prefab_publication.json  ŽÀ›Ô�4Y W -UC:\GitHub\Schnappix\node_modules\react-native-svg\android\src\main\jni\CMakeLists.txt  §—žÃ�4½ œ§ØÖç3u +UC:\GitHub\Schnappix\node_modules\react-native-svg\android\src\main\jni\CMakeLists.txt  ŽÀ›Ô�4½ œ§ØÖç3u s -qC:\GitHub\Schnappix\node_modules\react-native-view-shot\android\build\generated\source\codegen\jni\CMakeLists.txt  §—žÃ�4ê ú„§ðò3t +qC:\GitHub\Schnappix\node_modules\react-native-view-shot\android\build\generated\source\codegen\jni\CMakeLists.txt  ŽÀ›Ô�4ê ú„§ðò3t r -pC:\GitHub\Schnappix\node_modules\react-native-worklets\android\build\generated\source\codegen\jni\CMakeLists.txt  §—žÃ�4ê è„§ðò3³ +pC:\GitHub\Schnappix\node_modules\react-native-worklets\android\build\generated\source\codegen\jni\CMakeLists.txt  ŽÀ›Ô�4ê è„§ðò3³ ° -­C:\GitHub\Schnappix\node_modules\react-native-worklets\android\build\intermediates\prefab_package_configuration\release\prefabReleaseConfigurePackage\prefab_publication.json  §—žÃ�4k +­C:\GitHub\Schnappix\node_modules\react-native-worklets\android\build\intermediates\prefab_package_configuration\release\prefabReleaseConfigurePackage\prefab_publication.json  ŽÀ›Ô�4k i -gC:\GitHub\Schnappix\node_modules\react-native\ReactAndroid\cmake-utils\default-app-setup\CMakeLists.txt  §—žÃ�4ð ®¡ÈÑç3 \ No newline at end of file +gC:\GitHub\Schnappix\node_modules\react-native\ReactAndroid\cmake-utils\default-app-setup\CMakeLists.txt  ŽÀ›Ô�4ð ®¡ÈÑç3 \ No newline at end of file diff --git a/apks/Schnappix_v23.01.34.aab b/apks/Schnappix_v23.01.34.aab new file mode 100644 index 00000000..3374bb49 Binary files /dev/null and b/apks/Schnappix_v23.01.34.aab differ diff --git a/apks/Schnappix_v23.01.34.apk b/apks/Schnappix_v23.01.34.apk new file mode 100644 index 00000000..3765c985 --- /dev/null +++ b/apks/Schnappix_v23.01.34.apk @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5e8f20eedda0f42b69914ac87ab375b795eb83ec7b6f4c25190cbaac539937c5 +size 116712967 diff --git a/modules/usb-camera/android/src/main/java/expo/modules/usbcamera/UsbCameraModule.kt b/modules/usb-camera/android/src/main/java/expo/modules/usbcamera/UsbCameraModule.kt index 9293b0a4..d0938562 100644 --- a/modules/usb-camera/android/src/main/java/expo/modules/usbcamera/UsbCameraModule.kt +++ b/modules/usb-camera/android/src/main/java/expo/modules/usbcamera/UsbCameraModule.kt @@ -14,17 +14,28 @@ class UsbCameraModule : Module() { AsyncFunction("getLogcat") { promise: Promise -> try { - val process = Runtime.getRuntime().exec("logcat -d -v time -s UsbCameraView CameraClient") + val pid = android.os.Process.myPid() + val process = Runtime.getRuntime().exec("logcat -d -v time --pid=$pid -t 800") val bufferedReader = BufferedReader(InputStreamReader(process.inputStream)) val log = java.lang.StringBuilder() - var line: String? = bufferedReader.readLine() - while (line != null) { + var line: String? + while (bufferedReader.readLine().also { line = it } != null) { log.append(line).append("\n") - line = bufferedReader.readLine() } + + // Also append the custom init crash file if it exists + val context = appContext.reactContext + if (context != null) { + val crashFile = java.io.File(context.filesDir, "init_crash.txt") + if (crashFile.exists()) { + log.append("\n--- INIT CRASH LOG ---\n") + log.append(crashFile.readText()) + } + } + promise.resolve(log.toString()) } catch (e: Exception) { - promise.resolve("Error reading logcat: ${e.message}") + promise.resolve("Failed to read logcat: ${e.message}") } } diff --git a/modules/usb-camera/android/src/main/java/expo/modules/usbcamera/UsbCameraView.kt b/modules/usb-camera/android/src/main/java/expo/modules/usbcamera/UsbCameraView.kt index e8140460..3edb542a 100644 --- a/modules/usb-camera/android/src/main/java/expo/modules/usbcamera/UsbCameraView.kt +++ b/modules/usb-camera/android/src/main/java/expo/modules/usbcamera/UsbCameraView.kt @@ -90,13 +90,22 @@ class UsbCameraView(context: Context, appContext: AppContext) : ExpoView(context .setCameraRequest(cameraRequest) .setEnableGLES(false) .build() - + // Start the camera preview asynchronously post { startPreview() } } catch (e: Throwable) { - android.util.Log.e("UsbCameraView", "CRASH IN INIT: ${e.message}", e) - e.printStackTrace() + val errorMsg = "CRASH IN INIT: ${e.message}\n${android.util.Log.getStackTraceString(e)}" + android.util.Log.e("UsbCameraView", errorMsg, e) + try { + val context = appContext.reactContext + if (context != null) { + val crashFile = java.io.File(context.filesDir, "init_crash.txt") + crashFile.writeText(errorMsg) + } + } catch (ioe: Exception) { + // Ignore + } } } @@ -106,10 +115,20 @@ class UsbCameraView(context: Context, appContext: AppContext) : ExpoView(context onCameraReady(mapOf("status" to "ready")) } catch (e: Exception) { e.printStackTrace() + val errorMsg = "startPreview error: ${e.message}\n${android.util.Log.getStackTraceString(e)}" appContext.currentActivity?.runOnUiThread { - android.util.Log.e("UsbCameraView", "startPreview error: ${e.message}") + android.util.Log.e("UsbCameraView", errorMsg) onCameraError(mapOf("error" to (e.message ?: "Unknown error"))) } + try { + val context = appContext.reactContext + if (context != null) { + val crashFile = java.io.File(context.filesDir, "init_crash.txt") + crashFile.appendText("\n\n--- START PREVIEW CRASH ---\n$errorMsg") + } + } catch (ioe: Exception) { + // Ignore + } } } diff --git a/src/screens/CameraScreen.tsx b/src/screens/CameraScreen.tsx index c21b9164..c5752074 100644 --- a/src/screens/CameraScreen.tsx +++ b/src/screens/CameraScreen.tsx @@ -173,6 +173,7 @@ export default function CameraScreen({ // 2. Check if a USB camera is connected. useEffect(() => { let checkInterval: any; + let hasFetchedLogcat = false; if (Platform.OS === 'android') { const checkConnection = async () => { try { @@ -180,16 +181,31 @@ export default function CameraScreen({ const connected = await usbCameraRef.current.isCameraConnected(); if (connected !== isUsbConnected) { logger.log(`USB Connection status changed to: ${connected}`); - if (!connected) { + setIsUsbConnected(connected); + } + if (!connected && !hasFetchedLogcat) { + hasFetchedLogcat = true; + try { const logcat = await getUsbCameraLogcat(); - logger.error(`USB Camera disconnected or failed to connect. Logcat:\n${logcat}`); + logger.warn(`Native USB Camera Logcat excerpt (disconnected):\n${logcat}`); + } catch (logErr) { + console.error('Failed to get USB Camera logcat:', logErr); } } - setIsUsbConnected(connected); } - } catch (e) { - logger.error('Error checking USB connection:', e); + } catch (e: any) { + logger.error(`Error checking USB connection:\n Name: ${e.name}\n Message: ${e.message}\n Stack: ${e.stack}`); setIsUsbConnected(false); + + if (!hasFetchedLogcat) { + hasFetchedLogcat = true; + try { + const logcat = await getUsbCameraLogcat(); + logger.warn(`Native USB Camera Logcat excerpt (error):\n${logcat}`); + } catch (logErr) { + console.error('Failed to get USB Camera logcat:', logErr); + } + } } }; @@ -200,7 +216,7 @@ export default function CameraScreen({ return () => { if (checkInterval) clearInterval(checkInterval); }; - }, []); + }, [isUsbConnected]); // Cleanup burst timer on unmount useEffect(() => {