第三世代 LinkStation ハックキットでプリンタサーバ

Debian HS-DHGL

次は、 第三世代 LinkStation ハックキット をインストールした新型 HS-DHGL をプリンタサーバにする。

スプーラのインストール

相変わらず、cups ではなく lprng 。
Debian には何でもある。

lprng のインストール

slam:~# apt-get install lprng
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
  magicfilter lprng-doc
The following NEW packages will be installed:
  lprng
0 upgraded, 1 newly installed, 0 to remove and 15 not upgraded.
Need to get 1240kB of archives.
After this operation, 2851kB of additional disk space will be used.
Get:1 http://ftp.jp.debian.org lenny/main lprng 3.8.A-1.1 [1240kB]
Fetched 1240kB in 1s (675kB/s)
Preconfiguring packages ...
Selecting previously deselected package lprng.
(Reading database ... 11365 files and directories currently installed.)
Unpacking lprng (from .../lprng_3.8.A-1.1_armel.deb) ...
Processing triggers for man-db ...
Setting up lprng (3.8.A-1.1) ...
slam:~#

printcap の作成

旧形 HS-DHGL からコピーしてくる。
slam:~# cd /tmp
slam:/tmp# ftp sil.yamasita.jp
Connected to sil.yamasita.jp.
220 sil FTP server (GNU inetutils 1.5) ready.
Name (sil.yamasita.jp:yasunari):
331 Password required for yasunari.
Password:
230- Linux sil 2.6.16.16-arm1 #6 Fri Aug 31 13:07:15 JST 2007 armv5tejl
230-
230- The programs included with the Debian GNU/Linux system are free software;
230- the exact distribution terms for each program are described in the
230- individual files in /usr/share/doc/*/copyright.
230-
230- Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
230- permitted by applicable law.
230 User yasunari logged in.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> cd /etc
250 CWD command successful.
ftp> get printcap
local: printcap remote: printcap
200 PORT command sucessful.
150 Opening BINARY mode data connection for 'printcap' (354 bytes).
226 Transfer complete.
354 bytes received in 0.00 secs (587.9 kB/s)
ftp> bye
221 Goodbye.
slam:/tmp# cat printcap
# /etc/printcap
#
# Please don't edit this file directly unless you know what you are doing!
# Be warned that the control-panel printtool requires a very strict format!
# Look at the printcap(5) man page for more info.
#
# This file can be edited with the printtool in the control-panel.

lp:\
        :sd=/var/spool/lpd/lp:\
        :mx#0:\
        :sh:\
        :lp=/dev/usb/lp0:
slam:/tmp# mv printcap /etc
slam:/tmp#

/dev/usb/lp0 のオーナ、モードの修正

と思ったら、
slam:/tmp# ls -l /dev/usb/lp0
ls: cannot access /dev/usb/lp0: No such file or directory
slam:/tmp#
デバイスファイルはどれだ??
slam:/tmp# ls -l /dev/u*
crw-rw-rw- 1 root root 1, 9 Jun 25 20:26 /dev/urandom
slam:/tmp# ls -l /dev/lp*
crw-rw---- 1 root lp 6, 0 Nov 21  2008 /dev/lp0
crw-rw---- 1 root lp 6, 1 Nov 21  2008 /dev/lp1
crw-rw---- 1 root lp 6, 2 Nov 21  2008 /dev/lp2
slam:/tmp#
/dev/lp0 でいいのかなぁ。。。

標準ファームを見る。

slam:/tmp# ls -l /usr/local/buffalo/dev/usb/
total 0
drwxr-xr-x 2 root root       34 Jul  3  2006 hid
crwxr-xr-x 1 root root 180,   0 Dec  8  2006 lp0
crwxr-xr-x 1 root root 180,   1 Dec  8  2006 lp1
crwxr-xr-x 1 root root 180,   2 Dec  8  2006 lp2
crwxr-xr-x 1 root root 180, 192 Oct  1  2008 mv7dxu2_0
crwxr-xr-x 1 root root 180, 208 Oct  1  2008 mv7dxu2_1
crwxr-xr-x 1 root root 180, 224 Oct  1  2008 mv7dxu2_2
crwxr-xr-x 1 root root 180, 240 Oct  1  2008 mv7dxu2_3
drwxr-xr-x 2 root root        6 Oct 10  2001 tts
slam:/tmp#
やっぱり違う。
作る。
slam:/tmp# mkdir /dev/usb
slam:/tmp# mknod --help
Usage: mknod [OPTION]... NAME TYPE [MAJOR MINOR]
Create the special file NAME of the given TYPE.

  -Z, --context=CTX  set the SELinux security context of NAME to CTX
Mandatory arguments to long options are mandatory for short options too.
  -m, --mode=MODE   set file permission bits to MODE, not a=rw - umask
      --help     display this help and exit
      --version  output version information and exit

Both MAJOR and MINOR must be specified when TYPE is b, c, or u, and they
must be omitted when TYPE is p.  If MAJOR or MINOR begins with 0x or 0X,
it is interpreted as hexadecimal; otherwise, if it begins with 0, as octal;
otherwise, as decimal.  TYPE may be:

  b      create a block (buffered) special file
  c, u   create a character (unbuffered) special file
  p      create a FIFO

Report bugs to .
slam:/tmp# mknod /dev/usb/lp0 c 180 0
slam:/tmp# ls -l /dev/usb/
total 0
crw-r--r-- 1 root root 180, 0 Jun 25 21:30 lp0
slam:/tmp# 
オーナ、モードの修正。
slam:/tmp# chgrp lp /dev/usb/lp0
slam:/tmp# chmod 666 /dev/usb/lp0
slam:/tmp# !ls
ls -l /dev/usb/
total 0
crw-rw-rw- 1 root lp 180, 0 Jun 25 21:30 lp0
slam:/tmp#

lprng の開始

slam:/tmp# /etc/init.d/lprng start
Starting LPRng printer spooler: lpd.
slam:/tmp#

samba の設定

smb.conf の修正

slam:/tmp# cd /etc/samba/
slam:/etc/samba# mv smb.conf{,.orig}
slam:/etc/samba# cp smb.conf{.orig,}
slam:/etc/samba# vi smb.conf
	:
	:
slam:/etc/samba# diff -c smb.conf.orig smb.conf
*** smb.conf.orig       Fri Feb 27 21:59:34 2009
--- smb.conf    Thu Jun 25 21:37:38 2009
***************
*** 179,186 ****

  # lpr(ng) printing. You may wish to override the location of the
  # printcap file
! ;   printing = bsd
! ;   printcap name = /etc/printcap

  # CUPS printing.  See also the cupsaddsmb(8) manpage in the
  # cupsys-client package.
--- 179,186 ----

  # lpr(ng) printing. You may wish to override the location of the
  # printcap file
!    printing = bsd
!    printcap name = /etc/printcap

  # CUPS printing.  See also the cupsaddsmb(8) manpage in the
  # cupsys-client package.
***************
*** 286,291 ****
--- 286,292 ----
     guest ok = no
     read only = yes
     create mask = 0700
+    use client driver = yes

  # Windows clients look for this share name as a source of downloadable
  # printer drivers
slam:/etc/samba#

smb.conf の再読込み

修正した smb.conf を samba に読込ませる。
slam:/etc/samba# /etc/init.d/samba reload
Reloading /etc/samba/smb.conf: smbd only.
slam:/etc/samba#

動作確認

プリンタの接続

slam:/etc/samba# tail -f /var/log/messages
	:
	:
Jun 25 21:43:54 slam kernel: usb 2-1: new full speed USB device using ehci_platform and address 4
Jun 25 21:43:54 slam kernel: usb 2-1: configuration #1 chosen from 1 choice
Jun 25 21:43:54 slam kernel: drivers/usb/class/usblp.c: usblp0: USB Bidirectional printer dev 4 if 0 alt 0 proto 2 vid 0x04B8 pid 0x0005
Jun 25 21:44:08 slam kernel: >mv_set_rtc: 1245933848

プリンタのセットアップ

Windows マシン側で設定

テスト印字

Windows から「テスト印字」を実行。
問題なく印刷されることを確認。

うちのプリンタ故障してて、印刷とは関係ない線がいっぱい印刷される。
まるで まるこちゃんの「(藁)」状態なんだが、、、それはさておき。。。。

完了




HS-DHGL
バッファローダイレクト
楽天市場
Yahoo!ショッピング
ValuMore!
ムラウチドットコム


第三世代 LinkStation ハックキットでリモコン制御(4)
ハックの記録
LinkStation/玄箱 をハックしよう

Re: 第三世代 LinkStation ハックキットでハック de 録!!(6) 延長対応ハック de ダブルまる録!! 外部チューナコントロールつきのセットアップ

Copyright (C) 2003-2009 Yasunari Yamashita. All Rights Reserved.
yasunari @ yamasita.jp 山下康成@京都府向日市