petabyt / fudge

Unofficial app to pair with Fujifilm cameras
https://danielc.dev/fudge/
GNU General Public License v2.0
91 stars 4 forks source link

FUJIFILM XH2, recognition successful, but the app crashed #24

Open snsdyp opened 1 week ago

snsdyp commented 1 week ago

5a2f869d244e0f34c396c21ef860918

Main logs

2024-11-21 17:01:02.595 discovery D Discovery starting 2024-11-21 17:01:02.597 wifi D Wifi network is available: 432902426637 2024-11-21 17:01:02.597 plat_dbg D You are on 192.168.1.8 2024-11-21 17:01:02.597 plat_dbg D Binding to 51542 2024-11-21 17:01:02.597 plat_dbg D Binding to 51541

2024-11-21 17:01:03.754 fudge D Received the camera's intimate broadcast… 2024-11-21 17:01:03.756 plat_dbg D invite server: Connection accepted from 192.168.1.13:34918 2024-11-21 17:01:03.769 fudge D Waiting on network... 2024-11-21 17:01:04.270 plat_dbg D Connecting to 192.168.1.13:15740

2024-11-21 17:01:04.391 fudge D Starting gallery 2024-11-21 17:01:04.392 fudge D Waiting on the camera... 2024-11-21 17:01:04.392 fudge D Make sure you pressed OK. 2024-11-21 17:01:04.458 fudge D Initialized connection. 2024-11-21 17:01:04.458 fudge D The camera is thinking...

Error begins

2024-11-21 17:01:04.606 ptp_panic E ptp_read_uint16_array overflow 256 >= 277 2024-11-21 17:01:04.611 libc A FORTIFY: pthread_mutex_lock called on a destroyed mutex 2024-11-21 17:01:04.611 libc A Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE)

petabyt commented 6 days ago

Is this wireless tethering?

petabyt commented 6 days ago

I guess it has to be, PC auto save isn't on the H2

petabyt commented 6 days ago

Increasing the buffer size of https://github.com/petabyt/camlib/blob/365de61c84f388bd52d82def21e0577e8aab3ede/src/cl_data.h#L37 Should fix this, I'll have that done

snsdyp commented 6 days ago

Increasing the buffer size of https://github.com/petabyt/camlib/blob/365de61c84f388bd52d82def21e0577e8aab3ede/src/cl_data.h#L37 Should fix this, I'll have that done

b279ca77d701800f4f963d1c056f3d8 I solved the problem - the app can enter the camera gallery, but no images are displayed. When I take a photo with the camera, the app automatically downloads the photo, but when I open it on the phone, it shows up as a empty image.

PROCESS STARTED (20285) for package dev.danielc.fujiapp ---------------------------- plat_dbg You are on 192.168.1.8 wifi Wifi network is available: 432902426637 fudge Received the camera's intimate broadcast… plat_dbg invite server: Connection accepted from 192.168.1.13:56702 plat_dbg Connecting to 192.168.1.13:15740 fudge Starting gallery fudge Waiting on the camera... fudge Initialized connection. fudge The camera is thinking... fudge Entering image gallery.. fudge No images available on camera. fudge Waiting to download images. plat_dbg Downloading file DSCF0001.jpg b File exists: /storage/emulated/0/Pictures/fudge/TETHER000.JPG b File exists: /storage/emulated/0/Pictures/fudge/TETHER001.JPG b File exists: /storage/emulated/0/Pictures/fudge/TETHER002.JPG fudge Downloading /storage/emulated/0/Pictures/fudge/TETHER003.JPG plat_dbg Downloaded file /storage/emulated/0/Pictures/fudge/TETHER003.JPG fudge Done downloading.

petabyt commented 6 days ago

Keep in mind support for this feature was barely implemented and tested, I probably shouldn't even have noted it at all.

By 'empty image' what do you mean? Is it 0 bytes or is it black?

petabyt commented 6 days ago

It it's zero bytes, it looks like the camera is sending us zero bytes for the image:

        FILE *f = fopen(buffer, "wb");
        if (f == NULL) return PTP_RUNTIME_ERR;
        app_print("Downloading %s", buffer);
        ptp_download_object(r, a->data[i], f, 0x100000);
        fclose(f);
snsdyp commented 6 days ago

It it's zero bytes, it looks like the camera is sending us zero bytes for the image:

      FILE *f = fopen(buffer, "wb");
      if (f == NULL) return PTP_RUNTIME_ERR;
      app_print("Downloading %s", buffer);
      ptp_download_object(r, a->data[i], f, 0x100000);
      fclose(f);

Yes,it's zero bytes.Is it possible to solve this problem?

snsdyp commented 6 days ago

