標準ファーム Ver.1.04 でハックキット(6)Windows 向けプリンタサーバ

LS-HGL

標準ファーム 1.04 の LS-HGL に、 LS-HGL ハックキットをインストールする。

次は LS-GL/HS-DHGL ハックキット Windows 向けプリンタサーバ(HS-DHGL のみ)に準じて LS-HGL に Windows 向けプリンタサーバを構築する。

カーネルモジュールのロード

LS-HGL ハックキットでは、/etc/init.d/usb で既にロードしている。
hackkit:~# cat /etc/init.d/usb
#!/bin/sh

case "$1" in
  start)
        echo on > /proc/buffalo/usb_control
        chroot /usr/local/buffalo insmod /lib/modules/2.6.16.16-arm1/kernel/drivers/usb/core/usbcore.ko
        chroot /usr/local/buffalo insmod /lib/modules/usblp.ko
		:
		:
        ;;
  stop)
		:
		:
        chroot /usr/local/buffalo rmmod usblp.ko
        chroot /usr/local/buffalo rmmod usbcore.ko
        echo off > /proc/buffalo/usb_control
        ;;
  *)
        echo "Usage: $0 {start|stop}"
        exit 1
esac

exit 0
hackkit:~#
認識の確認のみ。
hackkit:~# tail -f /var/log/messages
	:
	:
Aug 16 11:42:59 hackkit kernel: usb 1-1: new full speed USB device using ehci_platform and address 2
Aug 16 11:42:59 hackkit kernel: usb 1-1: configuration #1 chosen from 1 choice
Aug 16 11:42:59 hackkit kernel: drivers/usb/class/usblp.c: usblp0: USB Bidirectional printer dev 2 if 0 alt 0 proto 2 vid 0x04B8 pid 0x0005

スプーラのインストール

lprng のインストール

hackkit:~# apt-get install lprng
Reading package lists... Done
Building dependency tree... Done
Suggested packages:
  magicfilter lprng-doc
The following NEW packages will be installed:
  lprng
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 1891kB of archives.
After unpacking 4047kB of additional disk space will be used.
Get:1 http://ftp2.jp.debian.org etch/main lprng 3.8.28dfsg.1-1.1 [1891kB]
Fetched 1891kB in 3s (579kB/s)
Preconfiguring packages ...

Package configuration


 lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqu Configuring lprng tqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk
 x                                                                                                 x
 x Some people for various reasons do not want to start lpd. Refusing this option means lpd will   x
 x not start.  Unless you know why you want lpd not to start, just accept the default.             x
 x                                                                                                 x
 x Start lpd (Printer Daemon) at boot?                                                             x
 x                                                                                                 x
 x                                                                                        x
 x                                                                                                 x
 mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj

Selecting previously deselected package lprng.
(Reading database ... 11864 files and directories currently installed.)
Unpacking lprng (from .../lprng_3.8.28dfsg.1-1.1_arm.deb) ...
preinst called with unknown argument `'
Setting up lprng (3.8.28dfsg.1-1.1) ...

hackkit:~#

printcap の作成

hackkit:~# cat /etc/printcap
cat: /etc/printcap: No such file or directory
hackkit:~# cat > !$
cat > /etc/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:
hackkit:~# cat /etc/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:
hackkit:~#

オーナ、モードの修正

hackkit:~# ls -ld /dev/usb/lp0
crw-rw---- 1 root root 180, 0 Mar  2  2005 /dev/usb/lp0
hackkit:~# chgrp lp /dev/usb/lp0
hackkit:~# chmod 666 /dev/usb/lp0
hackkit:~# ls -ld /dev/usb/lp0
crw-rw-rw- 1 root lp 180, 0 Mar  2  2005 /dev/usb/lp0
hackkit:~#

samba の設定

smb.conf の修正

hackkit:~# cd /etc/samba/
hackkit:/etc/samba# mv smb.conf smb.conf_notprint
hackkit:/etc/samba# cp smb.conf_notprint smb.conf
hackkit:/etc/samba# ls -l smb.conf smb.conf_notprint
-rw-r--r-- 1 root root 10642 Aug 16 11:55 smb.conf
-rw-r--r-- 1 root root 10642 Aug 16 11:23 smb.conf_notprint
hackkit:/etc/samba# vi smb.conf
	:
	:
hackkit:/etc/samba# diff -c smb.conf_notprint smb.conf
*** smb.conf_notprint   Sat Aug 16 11:23:42 2008
--- smb.conf    Sat Aug 16 11:57:10 2008
***************
*** 161,168 ****

  # 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.
--- 161,168 ----

  # 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.
***************
*** 267,272 ****
--- 267,273 ----
     public = no
     writable = no
     create mode = 0700
+    use client driver = yes

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

smb.conf の再読込み

hackkit:/etc/samba# /etc/init.d/samba reload
Reloading /etc/samba/smb.conf: smbd only.
hackkit:/etc/samba#

確認

\\hackkit\lp に対して印刷したが、、、出てこない。
hackkit:/etc/samba# lpq
Printer 'lp@localhost' - cannot open connection - No such file or directory
Make sure the remote host supports the LPD protocol
hackkit:/etc/samba# 
ん?lpd が動いていない?
hackkit:/etc/samba# /etc/init.d/lprng start
Starting LPRNG printer spooler: lpd.
hackkit:/etc/samba# lpq
Printer: lp@hackkit
 Queue: 1 printable job
 Server: no server active
 Rank   Owner/ID               Pr/Class Job Files                 Size Time
1      yasunari@hackkit+220         A   220 smbprn.00000001.h3f 499185 12:01:02
hackkit:/etc/samba# 
プリンタがかちゃかちゃ言って、テスト印字された。
/dev/usb/lp0 のオーナ、モードを修正した後で起動が正しい手順か。

LS-H250GL
楽天市場
livedoor デパート
Sofmap
TSUKUMO ネットショップ
TWO TOP
Yahoo!ショッピング
パソQ
ムラウチドットコム
ヤマダ電機WEB
アット・ニフティストア icon
Joshin インターネットショッピング icon


標準ファーム Ver.1.04 でハックキット(5)Windows 向けファイルサーバ
ハックの記録
LinkStation/玄箱 をハックしよう

Software Design 2008/9月号

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