金曜日, 1月 20, 2023

GT-9400UFを Raspberry Pi Desktop for PC (bullseya)で使う

Ubuntuの64BitでGT-9400UFを使えるように色々とやってみたがうまく行かないので、32BIt版のRaspberry Pi Desotop for PC(bullseye)で使えるようにとやってみました。
※個人用のメモなので間違いが有るかも?

EPSON ドライバーダウンロード」に型式とOSを入力し、検索。

GT-9400UF, Linux Driver
 

gcc 3.4以降用の2番と4番目をダウンロードします。
※Linux版のChrome、chromiumでは安全で無いとのことでダウンロードボタンが効きません。Windows版のChromeでは注意喚起がありますが、メニューから保存可能です。ダウンロードリンクもコピー出来たので、下記に記します。※※自己責任!

フォルダー「GT-9400UF」作成し、そこで作業します。

md5チェックサムの計算
$ md5sum *.rpm
349715562010b0905b0a2aa6c758fb85  iscan-2.10.0-1.c2.i386.rpm
f76725766f44debe3f3fec06d0e2023b  iscan-plugin-gt-9400-1.0.0-1.c2.i386.rpm

「Image Scan! for Linux 操作ガイド」(userg_revG_j.pdf)には下記が書いてあります。 

Image Scan! for Linux を使用するコンピュータには、SANE パッケージ バージョン 1.0.3 以降がインストールされている必要があります。

SANEはRaspberry Pi Desotop for PCにインストール済みで下記コマンドでバージョン確認が可能です。

$ scanimage -V
scanimage (sane-backends) 1.0.31-debian; backend version 1.0.31


下記を参照し、iscan ソフトウェア パッケージで root 以外のユーザーが USBスキャナーにアクセスできるようにudev ルールを作成するファイルを編集します。


最初に開発環境の確認とインストール

gccインストールの確認
$ apt show gcc
Package: gcc
Version: 4:10.2.1-1
Priority: optional
Build-Essential: yes
Section: devel
Source: gcc-defaults (1.190)
Maintainer: Debian GCC Maintainers <debian-gcc@lists.debian.org>
Installed-Size: 56.3 kB
Provides: c-compiler, gcc-i686-linux-gnu (= 4:10.2.1-1)
Depends: cpp (= 4:10.2.1-1), gcc-10 (>= 10.2.1-3~)
Recommends: libc6-dev | libc-dev
Suggests: gcc-multilib, make, manpages-dev, autoconf, automake, libtool, flex, bison, gdb, gcc-doc
Conflicts: gcc-doc (<< 1:2.95.3)
Tag: devel::compiler, devel::lang:c, devel::library, implemented-in::c,
 interface::commandline, role::devel-lib, role::metapackage,
 role::program, suite::gnu, works-with::software:source
Download-Size: 5,244 B
APT-Manual-Installed: no
APT-Sources: http://deb.debian.org/debian bullseye/main i386 Packages
Description: GNU C コンパイラ
 これは GNU C コンパイラです。移植性に優れ、最適化を行う C 言語用コンパイラ
 です。
 .
 本パッケージは、デフォルトの GNU C コンパイラを提供する依存パッケージです。


alienのインストールとバージョン確認、使い方
$ sudo apt install alien


$ alien --version
alien version 8.95.4


$ alien --help
Usage: alien [options] file [...]
  file [...]                Package file or files to convert.
  -d, --to-deb              Generate a Debian deb package (default).
     Enables these options:
       --patch=<patch>      Specify patch file to use instead of automatically
                            looking for patch in /var/lib/alien.
       --nopatch	    Do not use patches.
       --anypatch           Use even old version os patches.
       -s, --single         Like --generate, but do not create .orig
                            directory.
       --fixperms           Munge/fix permissions and owners.
       --test               Test generated packages with lintian.
  -r, --to-rpm              Generate a Red Hat rpm package.
      --to-slp              Generate a Stampede slp package.
  -l, --to-lsb              Generate a LSB package.
  -t, --to-tgz              Generate a Slackware tgz package.
     Enables these options:
       --description=<desc> Specify package description.
       --version=<version>  Specify package version.
  -p, --to-pkg              Generate a Solaris pkg package.
  -i, --install             Install generated package.
  -g, --generate            Generate build tree, but do not build package.
  -c, --scripts             Include scripts in package.
      --target=<arch>       Set architecture of the generated package.
  -v, --verbose             Display each command alien runs.
      --veryverbose         Be verbose, and also display output of run commands.
  -k, --keep-version        Do not change version of generated package.
      --bump=number         Increment package version by this number.
  -h, --help                Display this help message.
  -V, --version		    Display alien's version number.

