- 2001年9月頃に発売されたChe-ez! SPYZをRaspberry Piで読み込む。
- USBのタイミングが繊細なため、仮想環境だと失敗しやすい。
- Raspberry Pi OS(Debian GNU/Linux 12 (bookworm) arm64) + Raspberry Pi 4を使用。
- STV0680モジュールはoutdatedなため、gphoto2, libgphoto2はソースからビルドする必要がある。
- ImageMagickをソースからビルドしているが、ImageMagick7の機能を使わないならaptでいれていい。
- spyz.sh でカレントディレクトリにフォルダをつくりダウンロードする。PNMからPNGに変換している。
- Che-ez! SPYZは
gphoto2 --auto-detectでAEG Snap 300と認識される。
Last active
August 26, 2025 23:44
-
-
Save mamemomonga/d6578036fdd1afc25aaf01bbfebd17c9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| set -eu | |
| # インストーラ rootで実行 | |
| apt update | |
| apt install -y build-essential automake autoconf libtool pkg-config \ | |
| libusb-1.0-0-dev libexif-dev libjpeg-dev libgd-dev libcurl4-openssl-dev \ | |
| libxml2-dev gettext autopoint libpopt-dev git sudo | |
| cd /usr/local/src | |
| git clone --depth 1 https://github.com/gphoto/libgphoto2.git | |
| cd libgphoto2 | |
| autoreconf -is | |
| ./configure --prefix=/usr/local --with-camlibs=all,outdated | |
| make -j"$(nproc)" | |
| make install | |
| ldconfig /usr/local/lib | |
| cd /usr/local/src | |
| git clone --depth 1 https://github.com/gphoto/gphoto2.git | |
| cd gphoto2 | |
| autoreconf -is | |
| ./configure --prefix=/usr/local | |
| make -j"$(nproc)" | |
| make install | |
| cat >/etc/udev/rules.d/99-spyz.rules <<EOF | |
| SUBSYSTEM=="usb", ATTR{idVendor}=="0553", ATTR{idProduct}=="0202", MODE="0666" | |
| EOF | |
| udevadm control --reload | |
| udevadm trigger | |
| # ここではImageMagick7をいれているが、apt install imagemagick で ImageMagick6をいれてもいい | |
| cd /usr/local/src | |
| git clone --branch 7.1.2-2 --depth 1 https://github.com/ImageMagick/ImageMagick.git | |
| cd ImageMagick | |
| git checkout 7.1.2-2 | |
| ./configure --with-modules --disable-static --prefix=/usr/local | |
| make -j$(nproc) | |
| make install | |
| ldconfig /usr/local/lib |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| # save as: spyz_pull_and_convert.sh | |
| # usage: ./spyz_pull_and_convert.sh | |
| # requires: gphoto2, ImageMagick (magick または convert) | |
| set -euo pipefail | |
| # 前提チェック | |
| command -v gphoto2 >/dev/null || { echo "gphoto2 が見つかりません"; exit 1; } | |
| if command -v magick >/dev/null; then | |
| IMCMD="magick" | |
| elif command -v convert >/dev/null; then | |
| IMCMD="convert" | |
| else | |
| echo "ImageMagick が見つかりません"; exit 1 | |
| fi | |
| # タイムスタンプ付きフォルダ作成 | |
| TS="$(date +%Y%m%d-%H%M)" | |
| OUT_DIR="./${TS}" | |
| mkdir -p "$OUT_DIR" | |
| echo "[1/3] Downloading from camera into: $OUT_DIR" | |
| # ダウンロード時点で .pnm 拡張子を付与 | |
| gphoto2 --get-all-files --force-overwrite --filename "$OUT_DIR/%f.pnm" | |
| echo "[2/3] Converting PNM -> PNG and removing originals" | |
| shopt -s nullglob nocaseglob | |
| converted=0 | |
| for src in "$OUT_DIR"/*.pnm; do | |
| [[ -e "$src" ]] || continue | |
| base="${src%.*}" | |
| dst="${base}.png" | |
| echo " - $src -> $dst" | |
| $IMCMD "$src" "$dst" | |
| rm -f "$src" | |
| converted=$((converted+1)) | |
| done | |
| echo "[3/3] Done. PNG files saved in: $OUT_DIR" | |
| echo "Converted PNG files: $converted" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment