2008年10月23日木曜日

玄箱: CUPSを使用してiP7500に印刷(メモ)

  1. USBモジュールを登録します。
    • モジュールの情報を表示します。
    • # cd /lib/modules/2.6.25.1-kurobox/kernel/drivers/usb/class
      # modinfo usblp.ko
      filename: usblp.ko
      author: Michael Gee, Pavel Machek, Vojtech Pavlik, Randy Dunlap, Pete Zaitcev, David Paschal
      description: USB Printer Device Class driver
      license: GPL
      vermagic: 2.6.25.1-kurobox mod_unload
      depends:
      alias: usb:v*p*d*dc07dsc01dp01ic*isc*ip*
      alias: usb:v*p*d*dc07dsc01dp02ic*isc*ip*
      alias: usb:v*p*d*dc07dsc01dp03ic*isc*ip*
      alias: usb:v*p*d*dc*dsc*dp*ic07isc01ip01*
      alias: usb:v*p*d*dc*dsc*dp*ic07isc01ip02*
      alias: usb:v*p*d*dc*dsc*dp*ic07isc01ip03*
      alias: usb:v04B8p0202d*dc*dsc*dp*ic*isc*ip*
      parm: proto_bias:Favourite protocol number (int)

    • モジュールを手動で登録します。
    • # insmod usblp.ko
      # tail /var/log/syslog
      Oct 23 00:50:07 callisto kernel: usbcore: registered new interface driver usblp

    • 登録されたか調べます。
    • # lsmod
      Module Size Used by
      usblp 15392 0

    • iP7500 を接続します。
    • # tail /var/log/syslog
      Oct 23 00:55:51 callisto kernel: usb 1-2: new high speed USB device using ehci_hcd and address 2
      Oct 23 00:55:52 callisto kernel: usb 1-2: configuration #1 chosen from 1 choice
      Oct 23 00:55:52 callisto kernel: usblp0: USB Bidirectional printer dev 2 if 0 alt 0 proto 2 vid 0x04A9 pid 0x10A6

      # /bin/mknod /dev/usblp0 c 180 0
      # /bin/chown root:lp /dev/usblp0
      # /bin/chmod 660 /dev/usblp0

    • 再起動すると登録されたモジュールが消えてしまうので、起動時に'insmod usblp.ko'が実行されるようしなくてはいけません。今回は自動認識するように 'hotplug'をインストールします。
    • # aptitude install hotplug
      以下のパッケージが一時固定されています:
        tzdata
      以下の新規パッケージがインストールされます:
        hotplug
      以下のパッケージが推奨されていますがインストールされません:
        usbutils
      hotplug (0.0.20040329-26) を設定しています ...

      # tail /var/log/syslog
      Oct 23 01:21:21 callisto kernel: usb 1-2: new high speed USB device using ehci_hcd and address 3
      Oct 23 01:21:22 callisto kernel: usb 1-2: configuration #1 chosen from 1 choice
      Oct 23 01:21:24 callisto kernel: usblp0: USB Bidirectional printer dev 3 if 0 alt 0 proto 2 vid 0x04A9 pid 0x10A6
      Oct 23 01:21:24 callisto kernel: usbcore: registered new interface driver usblp
      Oct 23 01:21:24 callisto usb.agent[1517]: usblp: loaded successfully

  2. CUPS をインストールします。
    • CUPS サーバー(cupsys)とCUPSコマンド管理ツール(cupsys-client)をインストールします。
    • # # aptitude install cupsys

      以下の新規パッケージが自動的にインストールされます:
        cupsys-bsd cupsys-client cupsys-common dbus defoma file fontconfig-config
        foomatic-db foomatic-db-engine foomatic-filters gs-common gs-esp gsfonts
        libcupsimage2 libdbus-1-3 libexpat1 libfontconfig1 libfreetype6 libft-perl libice6
        libjpeg62 libmagic1 libpaper-utils libpaper1 libpng12-0 libpoppler0c2 libslp1
        libsm6 libtiff4 libttf2 libx11-6 libx11-data libxau6 libxdmcp6 libxext6 libxml2
        libxt6 netcat patch poppler-utils psfontmgr sgml-base ttf-dejavu x11-common
        xml-core
      以下のパッケージが一時固定されています:
        tzdata
      以下の新規パッケージがインストールされます:
        cupsys cupsys-bsd cupsys-client cupsys-common dbus defoma file fontconfig-config
        foomatic-db foomatic-db-engine foomatic-filters gs-common gs-esp gsfonts
        libcupsimage2 libdbus-1-3 libexpat1 libfontconfig1 libfreetype6 libft-perl libice6
        libjpeg62 libmagic1 libpaper-utils libpaper1 libpng12-0 libpoppler0c2 libslp1
        libsm6 libtiff4 libttf2 libx11-6 libx11-data libxau6 libxdmcp6 libxext6 libxml2
        libxt6 netcat patch poppler-utils psfontmgr sgml-base ttf-dejavu x11-common
        xml-core
      アップグレードに関する問題の主な可能性
      複数のユーザが、彼らの X サーバパッケージがもうインストールされていない現在のパッケージセットへのアップグレードについて報告しています。この問題に対する簡単な方法はないため、xserver-xorg パッケージがアップグレード後にインストールされているかどうかよく確認すべきです。もしこれがインストールされておらず、かつ必要なのであれば、完全に機能する X セットアップを保有していることを確認するために、xorg パッケージをインストールすることをお勧めします。
      システムのデフォルトとして利用する紙サイズを選択してください。 あなたのシステムのさまざまなプログラムが、 どのように印刷出力するかを決める際に、この設定の選択肢を使います。システムのデフォルトとする紙サイズはどれですか?

      A4
      To reduce network traffic use a IP multicast enabled kernel

      The kernel version that you are currently running does not appear to support IP multicast. OpenSLP will continue to work even without multicast support in the kernel by using broadcasts. However, broadcasts are less efficient on the network, so please consider upgrading to a multicast enabled kernel.
       このパッケージは BSD スタイルの印刷ジョブを受け付け、CUPS にそれを送るサーバを含んでいます。"BSD" または "LPR" サービス経由でネットワーク越しにジョブを送るほかのコンピュータがあり、かつそれらのコンピュータは CUPS の使っている IPP プロトコルを使うよう変更できない、という場合にのみセットアップすべきです。
      BSD lpd 互換サーバをセットアップしますか?

      いいえ
      To reduce network traffic use a IP multicast enabled kernel

      The kernel version that you are currently running does not appear to support IP multicast. OpenSLP will continue to work even without multicast support in the kernel by using broadcasts. However, broadcasts are less efficient on the network, so please consider upgrading to a multicast enabled kernel.
      Starting Common Unix Printing System: cupsd.

    • プリンタ定義ファイルパッケージ
    • # aptitude install foomatic-filters-ppds
      以下の新規パッケージが自動的にインストールされます:
        hpijs hpijs-ppds libsensors3 libsnmp-base libsnmp9 libsysfs2
      以下のパッケージが一時固定されています:
        tzdata
      以下の新規パッケージがインストールされます:
        foomatic-filters-ppds hpijs hpijs-ppds libsensors3 libsnmp-base libsnmp9 libsysfs2
      (中略)
      Forcing CUPS to reload available PPD list...
      Restarting Common Unix Printing System: cupsd.

      foomatic-filters-ppds (20061104-1) を設定しています ...
      Reloading Common Unix Printing System: cupsd.

    • アクセス許可設定をします。
    • # vi /etc/cups/cupsd.conf
      #
      #
      # Sample configuration file for the Common UNIX Printing System (CUPS)
      # scheduler. See "man cupsd.conf" for a complete description of this
      # file.
      #

      # Only listen for connections from the local machine.
      Listen localhost:631
      Listen /var/run/cups/cups.sock

      # Restrict access to the server...

        Order allow,deny
        Allow localhost
        Allow 192.168.1.0/24


      # Restrict access to the admin pages...

        Encryption Required
        Order allow,deny
        Allow localhost
        Allow 192.168.1.1


      # Restrict access to configuration files...

        AuthType Basic
        Require user @SYSTEM
        Order allow,deny
        Allow localhost
        Allow 192.168.1.1


      ServerCertificate /etc/cups/ssl/server.crt
      ServerKey /etc/cups/ssl/server.key

    • 'server.key' と 'server.crt' を生成します。
    • # openssl req -new -x509 -keyout /etc/cups/ssl/server.key -out /etc/cups/ssl/server.crt -days 365 -nodes
      Generating a 1024 bit RSA private key
      ........++++++
      ........................++++++
      writing new private key to '/etc/cups/ssl/server.key'
      -----
      You are about to be asked to enter information that will be incorporated
      into your certificate request.
      What you are about to enter is what is called a Distinguished Name or a DN.
      There are quite a few fields but you can leave some blank
      For some fields there will be a default value,
      If you enter '.', the field will be left blank.
      -----
      Country Name (2 letter code) [AU]:JP
      State or Province Name (full name) [Some-State]:KURO-BOX
      Locality Name (eg, city) []:KURO-BOX
      Organization Name (eg, company) [Internet Widgits Pty Ltd]:KURO-BOX
      Organizational Unit Name (eg, section) []:KURO-BOX
      Common Name (eg, YOUR name) []:KURO-BOX
      Email Address []:kuro-box@example.com

      # /etc/init.d/cupsys restart
      Restarting Common Unix Printing System: cupsd.

  3. CUPS で iP7500 をセットアップ。
    • ブラウザで"https://[玄箱のホスト名またはIPアドレス]:631/"にアクセス。
    • 「管理」タブをクリック。
    • 「プリンタの追加」ボタンをクリック。
    • Canon_iP7500_USB_1

      説明: Canon iP7500

      場所: Local Printer

      メーカとモデル: Canon BJC-7100 Foomatic/bjc800 (recommended)

      プリンタの状態: 待機中,
      ジョブを受け付け中, 公開。

      デバイス URI: usb://Canon/iP7500
    • 「テストページの印刷」ボタンをクリック。

  4. ネットワークプリンタを設定。
    • Mac OS X 10.5.5の場合
      • キヤノンのサイトから Mac OS X用ドライバをダウンロードしてインストールします。

      • ターミナルを起動して、pdd ファイルをユーザーディレクトリにコピーします。
      • # cp /etc/cups/ppd/Canon_iP7500.ppd /Users/[ユーザー名]/documents/

      • システム環境設定のプリントとファックスでプリンタの追加(+)をクリックします。
      • 以下の設定を入力します。
        プロトコル: IPP(Internet Printing Protocol
        アドレス : 192.168.0.1
        キュー  : /printers/Canon_iP7500_USB_1
        ドライバ :その他を選択して、"Canon_iP7500.ppd"を指定します。
        以上、設定したのですが、"access_log"上にエラーが出て印刷できませんでした。
        "POST /printers/Canon_iP7500_USB_1 HTTP/1.1" 200 219 Print-Job client-error-bad-request

        最初から入っている"Canon BJC-7100 - Gutenprint v5.1.3"だと印刷できるのですが。調査中です。

    • Windows XP/Vistaの場合
      • キヤノンのサイトから Windows用ドライバをダウンロードしてインストールします。
      • コントロールパネルのプリンタでプリンタの追加をクリックします。
      • ネットワーク、ワイヤレスまたはBluetoothプリンタを追加します(W)を選択。
      • 「探しているプリンタはこの一覧にはありません(R)」を選択。
      • 「共有プリンタを名前で選択する(S)」を選択して、「http://192.168.0.1:631/printers/Canon_iP7500_USB_1」を入力。
      • 「プリンタ追加ウィザード」が表示されたら、「ディスク使用(H)...」をクリックして、"C:\Program Files\CanonBJ\IJPrinter\Canon iP7500\iP7500.inf"を選択。
      • そのまま「OK」を押す。そして、「次へ」、「完了(F)」をクリックする。