$ rpm --version
RPM version 4.16.1.2



debuildインストール
$ debuild
bash: debuild: コマンドが見つかりません

$ devscripts
bash: devscripts: コマンドが見つかりません

$ debuild --version
This is debuild, from the Debian devscripts package, version 2.21.3+deb11u1
This code is copyright 1999-2003 by Julian Gilbey <jdg@debian.org>,
all rights reserved.
Based on a shell-script program by Christoph Lameter.
This program comes with ABSOLUTELY NO WARRANTY.
You are free to redistribute this code under the terms of the
GNU General Public License, version 2 or later.

$ debuild --help
First usage method:
  debuild [<debuild options>] -- binary|binary-arch|binary-indep|clean ...
    to run debian/rules with given parameter(s).  Options here are
        --no-conf, --noconf      Don't read devscripts config files;
                                 must be the first option given
        --rootcmd=<gain-root-command>, -r<gain-root-command>
                                 Command used to become root if debuild
                                 not setuid root; default=fakeroot

        --preserve-envvar=<envvar>, -e<envvar>
                                 Preserve environment variable <envvar>

        --preserve-env           Preserve all environment vars (except PATH)

        --set-envvar=<envvar>=<value>, -e<envvar>=<value>
                                 Set environment variable <envvar> to <value>

        --prepend-path=<value>   Prepend <value> to the sanitised PATH

        -d                       Skip checking of build dependencies
        -D                       Force checking of build dependencies (default)

        --check-dirname-level N
                How much to check directory names:
                N=0   never
                N=1   only if program changes directory (default)
                N=2   always

        --check-dirname-regex REGEX
                What constitutes a matching directory name; REGEX is
                a Perl regular expression; the string `PACKAGE' will
                be replaced by the package name; see manpage for details
                (default: 'PACKAGE(-.+)?')

        --help, -h    display this message

        --version     show version and copyright information

Second usage method:
  debuild [<debuild options>] [<dpkg-buildpackage options>]
             [--lintian-opts <lintian options>]
    to run dpkg-buildpackage and then run lintian on the resulting
    .changes file.

    Additional debuild options available in this case are:

        --lintian           Run lintian (default)
        --no-lintian        Do not run lintian
        --[no-]tgz-check    Do [not] check for an .orig.tar.gz before running
                            dpkg-buildpackage if we have a Debian revision
                            (Default: check)
        --username          Run debrsign instead of debsign, using the
                            supplied credentials

        --dpkg-buildpackage-hook=HOOK
        --clean-hook=HOOK
        --dpkg-source-hook=HOOK
        --build-hook=HOOK
        --binary-hook=HOOK
        --dpkg-genchanges-hook=HOOK
        --final-clean-hook=HOOK
        --lintian-hook=HOOK
        --signing-hook=HOOK
        --post-dpkg-buildpackage-hook=HOOK
                            These hooks run at the various stages of the
                            dpkg-buildpackage run.  For details, see the
                            debuild manpage.  They default to nothing, and
                            can be reset to nothing with --foo-hook=''
        --clear-hooks       Clear all hooks

    For available dpkg-buildpackage and lintian options, see their
    respective manpages.

Default settings modified by devscripts configuration files:
  (none)


パッケージの検索コマンドラインツールをインストール、アップデート
$ sudo apt install -y apt-file
$ sudo apt-file update

.rpmから.debパッケージへの変換
$ cd GT-9400UF

$ sudo alien -g --scripts iscan-plugin-gt-9400-1.0.0-1.c2.i386.rpm
Directories iscan-plugin-gt-9400-1.0.0 and iscan-plugin-gt-9400-1.0.0.orig prepared.

$ sudo alien -g --scripts iscan-2.10.0-1.c2.i386.rpm
Directories iscan-2.10.0 and iscan-2.10.0.orig prepared.

$ cd ..


ここで iscan-2.10.0/usr/lib/iscan/make-udev-rules の編集をする
$ sudo nano iscan-2.10.0/usr/lib/iscan/make-udev-rules

 'SYSFS' を'ATTRS' に置き換えは置換で実施、コメントを含めて5箇所あった。
 'usb_device' を 'usb' に置き換え、一箇所。

もう一つは下記のようにTEMPLETEの行を編集。
# Before
TEMPLATE='ATTRS{idVendor}=="04b8", ATTRS{idProduct}=="HHHH", MODE="0666"'

# After
TEMPLATE='ENV{DEVTYPE}=="usb_device", ATTRS{idVendor}=="04b8", ATTRS{idProduct}=="HHHH", MODE="0666"'

diffで編集した新旧ファイルの差分を確認
$ diff iscan-2.10.0/usr/lib/iscan/make-udev-rules iscan-2.10.0.orig/usr/lib/iscan/make-udev-rules
26,27c26,27
< TEMPLATE='ENV{DEVTYPE}=="usb_device", ATTRS{idVendor}=="04b8", ATTRS{idProduct}=="HHHH", MODE="0666"'
< SUB_SYST='usb'
---
> TEMPLATE='SYSFS{idVendor}=="04b8", SYSFS{idProduct}=="HHHH", MODE="0666"'
> SUB_SYST='usb_device'
57c57
< #  does assume that ATTRS{idVendor} is on the first line.
---
> #  does assume that SYSFS{idVendor} is on the first line.
61c61
<     /ATTRS{idVendor}=\{1,2\}"04[bB]8"/{
---
>     /SYSFS{idVendor}=\{1,2\}"04[bB]8"/{
67c67
< 	| sed 's/\(ATTRS{idProduct}=\{1,2\}\)"[[:xdigit:]]\{4\}"/\1"HHHH"/'
---
> 	| sed 's/\(SYSFS{idProduct}=\{1,2\}\)"[[:xdigit:]]\{4\}"/\1"HHHH"/'

32bitなので、Architectureにamd64の追加はしていない。


debuildを実施
$ cd iscan-2.10.0
$ sudo debuild -uc -us -b

$ cd ..

$ cd iscan-plugin-gt-9400-1.0.0
$ sudo debuild -uc -us -b

$ cd ..

iscan_2.10.0-2_i386.buildのerror
dpkg-shlibdeps: error: cannot find library libusb-0.1.so.4 needed by debian/iscan/usr/lib/sane/libsane-epkowa.so.1.0.15 (ELF format: 'elf32-i386' abi: '0101000300000000'; RPATH: '')
dpkg-shlibdeps: error: cannot find library libpangox-1.0.so.0 needed by debian/iscan/usr/bin/iscan (ELF format: 'elf32-i386' abi: '0101000300000000'; RPATH: '')
dpkg-shlibdeps: error: cannot find library libusb-0.1.so.4 needed by debian/iscan/usr/bin/iscan (ELF format: 'elf32-i386' abi: '0101000300000000'; RPATH: '')
dpkg-shlibdeps: warning: package could avoid a useless dependency if debian/iscan/usr/bin/iscan was not linked against libpango-1.0.so.0 (it uses none of the library's symbols)
dpkg-shlibdeps: warning: package could avoid a useless dependency if debian/iscan/usr/lib/sane/libsane-epkowa.so.1.0.15 debian/iscan/usr/bin/iscan were not linked against libnsl.so.1 (they use none of the library's symbols)
dpkg-shlibdeps: warning: package could avoid a useless dependency if debian/iscan/usr/bin/iscan was not linked against libgmodule-2.0.so.0 (it uses none of the library's symbols)
dpkg-shlibdeps: warning: package could avoid a useless dependency if debian/iscan/usr/bin/iscan was not linked against libatk-1.0.so.0 (it uses none of the library's symbols)
dpkg-shlibdeps: warning: package could avoid a useless dependency if debian/iscan/usr/bin/iscan was not linked against libgdk_pixbuf-2.0.so.0 (it uses none of the library's symbols)
dpkg-shlibdeps: warning: package could avoid a useless dependency if debian/iscan/usr/lib/sane/libsane-epkowa.so.1.0.15 debian/iscan/usr/bin/iscan were not linked against libjpeg.so.62 (they use none of the library's symbols)
dpkg-shlibdeps: warning: package could avoid a useless dependency if debian/iscan/usr/lib/sane/libsane-epkowa.so.1.0.15 debian/iscan/usr/bin/iscan were not linked against libieee1284.so.3 (they use none of the library's symbols)
dpkg-shlibdeps: warning: package could avoid a useless dependency if debian/iscan/usr/bin/iscan was not linked against libpangoxft-1.0.so.0 (it uses none of the library's symbols)
dpkg-shlibdeps: error: cannot continue due to the errors listed above

    不足のライブラリーを検索してインストール
    $ apt-file search libusb-0.1.so.4
    libusb-0.1-4: /lib/i386-linux-gnu/libusb-0.1.so.4
    libusb-0.1-4: /lib/i386-linux-gnu/libusb-0.1.so.4.4.4
    
    $ sudo apt install libusb-0.1-4
    


    $ apt-file search libpangox-1.0.so.0
    libpangox-1.0-0: /usr/lib/i386-linux-gnu/libpangox-1.0.so.0
    libpangox-1.0-0: /usr/lib/i386-linux-gnu/libpangox-1.0.so.0.0.0
    
    $ sudo apt install libpangox-1.0-0

    再度、前記のdebuildを実施してエラーが無くなることを確認する

    ファイルマネージャーで「iscan_2.10.0-2_i386.deb」選択し、右ボタンの「パッケージのインストール」を実施

    インストール後は端末で「iscan」を起動すれば、ドライバーを必要としないGT-9300UFは使用可能になる。但し、保存形式は「pnm」のみ。「png」は選択可能だがlibpng warning発生。

    $ iscan
    libpng warning: Application built with libpng-1.2.7 but running with 1.6.37
    terminate called after throwing an instance of 'std::bad_alloc'
      what():  std::bad_alloc
    

    ファイルマネージャーで「iscan-plugin-gt-9400_1.0.0-2_i386.deb」選択し、右ボタンの「パッケージのインストール」を実施

    iscan_2.10.0-2をインストール

    この状態で端末から「iscan」で起動すればGT-9300UFは使用可能になる。

    GT-9400UFのプラグインをインストール



    $ scanimage -L
    
    No scanners were identified. If you were expecting something different,
    check that the scanner is plugged in, turned on and detected by the
    sane-find-scanner tool (if appropriate). Please read the documentation
    which came with this software (README, FAQ, manpages).
    
    $ sudo scanimage -L
    Created directory: /var/lib/snmp/cert_indexes
    device `epkowa:libusb:001:007' is a Epson GT-9400 flatbed scanner
    

    $ sudo scanimage -L
    device `epkowa:libusb:001:007' is a Epson GT-9400 flatbed scanner

    $ sane-find-scanner | grep 04b8 could not open USB device 0x04b8/0x0116 at 001:007: Access denied (insufficient permissions) 

    $ sudo sane-find-scanner | grep 04b8
    found USB scanner (vendor=0x04b8 [EPSON], product=0x0116 [EPSON Scanner]) at libusb:001:007
    

    ※使用可能になった後はsudo不要

    $ scanimage -L
    device `epkowa:libusb:003:010' is a Epson GT-9400 flatbed scanner

    $ sane-find-scanner | grep 04b8
    found USB scanner (vendor=0x04b8 [EPSON], product=0x0116 [EPSON Scanner]) at libusb:003:010


    GT-9400UFのプラグインをインストールする前に下記を行う必要があるかも?

    SANE/スキャナー別の問題 ※Epson Perfection 1270を参照
    • ドライバーファイルは iscan-plugin-gt-9400-1.0.0/usr/share/iscan/esfw32.bin
      • ドライバーファイルを /usr/share/sane/epson2 へコピー
      • /usr/shere/iscan/esfw32.bin コピーされている事を確認する
    • GT-9400UFのバックエンドの設定ファイルは /etc/sane.d/epson2.conf
    • $ sudo nano /etc/sane.d/epson2.conf
    • /etc/hotplug/usb/iscan.usermap は確認のみ
    $ sudo pcmanfm ※管理者権限でファイルマネージャーを起動

    --
    Add / Remove SoftwareでSANEを検索し、xsane-0.999-10とsimple-scan-3.38.1-1をインストール。gimpをインストールすれば、jpeg,png,PDF等で保存可能になる。XSaneでもスキャン後に任意のファイル形式で保存可能。

    gimp 画像の生成 > XSane

    --
    設定 > Main Menu Editorでグラフィックスに登録
        Command: /usr/bin/iscan
        Name、Commentは適当に登録。必要ならアイコンを変更
    --
    Image Scan! for Linuxではjpeg形式の保存を選択できないが、Add Remove Softwareで「libjpeg-turbo JPEG ライブラリの開発用ファイル」をインストールすれば、jpegでの保存が可能になる。
    Add Remove Software


    0 件のコメント:

    コメントを投稿

    YQ60YODXC: Not Found In My Log on 24MHz

     ログに載っていないeQSLです。3バンド分来てますが、12Mのみ載ってません。 InBox: YQ60YODXC on 12M 202408_ALL.TXTから該当部分を抽出しました。 ---------- 202408_ALL.TXT 20240802_191300 -10 ...