iOS

提供: ArchWiki
2022年12月15日 (木) 09:26時点におけるKusanaginoturugi (トーク | 投稿記録)による版 (序文を飜訳)
ナビゲーションに移動 検索に移動

関連記事

iOS は、Apple Inc.が開発した iPhone シリーズのスマートフォン向け OS です。 iOS デバイスを Linux に接続することは Apple によってサポートされていませんが、libimobiledevice プロジェクトは、iOS デバイスと Linux マシン間で接続してデータを転送するためのライブラリとツールを提供します。

ヒント: KDE#KDE Con​​nect は、iOS と Linux 間のファイル転送にも使用できます。

Installation

Install the libimobiledevice package.

Connecting to a device

Usbmux daemon

The libimobiledevice package depends on usbmuxd, which is responsible for performing the low-level connection to iOS devices. The usbmuxd package also includes an udev rule that automatically starts and stops the daemon whenever a device is connected or disconnected.

Connect the iOS device and verify that usbmuxd.service is automatically started.

$ systemctl status usbmuxd.service
...
Active: active (running) since Sun 2020-01-19 19:23:18 UTC; 22s ago
...

Pairing

After connecting your iOS device and unlocking the screen, you should be presented with a "Trust This Computer?" popup on the device. Tap "Trust", then enter your device passcode to complete the pairing process.

If you do not see the popup, you can start the pairing process manually. Connect the device, unlock the screen and run:

$ idevicepair pair
SUCCESS: Paired with device d8e8fca2dc0f896fd7cb4cb0031ba249

If you have multiple iOS devices connected --udid ios_udid parameter can be passed to target specific device.

You can verify the pairing has succeeded by running:

$ idevicepair validate
SUCCESS: Validated pairing with device 00008030-001D3562367A402E

Transferring data

After pairing, iOS exposes two different filesystems to the computer. One is the media filesystem, containing the device's photos, videos and music. The second filesystem is used for sharing files directly to certain apps. This is sometimes called "iTunes document sharing". [1] [2]

Using a graphical file manager

File managers which use GVFS can interact with iOS devices. To access the media filesystem, install gvfs-gphoto2. To access the app document filesystem, install gvfs-afc.

ノート: When accessing the media filesystem, GVFS will only expose the device's photos and videos, not music.

To access iOS files using Dolphin, install solid-gitAUR and kio-extras-gitAUR. This will expose both the media and app document filesystems. [3]

Manual mounting

Install the ifuse package. You can then run the following command to mount your iPhone's media filesystem:

$ ifuse mountpoint

You can use this to access the device's photos inside mountpoint/DCIM.

ノート: The device's music database will also be accessible in mountpoint/iTunes_Control. You cannot add new songs to the device this way, but you can copy songs from the device to your computer.
警告: Manually editing the databases inside iTunes_Control will result in their corruption, and turn your synced songs into stale data that can only be removed with a system restore.

To access an app's document filesystem, first you need to identify the app:

$ ifuse --list-apps
"CFBundleIdentifier","CFBundleVersion","CFBundleDisplayName"
"org.videolan.vlc-ios","432","VLC"
"org.wikimedia.wikipedia","1932","Wikipedia"
"org.kde.kdeconnect","2","KDE Connect"
[...]

You can then mount an application's files using:

$ ifuse --documents APPID mountpoint

Where APPID is the bundle identifier of the desired application, such as org.videolan.vlc-ios.

After you're done, unmount the filesystem:

$ fusermount -u mountpoint

Importing videos and pictures

Both videos and photos can be found in typically in <mountpoint>/DCIM/100APPLE.

HTML5 videos

Typically you want to convert MOV files to a HTML5 video format like OGV using ffmpeg2theora. Note that the creation date metadata is not in the converted video, so you need to use a script like:

#!/usr/bin/sh

find -name "*.MOV" | while read mov
do
    d=$(gst-discoverer-1.0 -v $mov | awk '/datetime:/{print $2}' | tr -d \")
    base=${mov%.*}
    if test -f $base.ogv
    then
        touch -d${d} $base.ogv
        ls -l $base.ogv
    else
        echo $base.ogv missing
    fi
done

And use cp -a or rsync -t in order to preserve the file's date & time.

Troubleshooting

ifuse fails to mount application directories

When using ifuse to mount application directories, you may run into the following error when trying to list the contents of the mountpoint:

".": Input/output error (os error 5)

This is a known issue that has been fixed in the current development version of libimobiledevice, but has not been released in a stable version yet. A workaround is to install libimobiledevice-gitAUR.

Device cannot be redirected to a virtual machine

If you use a Windows virtual machine to sync your device via USB, trying to redirect it may fail with a "device is in use by another application" message. This is due to usbmuxd.service starting automatically when the device is connected. This can be solved by either stopping or masking usbmuxd.service.

See also