Need help with libimobiledevice

Hi i am the author of GitHub - iDescriptor/iDescriptor: A free, open-source, and cross-platform iDevice management tool

I am trying to publish iDescriptor on flathub but i need help with libimobiledevice. So currently we have a config file that builds fine https://github.com/iDescriptor/iDescriptor/blob/main/com.idescriptor.idescriptor.json but hotplug events do not fire off. I believe i passed all the needed finish-args for libimobiledevice to work but it just doesn’t work. By the way if the app is launched with a device connected it gets detected and when removed it gets removed but it works no longer than that. Also for some reason i get this even tho i am using the latest ffmpeg available

libopenh264 @ 0x555618847700] [OpenH264] this = 0x0x5556168a6710, Error:DecodeCurrentAccessUnit()::::::PrefetchPic ERROR, pSps->iNumRefFrames:4.
[libopenh264 @ 0x555618847700] DecodeFrame failed
[libopenh264 @ 0x555618847700] [OpenH264] this = 0x0x5556168a6710, Warning:parse_nal(), no exist Sequence Parameter Sets ahead of sequence when try to decode NAL(type:1).
[libopenh264 @ 0x555618847700] DecodeFrame failed
[libopenh264 @ 0x555618847700] DecodeFrame failed

what am i doing wrong related to ffmpeg? AirPlayer is also messed up there is video playing but pixels do not update properly

Any help is appreciated thank you

Honestly, there are too many things to comment on. The org.kde.Platform.ffmpeg-full should be org.freedesktop.Platform.ffmpeg-full but I would start from using 6.10 runtime version and removing any reference to *.ffmpeg-full from manifest.

–filesystem=/dev:ro should be –device=all