Is the issue related to the error reported in this log? 2024-11-22 16:24:51.037 26735-26735 FinalizerDaemon dev.danielc.fujiapp W type=1400 audit(0.0:119693): avc: denied { getopt } for path="/dev/socket/usap_pool_primary" scontext=u:r:untrusted_app:s0:c177,c257,c512,c768 tcontext=u:r:zygote:s0 tclass=unix_stream_socket permissive=0 app=dev.danielc.fujiapp

petabyt commented 5 days ago

If it's zero bytes I assume it's a quirk of how X-H2 handles file transfers

snsdyp commented 5 days ago

If it's zero bytes I assume it's a quirk of how X-H2 handles file transfers

I noticed in the logs that the camera status is FUJI_WAIT_FOR_ACCESS, which shouldn't be correct. However, the camera did take a photo, and it indeed triggered the app to download the photo.

petabyt commented 5 days ago

That property isn't used on wireless tether mode, communication is the exact same as it would be on PTP/USB

snsdyp commented 4 days ago

That property isn't used on wireless tether mode, communication is the exact same as it would be on PTP/USB

I have set up detailed logs to try to troubleshoot the issue. Could you provide some suggestions? Here are the detailed logs:

D You are on 192.168.1.4 D Binding to 51542 D Binding to 51541 D Compat change id reported: 237531167; UID 10448; state: DISABLED E Unable to match the desired swap behavior. D Compat change id reported: 78294732; UID 10448; state: ENABLED E capabilities changed E Tether connect D Received the camera's intimate broadcast… D invite server: Connection accepted from 192.168.1.19:34544 D Waiting on network... E [NetConn] Starting PTP/IP connection to 192.168.1.19:15740 E [NetConn] Extra timeout: 5 seconds E [NetConn] Creating new socket with timeout 7 seconds E [NetConn] Connecting to 192.168.1.19:15740 E [NetConn] Connection in progress, waiting for completion E [NetConn] Connection established successfully E [NetConn] Connection established successfully (fd: 99) D Go/cancel D Starting gallery D transport: 2 D Waiting on the camera... D Make sure you pressed OK. E [Init] === Starting PTP/IP Initialization === E [Init] Starting Fuji PTP/IP initialization E [Init] Device name: Fudge E [Init] Preparing init packet: E [Init] - Length: 0x52 E [Init] - Type: 0x1 E [Init] - Version: 0x8F53E4F2 E [Init] - GUID: 5D48A5AD-0B7FB287-D0DED5D3-00000000 E [Init] Sending initialization request (82 bytes)

E [Init] Parsing response data E [Init] Parsing initialization response E [Init] Successfully parsed camera info E [Init] Successfully connected to camera: X-H2 E [Init] Camera response details: E [Init] - x1: 0x61B07008 E [Init] - x2: 0x93458B0A E [Init] - x3: 0x5793E7B2 E [Init] - x4: 0x50E036DD E [Init] Initialization completed successfully E [Init] === Initialization Completed Successfully === D Initialized connection. D The camera is thinking...

E ptpipusb_receive_bulk_packets: Read 825 bytes E ptpipusb_receive_bulk_packets: Return code: 0x2001 D Entering image gallery.. E [ObjList] Starting to get object handles E [ObjList] WiFi mode - building handles from num_objects E [ObjList] Invalid number of objects: 0 D No images available on camera. D Waiting to download images. E === Getting Camera Events === E Pre-event state - State: 0, Objects: 0, Mode: 0

E =================================== E ptpipusb_receive_bulk_packets: Read 32 bytes E ptpipusb_receive_bulk_packets: Return code: 0x2001 E [Tether] Found 1 objects to download E [Tether] Processing object 1/1 (handle: 0x1) E [Tether] Object info: E [Tether] - Filename: DSCF0001.jpg E [Tether] - Size: 3576786 bytes E [Tether] - Format: 0x3801 D Downloading file DSCF0001.jpg D File exists: /storage/emulated/0/Pictures/fudge/TETHER000.JPG D File exists: /storage/emulated/0/Pictures/fudge/TETHER001.JPG D File exists: /storage/emulated/0/Pictures/fudge/TETHER002.JPG [...additional file exists messages...] E [Tether] Saving to: /storage/emulated/0/Pictures/fudge/TETHER021.JPG W type=1400 audit(0.0:5968726): avc: denied { getopt } for path="/dev/socket/usap_pool_primary" scontext=u:r:untrusted_app:s0:c192,c257,c512,c768 tcontext=u:r:zygote:s0 tclass=unix_stream_socket permissive=0 D Downloading /storage/emulated/0/Pictures/fudge/TETHER021.JPG E [Tether] Starting file download E Invalid return code: 2005 E [Tether] Download failed: -8 E Tether download failed: -8 E Ignored event code: 0x000D value: 0x00000000 E Ignored event code: 0x0000 value: 0x00000000 [...additional ignored event messages...] E Post-event state - State: 0, Objects: 0, Mode: 0 E === Event Processing Complete === E === Getting Camera Events === E Pre-event state - State: 0, Objects: 0, Mode: 0