–filesystem=/sys/* should be removed.

–socket=system-bus should be removed

You should use flatpak run –log-session-bus –log-system-bus <appid> to check what dbus address is really needed. I doubt systemd1 or login1 is.

ffmpeg issue is fixed but hotplug still doesn’t work

flatpak run --log-session-bus --log-system-bus com.idescriptor.idescriptor

Output:

C1: → org.freedesktop.DBus call org.freedesktop.DBus.Hello at /org/freedesktop/DBus
C-65536: → org.freedesktop.DBus fake AddMatch for org.freedesktop.NetworkManager
C-65535: → org.freedesktop.DBus fake GetNameOwner for org.freedesktop.NetworkManager
C-65534: → org.freedesktop.DBus fake AddMatch for org.freedesktop.Avahi
C-65533: → org.freedesktop.DBus fake GetNameOwner for org.freedesktop.Avahi
C-65532: → org.freedesktop.DBus fake AddMatch for org.freedesktop.login1
C-65531: → org.freedesktop.DBus fake GetNameOwner for org.freedesktop.login1
C-65530: → org.freedesktop.DBus fake AddMatch for org.libimobiledevice.usbmuxd
C-65529: → org.freedesktop.DBus fake GetNameOwner for org.libimobiledevice.usbmuxd
C-65528: → org.freedesktop.DBus fake AddMatch for org.freedesktop.systemd1
C-65527: → org.freedesktop.DBus fake GetNameOwner for org.freedesktop.systemd1
B-1: ← org.freedesktop.DBus return from C1
B-1: ← org.freedesktop.DBus signal org.freedesktop.DBus.NameAcquired at /org/freedesktop/DBus
B-1: ← org.freedesktop.DBus return from C-65536
*SKIPPED*
B-1: ← org.freedesktop.DBus return from C-65535
*SKIPPED*
B-1: ← org.freedesktop.DBus return from C-65534
*SKIPPED*
B-1: ← org.freedesktop.DBus return from C-65533
*SKIPPED*
B-1: ← org.freedesktop.DBus return from C-65532
*SKIPPED*
B-1: ← org.freedesktop.DBus return from C-65531
*SKIPPED*
B-1: ← org.freedesktop.DBus return from C-65530
*SKIPPED*
B-1: ← org.freedesktop.DBus return error org.freedesktop.DBus.Error.NameHasNoOwner from C-65529
*SKIPPED*
B-1: ← org.freedesktop.DBus return from C-65528
*SKIPPED*
B-1: ← org.freedesktop.DBus return from C-65527
*SKIPPED*
C2: → org.freedesktop.Avahi call org.freedesktop.DBus.Introspectable.Introspect at /
B147: ← :1.291 return from C2
C3: → org.freedesktop.DBus call org.freedesktop.DBus.AddMatch at /org/freedesktop/DBus
C4: → org.freedesktop.DBus call org.freedesktop.DBus.GetNameOwner at /org/freedesktop/DBus
B-1: ← org.freedesktop.DBus return from C4
C5: → org.freedesktop.Avahi call org.freedesktop.Avahi.Server.GetState at /
B148: ← :1.291 return from C5
C6: → org.freedesktop.DBus call org.freedesktop.DBus.RemoveMatch at /org/freedesktop/DBus
C7: → org.freedesktop.DBus call org.freedesktop.DBus.RemoveMatch at /org/freedesktop/DBus

the config looks like this now

{
  "app-id": "com.idescriptor.idescriptor",
  "runtime": "org.kde.Platform",
  "runtime-version": "6.8",
  "sdk": "org.kde.Sdk",
  "add-extensions": {
    "org.freedesktop.Platform.ffmpeg-full": {
      "version": "24.08",
      "directory": "lib/ffmpeg",
      "add-ld-path": "."
    }
  },
  "cleanup-commands": ["mkdir -p ${FLATPAK_DEST}/lib/ffmpeg"],
  "command": "iDescriptor",
  "finish-args": [
    "--socket=x11",
    "--share=ipc",
    "--socket=pulseaudio",
    "--share=network",
    "--device=all",
    "--filesystem=/run/usbmuxd:rw",
    "--filesystem=/run/udev:ro",
    "--system-talk-name=org.freedesktop.Avahi",
    "--talk-name=org.libimobiledevice.usbmuxd",
    "--system-talk-name=org.libimobiledevice.usbmuxd",
    "--system-talk-name=org.freedesktop.login1",
    "--system-talk-name=org.freedesktop.NetworkManager",
    "--system-talk-name=org.freedesktop.systemd1",
    "--talk-name=org.freedesktop.Platform.ffmpeg-full",
    "--env=QT_MEDIA_BACKEND=ffmpeg",
    "--env=AVAHI_COMPAT_NOWARN=1"
  ],
  "modules": [
    {
      "name": "lxqt-build-tools",
      "buildsystem": "cmake-ninja",
      "builddir": true,
      "sources": [
        {
          "type": "git",
          "url": "https://github.com/lxqt/lxqt-build-tools.git"
        }
      ]
    },
    {
      "name": "golang",
      "buildsystem": "simple",
      "build-options": {
        "append-path": "/app/sdk/golang/bin",
        "env": {
          "GOROOT": "/app/sdk/golang"
        }
      },
      "sources": [
        {
          "type": "archive",
          "only-arches": ["x86_64"],
          "url": "https://go.dev/dl/go1.25.3.linux-amd64.tar.gz",
          "sha256": "0335f314b6e7bfe08c3d0cfaa7c19db961b7b99fb20be62b0a826c992ad14e0f",
          "strip-components": 0
        },
        {
          "type": "archive",
          "only-arches": ["aarch64"],
          "url": "https://go.dev/dl/go1.25.3.linux-arm64.tar.gz",
          "sha256": "1d42ebc84999b5e2069f5e31b67d6fc5d67308adad3e178d5a2ee2c9ff2001f5",
          "strip-components": 0
        }
      ],
      "build-commands": ["mkdir -p /app/sdk", "mv go /app/sdk/golang"]
    },
    {
      "name": "qtermwidget",
      "buildsystem": "cmake-ninja",
      "builddir": true,
      "sources": [
        {
          "type": "git",
          "url": "https://github.com/lxqt/qtermwidget"
        }
      ]
    },
    {
      "name": "libplist",
      "buildsystem": "autotools",
      "config-opts": ["--without-cython"],
      "sources": [
        {
          "type": "git",
          "url": "https://github.com/libimobiledevice/libplist.git"
        }
      ]
    },
    {
      "name": "libimobiledevice-glue",
      "buildsystem": "autotools",
      "sources": [
        {
          "type": "git",
          "url": "https://github.com/libimobiledevice/libimobiledevice-glue.git"
        }
      ]
    },
    {
      "name": "libtatsu",
      "buildsystem": "autotools",
      "sources": [
        {
          "type": "git",
          "url": "https://github.com/libimobiledevice/libtatsu.git"
        }
      ]
    },
    {
      "name": "libusb",
      "config-opts": ["--disable-static", "--enable-udev"],
      "cleanup": ["/lib/*.la", "/lib/pkgconfig", "/include"],
      "sources": [
        {
          "type": "archive",
          "url": "https://github.com/libusb/libusb/releases/download/v1.0.27/libusb-1.0.27.tar.bz2",
          "sha256": "ffaa41d741a8a3bee244ac8e54a72ea05bf2879663c098c82fc5757853441575"
        }
      ],
      "post-install": [
        "install -Dm644 COPYING ${FLATPAK_DEST}/share/licenses/libusb/COPYING"
      ]
    },
    {
      "name": "libusbmuxd",
      "buildsystem": "autotools",
      "sources": [
        {
          "type": "git",
          "url": "https://github.com/libimobiledevice/libusbmuxd.git"
        }
      ]
    },
    {
      "name": "libimobiledevice",
      "buildsystem": "autotools",
      "sources": [
        {
          "type": "git",
          "url": "https://github.com/libimobiledevice/libimobiledevice.git"
        }
      ]
    },
    {
      "name": "libdaemon",
      "buildsystem": "autotools",
      "sources": [
        {
          "type": "archive",
          "url": "http://0pointer.de/lennart/projects/libdaemon/libdaemon-0.14.tar.gz",
          "sha256": "fd23eb5f6f986dcc7e708307355ba3289abe03cc381fc47a80bca4a50aa6b834"
        }
      ]
    },
    {
      "name": "libevent",
      "buildsystem": "autotools",
      "config-opts": [
        "--disable-samples",
        "--disable-openssl",
        "--disable-debug-mode",
        "--disable-regress",
        "--disable-libevent-regress",
        "--disable-test-programs"
      ],
      "sources": [
        {
          "type": "git",
          "url": "https://github.com/libevent/libevent.git"
        }
      ]
    },
    {
      "name": "avahi",
      "buildsystem": "autotools",
      "config-opts": [
        "--disable-static",
        "--disable-mono",
        "--disable-python",
        "--disable-qt5",
        "--disable-gtk",
        "--disable-gtk3",
        "--with-distro=none",
        "--disable-manpages",
        "--disable-dbus-bus-activation",
        "--enable-compat-libdns_sd"
      ],
      "sources": [
        {
          "type": "git",
          "url": "https://github.com/lathiat/avahi.git"
        }
      ]
    },
    {
      "name": "libirecovery",
      "buildsystem": "autotools",
      "sources": [
        {
          "type": "git",
          "url": "https://github.com/libimobiledevice/libirecovery.git"
        }
      ]
    },
    {
      "name": "libde265",
      "buildsystem": "autotools",
      "config-opts": ["--disable-dec265", "--disable-sherlock265"],
      "sources": [
        {
          "type": "git",
          "url": "https://github.com/strukturag/libde265.git"
        }
      ]
    },
    {
      "name": "libheif",
      "buildsystem": "cmake-ninja",
      "config-opts": ["-DWITH_EXAMPLES=OFF", "-DWITH_DOCUMENTATION=OFF"],
      "sources": [
        {
          "type": "git",
          "url": "https://github.com/strukturag/libheif.git"
        }
      ]
    },
    {
      "name": "libzip",
      "buildsystem": "cmake-ninja",
      "sources": [
        {
          "type": "git",
          "url": "https://github.com/nih-at/libzip.git",
          "branch": "main"
        }
      ]
    },
    {
      "name": "libssh",
      "buildsystem": "cmake-ninja",
      "builddir": true,
      "sources": [
        {
          "type": "archive",
          "url": "https://www.libssh.org/files/0.11/libssh-0.11.3.tar.xz",
          "sha256": "7d8a1361bb094ec3f511964e78a5a4dba689b5986e112afabe4f4d0d6c6125c3"
        }
      ]
    },
    {
      "name": "pugixml",
      "buildsystem": "cmake-ninja",
      "sources": [
        {
          "type": "git",
          "url": "https://github.com/zeux/pugixml.git"
        }
      ]
    },
    {
      "name": "iDescriptor",
      "buildsystem": "cmake-ninja",
      "build-options": {
        "build-args": ["--share=network"]
      },
      "config-opts": [
        "-DCUSTOM_LIB_PATH=/app/lib",
        "-DCUSTOM_INCLUDE_PATH=/app/include",
        "-DCUSTOM_PKGCONFIG_PATH=/app/lib/pkgconfig",
        "-DGO_EXECUTABLE=/app/sdk/golang/bin/go",
        "-DFLATPAK_BUILD=ON"
      ],
      "sources": [
        {
          "type": "dir",
          "path": "."
        }
      ]
    }
  ]
}


where do i go from here ? Thank you

It’s hard to tell without knowing how app is achieving access. Maybe usbmuxd daemon have any logs

A libimobiledevice maintainer says :

I guess you need access to all the /dev/bus/usb* device files

Here is lsusb outputs

//!device is plugged in before running
flatpak run --devel --command=sh com.idescriptor.idescriptor
//HOST
[📦 com.idescriptor.idescriptor iDescriptor]$ flatpak-spawn --host lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID a8a5:2255 YJX-CHIP USB Receiver
Bus 001 Device 003: ID 3554:fa09 CX 2.4G Wireless Receiver
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 002: ID 1b3f:2008 Generalplus Technology Inc. USB Audio Device
Bus 003 Device 003: ID 0b05:18f3 ASUSTek Computer, Inc. AURA LED Controller
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 005 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 005 Device 002: ID 05ac:12a8 Apple, Inc. iPhone 5/5C/5S/6/SE/7/8/X/XR
Bus 005 Device 003: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)
Bus 006 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub

//SANDBOX
[📦 com.idescriptor.idescriptor iDescriptor]$ ls /sys/bus/usb/devices
1-0:1.0  1-1:1.0  1-1:1.2  1-2:1.0  2-0:1.0  3-1      3-1:1.1  3-1:1.3  3-6:1.0  4-0:1.0  5-1      5-1:4.1  5-3      5-3:1.1  usb1  usb3  usb5
1-1      1-1:1.1  1-2      1-2:1.1  3-0:1.0  3-1:1.0  3-1:1.2  3-6      3-6:1.2  5-0:1.0  5-1:4.0  5-1:4.2  5-3:1.0  6-0:1.0  usb2  usb4  usb6

//SANDBOX PARSED
[📦 com.idescriptor.idescriptor iDescriptor]$ for d in /sys/bus/usb/devices/*; do   [ -f "$d/idVendor" ] || continue;   v=$(cat "$d/idVendor");   p=$(cat "$d/idProduct");   cls=$(cat "$d/bDeviceClass" 2>/dev/null);   serial=$(cat "$d/serial" 2>/dev/null);   echo "$d  VID:PID=${v}:${p} Class=$cls Serial=$serial"; done
/sys/bus/usb/devices/1-1  VID:PID=a8a5:2255 Class=00 Serial=M240711R52V188
/sys/bus/usb/devices/1-2  VID:PID=3554:fa09 Class=00 Serial=
/sys/bus/usb/devices/3-1  VID:PID=1b3f:2008 Class=00 Serial=
/sys/bus/usb/devices/3-6  VID:PID=0b05:18f3 Class=00 Serial=9876543210
/sys/bus/usb/devices/5-1  VID:PID=05ac:12a8 Class=00 Serial=c5a8d0a8724be1cae91cfc3f90519e435b92cb00
/sys/bus/usb/devices/5-3  VID:PID=0a12:0001 Class=e0 Serial=
/sys/bus/usb/devices/usb1  VID:PID=1d6b:0002 Class=09 Serial=0000:06:00.1
/sys/bus/usb/devices/usb2  VID:PID=1d6b:0003 Class=09 Serial=0000:06:00.1
/sys/bus/usb/devices/usb3  VID:PID=1d6b:0002 Class=09 Serial=0000:06:00.3
/sys/bus/usb/devices/usb4  VID:PID=1d6b:0003 Class=09 Serial=0000:06:00.3
/sys/bus/usb/devices/usb5  VID:PID=1d6b:0002 Class=09 Serial=0000:0b:00.3
/sys/bus/usb/devices/usb6  VID:PID=1d6b:0003 Class=09 Serial=0000:0b:00.3

//UNPLUGGED HERE

[📦 com.idescriptor.idescriptor iDescriptor]$ flatpak-spawn --host lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID a8a5:2255 YJX-CHIP USB Receiver
Bus 001 Device 003: ID 3554:fa09 CX 2.4G Wireless Receiver
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 002: ID 1b3f:2008 Generalplus Technology Inc. USB Audio Device
Bus 003 Device 003: ID 0b05:18f3 ASUSTek Computer, Inc. AURA LED Controller
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 005 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 005 Device 003: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)
Bus 006 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub

// SANDBOX (after unplugged)
[📦 com.idescriptor.idescriptor iDescriptor]$ ls /sys/bus/usb/devices
1-0:1.0  1-1:1.0  1-1:1.2  1-2:1.0  2-0:1.0  3-1      3-1:1.1  3-1:1.3  3-6:1.0  4-0:1.0  5-3      5-3:1.1  usb1  usb3  usb5
1-1      1-1:1.1  1-2      1-2:1.1  3-0:1.0  3-1:1.0  3-1:1.2  3-6      3-6:1.2  5-0:1.0  5-3:1.0  6-0:1.0  usb2  usb4  usb6

//parsed
[📦 com.idescriptor.idescriptor iDescriptor]$ for d in /sys/bus/usb/devices/*; do   [ -f "$d/idVendor" ] || continue;   v=$(cat "$d/idVendor");   p=$(cat "$d/idProduct");   cls=$(cat "$d/bDeviceClass" 2>/dev/null);   serial=$(cat "$d/serial" 2>/dev/null);   echo "$d  VID:PID=${v}:${p} Class=$cls Serial=$serial"; done
/sys/bus/usb/devices/1-1  VID:PID=a8a5:2255 Class=00 Serial=M240711R52V188
/sys/bus/usb/devices/1-2  VID:PID=3554:fa09 Class=00 Serial=
/sys/bus/usb/devices/3-1  VID:PID=1b3f:2008 Class=00 Serial=
/sys/bus/usb/devices/3-6  VID:PID=0b05:18f3 Class=00 Serial=9876543210
/sys/bus/usb/devices/5-3  VID:PID=0a12:0001 Class=e0 Serial=
/sys/bus/usb/devices/usb1  VID:PID=1d6b:0002 Class=09 Serial=0000:06:00.1
/sys/bus/usb/devices/usb2  VID:PID=1d6b:0003 Class=09 Serial=0000:06:00.1
/sys/bus/usb/devices/usb3  VID:PID=1d6b:0002 Class=09 Serial=0000:06:00.3
/sys/bus/usb/devices/usb4  VID:PID=1d6b:0003 Class=09 Serial=0000:06:00.3
/sys/bus/usb/devices/usb5  VID:PID=1d6b:0002 Class=09 Serial=0000:0b:00.3
/sys/bus/usb/devices/usb6  VID:PID=1d6b:0003 Class=09 Serial=0000:0b:00.3

//PLUGGED BACK IN
[📦 com.idescriptor.idescriptor iDescriptor]$ flatpak-spawn --host lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID a8a5:2255 YJX-CHIP USB Receiver
Bus 001 Device 003: ID 3554:fa09 CX 2.4G Wireless Receiver
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 002: ID 1b3f:2008 Generalplus Technology Inc. USB Audio Device
Bus 003 Device 003: ID 0b05:18f3 ASUSTek Computer, Inc. AURA LED Controller
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 005 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 005 Device 003: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)
Bus 005 Device 004: ID 05ac:12a8 Apple, Inc. iPhone 5/5C/5S/6/SE/7/8/X/XR
Bus 006 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub

//SANDBOX
[📦 com.idescriptor.idescriptor iDescriptor]$ ls /sys/bus/usb/devices
1-0:1.0  1-1:1.0  1-1:1.2  1-2:1.0  2-0:1.0  3-1      3-1:1.1  3-1:1.3  3-6:1.0  4-0:1.0  5-1      5-1:4.1  5-3      5-3:1.1  usb1  usb3  usb5
1-1      1-1:1.1  1-2      1-2:1.1  3-0:1.0  3-1:1.0  3-1:1.2  3-6      3-6:1.2  5-0:1.0  5-1:4.0  5-1:4.2  5-3:1.0  6-0:1.0  usb2  usb4  usb6

//SANDBOX PARSED
[📦 com.idescriptor.idescriptor iDescriptor]$ for d in /sys/bus/usb/devices/*; do   [ -f "$d/idVendor" ] || continue;   v=$(cat "$d/idVendor");   p=$(cat "$d/idProduct");   cls=$(cat "$d/bDeviceClass" 2>/dev/null);   serial=$(cat "$d/serial" 2>/dev/null);   echo "$d  VID:PID=${v}:${p} Class=$cls Serial=$serial"; done
/sys/bus/usb/devices/1-1  VID:PID=a8a5:2255 Class=00 Serial=M240711R52V188
/sys/bus/usb/devices/1-2  VID:PID=3554:fa09 Class=00 Serial=
/sys/bus/usb/devices/3-1  VID:PID=1b3f:2008 Class=00 Serial=
/sys/bus/usb/devices/3-6  VID:PID=0b05:18f3 Class=00 Serial=9876543210
/sys/bus/usb/devices/5-1  VID:PID=05ac:12a8 Class=00 Serial=c5a8d0a8724be1cae91cfc3f90519e435b92cb00
/sys/bus/usb/devices/5-3  VID:PID=0a12:0001 Class=e0 Serial=
/sys/bus/usb/devices/usb1  VID:PID=1d6b:0002 Class=09 Serial=0000:06:00.1
/sys/bus/usb/devices/usb2  VID:PID=1d6b:0003 Class=09 Serial=0000:06:00.1
/sys/bus/usb/devices/usb3  VID:PID=1d6b:0002 Class=09 Serial=0000:06:00.3
/sys/bus/usb/devices/usb4  VID:PID=1d6b:0003 Class=09 Serial=0000:06:00.3
/sys/bus/usb/devices/usb5  VID:PID=1d6b:0002 Class=09 Serial=0000:0b:00.3
/sys/bus/usb/devices/usb6  VID:PID=1d6b:0003 Class=09 Serial=0000:0b:00.3
[📦 com.idescriptor.idescriptor iDescriptor]$ 

I tried setting --device=usb and --device=all

flatpak info --show-permissions com.idescriptor.idescriptor                              
[Context]
shared=network;ipc;
sockets=x11;pulseaudio;
devices=shm;usb;
filesystems=/sys/class:ro;/run/udev:ro;/sys/devices:ro;/run/usbmuxd;/var/lib/lockdown;/sys/bus:ro;host;xdg-config/kdeglobals:ro;

[Session Bus Policy]
com.canonical.AppMenu.Registrar=talk
org.kde.kconfig.notify=talk
org.kde.KGlobalSettings=talk
org.freedesktop.Flatpak=talk
org.kde.kdeconnect=talk
org.freedesktop.Platform.ffmpeg-full=talk
org.libimobiledevice.usbmuxd=talk

[System Bus Policy]
org.freedesktop.Flatpak=talk
org.freedesktop.NetworkManager=talk
org.freedesktop.Avahi=talk
org.freedesktop.login1=talk
org.libimobiledevice.usbmuxd=talk
org.freedesktop.systemd1=talk

[Environment]
QT_MEDIA_BACKEND=ffmpeg
AVAHI_COMPAT_NOWARN=1
USBMUXD_SOCKET_ADDRESS=/run/usbmuxd

I wonder if it has to anything with the permissions on host ?

Because i had a similar case with recovery devices

This is what i did for recovery devices to work on host machine when developing iDescriptor


#!/bin/bash
set -e

USERNAME=$1

if [ -z "$USERNAME" ]; then
    echo "Error: Username not provided." >&2
    exit 1
fi

# Create udev rules file
echo 'SUBSYSTEM=="usb", ATTR{idVendor}=="05ac", MODE="0666", GROUP="idevice"' | tee /etc/udev/rules.d/99-idevice.rules > /dev/null

# Create idevice group if it doesn't exist
if ! getent group idevice > /dev/null 2>&1; then
    groupadd idevice
fi

# Add current user to idevice group
usermod -aG idevice "$USERNAME"

# Reload udev rules
udevadm control --reload-rules
udevadm trigger

echo 'USB device permissions configured successfully!'
echo 'Note: You may need to log out and log back in for group changes to take effect.'

Hotplug works on Snapcraft build with these permissions

apps:
  idescriptor:
    command: usr/bin/idescriptor
    desktop: usr/share/applications/iDescriptor.desktop
    extensions: [kde-neon-6]
    plugs:
      - desktop
      - opengl
      - x11
      - network
      - home
      - audio-playback
      - raw-usb
      - fuse-support
      - avahi-observe
      - hardware-observe
      - usbmuxd-socket
      - lockdown
      - udev-run
      - network-bind
   
plugs:
  usbmuxd-dbus:
    interface: dbus
    bus: system
    name: org.libimobiledevice.usbmuxd

  usbmuxd-socket:
    interface: system-files
    read:
      - /run/usbmuxd
      - /var/run/usbmuxd
    write:
      - /run/usbmuxd
      - /var/run/usbmuxd

  lockdown:
    interface: system-files
    read:
      - /var/lib/lockdown
    write:
      - /var/lib/lockdown

  udev-run:
    interface: system-files
    read:
      - /run/udev
      - /var/run/udev

  systemd-dbus:
    interface: dbus
    bus: system
    name: org.freedesktop.systemd1

Can’t really help with your issue, but I have a few thought about some minor things looking at the manifest:

  • Instead of building golang yourself, you should use the SDK extension (org.freedesktop.Sdk.Extension.golang).
  • In your last module, you’re using the --share=network build argument, presumably to get network during build.
    When apps are build on Flathub, they are build without network access. All sources need to be declared in the manifest.
    Check the Flatpak Builder Tools if you use packages that are usually pulled during build.

–device=all covers all of /dev, –device=usb is redundant.

Does /run/usbmuxd file exist before you start your app? If it doesn’t then it wouldn’t be able to access if afterwards (if usbmuxd is started only after launching app).

If there is a device connected yes it does if not when you plug in it’s created.

Why is this the case, is there a way i can make it work ?

Because, AFAIK, Flatpak sets up the bind mounts for the sandbox when the application is launched. So if a directory isn’t found on launch, it will not be mounted into the sandbox.

You might be able to make it work by adding :create? Then it would be created if it doesn’t exist on launch.

Nope didn’t work, used this in the finish-args array

"--filesystem=/run/usbmuxd:create:rw"

Btw @CodedOre thank you for your previous suggestions i will look into them after i figure this out

/run/usbmuxd gets destroyed once device is unplugged incase you guys haven’t noticed it

Don’t use both :rw and :create. :create will give you read/write access to the path, so the :rw is not needed. Probably will make undefined behavior instead…

Tried "--filesystem=/run/usbmuxd:create" it didn’t work either @CodedOre

- flatpak info --show-permissions com.idescriptor.idescriptor                  
[Context]
shared=network;ipc;
sockets=x11;pulseaudio;
devices=all;shm;usb;
filesystems=/sys/bus/usb:ro;/run/udev:ro;/sys/class:ro;/sys/devices:ro;/run/usbmuxd:create;/var/lib/lockdown;/sys/bus:ro;xdg-config/kdeglobals:ro;host;

[Session Bus Policy]
com.canonical.AppMenu.Registrar=talk
org.kde.kconfig.notify=talk
org.kde.KGlobalSettings=talk
org.freedesktop.Flatpak=talk
org.kde.kdeconnect=talk
org.freedesktop.Platform.ffmpeg-full=talk
org.libimobiledevice.usbmuxd=talk

[System Bus Policy]
org.freedesktop.Flatpak=talk
org.freedesktop.NetworkManager=talk
org.freedesktop.Avahi=talk
org.freedesktop.login1=talk
org.libimobiledevice.usbmuxd=talk
org.freedesktop.systemd1=talk

[Environment]
QT_MEDIA_BACKEND=ffmpeg
AVAHI_COMPAT_NOWARN=1

manifest

"finish-args": [
   "--socket=x11",
   "--share=ipc",
   "--socket=pulseaudio",
   "--share=network",
   "--device=all",
   "--filesystem=/run/usbmuxd:create",
   "--filesystem=/var/lib/lockdown:rw",
   "--filesystem=/run/udev:ro",
   "--system-talk-name=org.freedesktop.Avahi",
   "--talk-name=org.libimobiledevice.usbmuxd",
   "--system-talk-name=org.libimobiledevice.usbmuxd",
   "--system-talk-name=org.freedesktop.login1",
   "--system-talk-name=org.freedesktop.NetworkManager",
   "--system-talk-name=org.freedesktop.systemd1",
   "--talk-name=org.freedesktop.Platform.ffmpeg-full",
   "--talk-name=org.freedesktop.Flatpak",
   "--system-talk-name=org.freedesktop.Flatpak",
   "--env=QT_MEDIA_BACKEND=ffmpeg",
   "--env=AVAHI_COMPAT_NOWARN=1",
   "--env=USBMUXD_SOCKET_ADDRESS=/run/usbmuxd",
   "--filesystem=/sys/bus/usb:ro",
   "--filesystem=/sys/devices:ro"
 ]

also idk why but

if i remove these "--filesystem=/sys/bus/usb:ro", "--filesystem=/sys/devices:ro" the app crashes if i unplug the device

tried without --env=USBMUXD_SOCKET_ADDRESS=/run/usbmuxd didnt work

i have these for debugging purposes for now "--talk-name=org.freedesktop.Flatpak" "--system-talk-name=org.freedesktop.Flatpak"

To make it work in flatpak you would need to put usbmuxd socket file into subdirectory - /run/usbmuxd/usbmuxd . Maybe creating systemd listening socket in /run/usbmuxd that would preserve the file before real usbmuxd is started would work as well. :create certainly won’t help.

This is strange because flatpak automatically gives access to those paths . You need to debug why app crashes.

I created a super simple example using libimobiledevice for debugging purposes ,

Please do

git clone https://github.com/uncor3/flatpak-libimobiledevice

I hope we can figure this out

The behavior is the same

flatpak run test.flathub.libimobiledevice                                                  
Subscribed to device events successfully.
Device connected.
Device disconnected.
^C
                                                                                                                        
Unsubscribing from device events.
flatpak run test.flathub.libimobiledevice
Subscribed to device events successfully.

@CodedOre @Erick555

Any updates ? @CodedOre @Erick555

Sorry, but I don’t use iPhones anymore, so I can’t test this here locally.