Difference between revisions of "USB printer on LS Pro V2 with 1.15 firmware"

From NAS-Central Buffalo - The Linkstation Wiki
Jump to: navigation, search
Line 62: Line 62:
  
 
Then one needs to replace the kernel by copying the new kernel to /boot, moving the original kernel out of the way, and symlinking uImage.buffalo to the new kernel:
 
Then one needs to replace the kernel by copying the new kernel to /boot, moving the original kernel out of the way, and symlinking uImage.buffalo to the new kernel:
[pre]root@LS-GLE1D:/mnt/disk1/operator/kernel1# cp boot/uImage-2.6.16.57-lsp_eabi-dh_v4 /boot/
+
<pre>root@LS-GLE1D:/mnt/disk1/operator/kernel1# cp boot/uImage-2.6.16.57-lsp_eabi-dh_v4 /boot/
 
root@LS-GLE1D:/mnt/disk1/operator/kernel1# cd /boot
 
root@LS-GLE1D:/mnt/disk1/operator/kernel1# cd /boot
 
root@LS-GLE1D:/boot# mv uImage.buffalo uImage.buffalo.fw115
 
root@LS-GLE1D:/boot# mv uImage.buffalo uImage.buffalo.fw115
 
root@LS-GLE1D:/boot# ln -s uImage-2.6.16.57-lsp_eabi-dh_v4 uImage.buffalo
 
root@LS-GLE1D:/boot# ln -s uImage-2.6.16.57-lsp_eabi-dh_v4 uImage.buffalo
[/pre]
+
</pre>
 
Double check to make you did not mistype something, otherwise the new kernel will not be found at boot time, and the machine cannot boot.
 
Double check to make you did not mistype something, otherwise the new kernel will not be found at boot time, and the machine cannot boot.
  
Line 72: Line 72:
  
 
Finally one needs to also copy over the modules
 
Finally one needs to also copy over the modules
[code]root@LS-GLE1D:/boot# cd /mnt/disk1/operator/kernel1
+
<pre>root@LS-GLE1D:/boot# cd /mnt/disk1/operator/kernel1
 
root@LS-GLE1D:/mnt/disk1/operator/kernel1# cp -pr lib/ /
 
root@LS-GLE1D:/mnt/disk1/operator/kernel1# cp -pr lib/ /
[/code]
+
</pre>
  
 
The -p flag is for preserving permission (and dates) based on the assumptions that the permissions were done correctly in the download package. (The -r flag stands for recursive and is necessary in order to copy whole directories).
 
The -p flag is for preserving permission (and dates) based on the assumptions that the permissions were done correctly in the download package. (The -r flag stands for recursive and is necessary in order to copy whole directories).
Line 87: Line 87:
  
 
Now you have a usb printing enabled kernel. To actually enable usb printing one must load the usblp kernel module with modprobe:
 
Now you have a usb printing enabled kernel. To actually enable usb printing one must load the usblp kernel module with modprobe:
[code]
+
<pre>
 
root@LS-GLE1D:~# modprobe usblp
 
root@LS-GLE1D:~# modprobe usblp
[/code]
+
</pre>
 
Check that it loaded with lsmod:
 
Check that it loaded with lsmod:
[code]root@LS-GLE1D:~# lsmod
+
<pre>root@LS-GLE1D:~# lsmod
 
Module                  Size  Used by
 
Module                  Size  Used by
 
*usblp                  12160  0
 
*usblp                  12160  0
Line 97: Line 97:
 
psnap                  3268  1 appletalk
 
psnap                  3268  1 appletalk
 
llc                    6132  1 psnap
 
llc                    6132  1 psnap
[/code]
+
</pre>
 
(* added for emphasis)
 
(* added for emphasis)
  
Line 103: Line 103:
  
 
Test by:
 
Test by:
[code]root@LS-GLE1D:~# cat /dev/usb/lp0
+
<pre>root@LS-GLE1D:~# cat /dev/usb/lp0
 
cat: /dev/usb/lp0: No such device
 
cat: /dev/usb/lp0: No such device
[/code]
+
</pre>
 
If this error message appears you do not have the device and you cannot print. Either there is no usb printer connected or the module is not loaded. Instead, there should be no error message. For me the command clears the screen because the printer sends some control character.
 
If this error message appears you do not have the device and you cannot print. Either there is no usb printer connected or the module is not loaded. Instead, there should be no error message. For me the command clears the screen because the printer sends some control character.
  
 
Now you could start sending data to printer directly. Eg. you could print to a file with the windows printer driver, move the file to the LS, and cat it to the device to check if it does something, possibly print.
 
Now you could start sending data to printer directly. Eg. you could print to a file with the windows printer driver, move the file to the LS, and cat it to the device to check if it does something, possibly print.
[code]root@LS-GLE1D:~# cat printed.prn > /dev/usb/lp0
+
<pre>root@LS-GLE1D:~# cat printed.prn > /dev/usb/lp0
[/code]
+
</pre>
 
(I sent a wrong file to the printer and it started to spit out empty pages ..)
 
(I sent a wrong file to the printer and it started to spit out empty pages ..)
  
Line 123: Line 123:
 
Put it on the LS, say on /mnt/disk1/operator and unpack it.
 
Put it on the LS, say on /mnt/disk1/operator and unpack it.
  
[code]root@LS-GLE1D:/mnt/disk1/operator# mkdir lprng-withweb
+
<pre>root@LS-GLE1D:/mnt/disk1/operator# mkdir lprng-withweb
 
root@LS-GLE1D:/mnt/disk1/operator# mv lprng-withweb_2.04.tgz.gz lprng-withweb/
 
root@LS-GLE1D:/mnt/disk1/operator# mv lprng-withweb_2.04.tgz.gz lprng-withweb/
 
root@LS-GLE1D:/mnt/disk1/operator# cd lprng-withweb/
 
root@LS-GLE1D:/mnt/disk1/operator# cd lprng-withweb/
 
root@LS-GLE1D:/mnt/disk1/operator/lprng-withweb# tar xzvf lprng-withweb_2.04.tgz.gz
 
root@LS-GLE1D:/mnt/disk1/operator/lprng-withweb# tar xzvf lprng-withweb_2.04.tgz.gz
[/code]
+
</pre>
  
 
The instructions on  
 
The instructions on  
Line 137: Line 137:
 
a) install binaries by copying them over to standard directories.  
 
a) install binaries by copying them over to standard directories.  
  
[code]root@LS-GLE1D:/mnt/disk1/operator/lprng-withweb# cp -ipr usr /
+
<pre>root@LS-GLE1D:/mnt/disk1/operator/lprng-withweb# cp -ipr usr /
[/code]
+
</pre>
  
 
The usr directories have all the executables and libraries and we can just copy them over. The -i flag makes sure we do not accidentally overwrite system files., and -p preserves permission (and symlinks).
 
The usr directories have all the executables and libraries and we can just copy them over. The -i flag makes sure we do not accidentally overwrite system files., and -p preserves permission (and symlinks).
Line 146: Line 146:
 
I did not want to overwrite the default samba init script smb.sh, so let's rename first the provided smb.sh and then copy.
 
I did not want to overwrite the default samba init script smb.sh, so let's rename first the provided smb.sh and then copy.
  
[code]root@LS-GLE1D:/mnt/disk1/operator/lprng-withweb# mv etc/init.d/smb.sh etc/init.d/smb.sh.lprng
+
<pre>root@LS-GLE1D:/mnt/disk1/operator/lprng-withweb# mv etc/init.d/smb.sh etc/init.d/smb.sh.lprng
 
root@LS-GLE1D:/mnt/disk1/operator/lprng-withweb# cp -ipr etc /
 
root@LS-GLE1D:/mnt/disk1/operator/lprng-withweb# cp -ipr etc /
[/code]
+
</pre>
  
 
Again, we do not need a modified smb.sh but let's have the provided one there in case we want it later.
 
Again, we do not need a modified smb.sh but let's have the provided one there in case we want it later.
Line 158: Line 158:
 
We could use the included lprng-enable.sh script to set up directories but let's do it step by step. The script first sets up the device directory but it should be already there by default:
 
We could use the included lprng-enable.sh script to set up directories but let's do it step by step. The script first sets up the device directory but it should be already there by default:
  
[code]root@LS-GLE1D:/mnt/disk1/operator/lprng-withweb# ls -la /dev/usb/lp*
+
<pre>root@LS-GLE1D:/mnt/disk1/operator/lprng-withweb# ls -la /dev/usb/lp*
 
crwxrwxrwx    1 root    root    180,  0 Dec  8  2006 /dev/usb/lp0
 
crwxrwxrwx    1 root    root    180,  0 Dec  8  2006 /dev/usb/lp0
 
crwxrwxrwx    1 root    root    180,  1 Dec  8  2006 /dev/usb/lp1
 
crwxrwxrwx    1 root    root    180,  1 Dec  8  2006 /dev/usb/lp1
 
crwxrwxrwx    1 root    root    180,  2 Dec  8  2006 /dev/usb/lp2
 
crwxrwxrwx    1 root    root    180,  2 Dec  8  2006 /dev/usb/lp2
[/code]
+
</pre>
  
 
Then the scripts creates spool directories for lpd, so let's do that:
 
Then the scripts creates spool directories for lpd, so let's do that:
[code]root@LS-GLE1D:/mnt/disk1/operator/lprng-withweb# mkdir /var/spool/win /var/spool/tmp /var/spool/samba
+
<pre>root@LS-GLE1D:/mnt/disk1/operator/lprng-withweb# mkdir /var/spool/win /var/spool/tmp /var/spool/samba
[/code]
+
</pre>
  
 
/var/spool/tmp and /var/spool/samba are for samba printing which we will not use but let's create the directories anyways for future use.
 
/var/spool/tmp and /var/spool/samba are for samba printing which we will not use but let's create the directories anyways for future use.
  
 
Then the script opens up wide the spool directories and /dev/null, so let's do that, too:
 
Then the script opens up wide the spool directories and /dev/null, so let's do that, too:
[code]root@LS-GLE1D:/mnt/disk1/operator/lprng-withweb# chmod 777 /var/spool/* /dev/null[/code]
+
<pre>root@LS-GLE1D:/mnt/disk1/operator/lprng-withweb# chmod 777 /var/spool/* /dev/null</pre>
  
 
I am not sure if that is necessary and checkpc does complain:
 
I am not sure if that is necessary and checkpc does complain:
[code]root@LS-GLE1D:/mnt/disk1/operator/lprng-withweb# checkpc
+
<pre>root@LS-GLE1D:/mnt/disk1/operator/lprng-withweb# checkpc
 
Warning - owner/group of '/var/spool/win' are 0/0, not 2/2
 
Warning - owner/group of '/var/spool/win' are 0/0, not 2/2
 
Warning - permissions of '/var/spool/win' are 0777, not 0700
 
Warning - permissions of '/var/spool/win' are 0777, not 0700
 
Warning - lp-ps: CATASTROPHIC ERROR! queue 'lp' also has spool directory '/var/spool/win'
 
Warning - lp-ps: CATASTROPHIC ERROR! queue 'lp' also has spool directory '/var/spool/win'
[/code]
+
</pre>
  
 
This also shows that the included printcap file is not valid. It will still work but one should remove the second queue (lp-ps) or point it to another spool directory.
 
This also shows that the included printcap file is not valid. It will still work but one should remove the second queue (lp-ps) or point it to another spool directory.
Line 189: Line 189:
  
 
Before:
 
Before:
[code]       #Let's check about melco
+
<pre>       #Let's check about melco
 
         if [ $printer = off ] ; then
 
         if [ $printer = off ] ; then
 
             /usr/bin/logger -t ${tag} -p ${facility} 'Not started lpd'
 
             /usr/bin/logger -t ${tag} -p ${facility} 'Not started lpd'
Line 197: Line 197:
 
         # Start daemons.
 
         # Start daemons.
 
         echo -n "Starting lpd: "
 
         echo -n "Starting lpd: "
[/code]
+
</pre>
  
 
After:
 
After:
[code]       #Let's check about melco
+
<pre>       #Let's check about melco
 
         if [ $printer = off ] ; then
 
         if [ $printer = off ] ; then
 
             /usr/bin/logger -t ${tag} -p ${facility} 'Not started lpd'
 
             /usr/bin/logger -t ${tag} -p ${facility} 'Not started lpd'
Line 209: Line 209:
 
         # Start daemons.
 
         # Start daemons.
 
         echo -n "Starting lpd: "
 
         echo -n "Starting lpd: "
[/code]
+
</pre>
  
 
Use vi to edit. (In vi use the arrow keys to navigate, press "i" to insert text or delete text with backspace, press "ESC" to get out of edit mode, and press ":wq" to write the file and quit.)
 
Use vi to edit. (In vi use the arrow keys to navigate, press "i" to insert text or delete text with backspace, press "ESC" to get out of edit mode, and press ":wq" to write the file and quit.)
Line 218: Line 218:
  
 
Before:
 
Before:
[code]echo "** step3 **"
+
<pre>echo "** step3 **"
 
for cmd in recover_shareinfo.sh micon_setup.sh atalk.sh ftpd.sh httpd.sh smb.sh clientUtil_servd.sh lsprcvd.sh daemonwatch.sh cron.sh logchkd.sh checkconfig.sh init_sem.sh sshd.sh
 
for cmd in recover_shareinfo.sh micon_setup.sh atalk.sh ftpd.sh httpd.sh smb.sh clientUtil_servd.sh lsprcvd.sh daemonwatch.sh cron.sh logchkd.sh checkconfig.sh init_sem.sh sshd.sh
 
do
 
do
[/code]
+
</pre>
  
 
After:
 
After:
[code]echo "** step3 **"
+
<pre>echo "** step3 **"
 
for cmd in recover_shareinfo.sh micon_setup.sh atalk.sh ftpd.sh httpd.sh smb.sh clientUtil_servd.sh lsprcvd.sh daemonwatch.sh cron.sh logchkd.sh checkconfig.sh init_sem.sh sshd.sh lprng.sh
 
for cmd in recover_shareinfo.sh micon_setup.sh atalk.sh ftpd.sh httpd.sh smb.sh clientUtil_servd.sh lsprcvd.sh daemonwatch.sh cron.sh logchkd.sh checkconfig.sh init_sem.sh sshd.sh lprng.sh
 
do
 
do
[/code]
+
</pre>
  
 
e) edit configs
 
e) edit configs
Line 234: Line 234:
  
 
Before:
 
Before:
[code]root@LS-GLE1D:~# more /etc/melco/printer
+
<pre>root@LS-GLE1D:~# more /etc/melco/printer
 
printer=off
 
printer=off
 
printername=lp
 
printername=lp
[/code]
+
</pre>
  
 
After:
 
After:
[code]root@LS-GLE1D:~# more /etc/melco/printer
+
<pre>root@LS-GLE1D:~# more /etc/melco/printer
 
printer=on
 
printer=on
 
printername=lp
 
printername=lp
[/code]
+
</pre>
  
 
In my case I cannot see a situation where I would want printer=off.
 
In my case I cannot see a situation where I would want printer=off.
Line 250: Line 250:
  
 
Before:
 
Before:
[code] # Purpose: keep the last NN done jobs for status purposes
+
<pre> # Purpose: keep the last NN done jobs for status purposes
 
#  default done_jobs= 1  (INTEGER)
 
#  default done_jobs= 1  (INTEGER)
 
# Purpose: keep done jobs for at most max age seconds
 
# Purpose: keep done jobs for at most max age seconds
 
#  default done_jobs_max_age= 0  (INTEGER)
 
#  default done_jobs_max_age= 0  (INTEGER)
[/code]
+
</pre>
  
 
After:
 
After:
[code] # Purpose: keep the last NN done jobs for status purposes
+
<pre> # Purpose: keep the last NN done jobs for status purposes
 
#  default done_jobs= 1  (INTEGER)
 
#  default done_jobs= 1  (INTEGER)
 
# AP: repeat to make sure it is set
 
# AP: repeat to make sure it is set
Line 265: Line 265:
 
#AP: to make sure that things get removed
 
#AP: to make sure that things get removed
 
done_jobs_max_age= 7200
 
done_jobs_max_age= 7200
[/code]
+
</pre>
  
 
The lpd.conf edits are optional and there many more settings which might be useful.
 
The lpd.conf edits are optional and there many more settings which might be useful.
Line 272: Line 272:
  
 
After installation we can now start lpd:
 
After installation we can now start lpd:
[code]root@LS-GLE1D:~# /etc/init.d/lprng.sh start
+
<pre>root@LS-GLE1D:~# /etc/init.d/lprng.sh start
 
Starting lpd:
 
Starting lpd:
[/code]
+
</pre>
  
 
check with ps if lpd is running:
 
check with ps if lpd is running:
[code]root@LS-GLE1D:~# ps
+
<pre>root@LS-GLE1D:~# ps
 
...
 
...
 
15592 daemon      444 S  lpd Waiting
 
15592 daemon      444 S  lpd Waiting
 
...
 
...
[/code]
+
</pre>
  
 
9) set up windows printers (clients): XP: print service for UNIX; Vista: LPR and LPD options
 
9) set up windows printers (clients): XP: print service for UNIX; Vista: LPR and LPD options

Revision as of 14:11, 15 June 2009

Step by Step:

I tried to explain each step so these instruction became pretty long. The actual setup actually does not take very long.

1) update linkstation to stock 1.15 firmware from Buffalo:

http://www.buffalo-technology.com/support/downloads/

direct link:

http://www.buffalo-technology.com/support/getfile/?ls-gl_1.15.zip

Use Buffalo instructions to update. I did not have problem using my wireless connections, recommended is a wired connection.

The firmware adds timers to the web interface (sleep at night), and is maybe faster (?). Probably a good idea anyways to update to the latest product firmware.

2) use acp_commander to reset root password

Follow instructions here:

http://buffalo.nas-central.org/wiki/Open_Stock_Firmware

use firmware 1.11-1a instructions.

The instructions are very detailed and therefore long. The process itself is quick and fun because you gain a lot of power.

I installed the addons with acp_commander. The included wget does not work for me on the LS. Not a problem, since I use my laptop to download anyways. Then just move files to the LS samba share "share" which is /mnt/disk1/share on the LS. I actually made a new directory /mnt/disk1/operator as a place to put files (It was then picked up automatically by samba or some daemon and made available as a share via samba).

3) telnet in and enable sshd:

actually part of instructions above. I use the much recommended putty as a telnet and ssh client:

http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html

Reboot to make sure that ssh and/or telnet works.

4) replace stock kernel with 2.6.16.57 kernel to get usb printing

This is more exciting since now you are about to leave the coziness of the company approved environment somewhat. The kernel available at

ftp://ftp.dmik.org/pub/common/buffalo/lspro/duncan_h/kernel-2.6.16.57-lsp_eabi-dh_v4.tar.gz

is still compiled from the Buffalo LS kernel sources, so is still a 2.6.16 kernel. It has a lot more functionality enabled including a lot of kernel modules such as usblp.ko and enabled usb printing. The thread at

http://forum.buffalo.nas-central.org/viewtopic.php?t=4329

discusses recompilation efforts,

http://forum.buffalo.nas-central.org/viewtopic.php?f=18&t=4329&start=261

is where this recommended kernel appears in the discussion.

http://forum.buffalo.nas-central.org/viewtopic.php?f=18&t=5736

discusses it among other kernels as well, specifically at

http://forum.buffalo.nas-central.org/viewtopic.php?f=18&t=5736&start=49

Installation boils to downloading the package, moving it over to the LS, to say /mnt/disk1/operator/kernel1, then unpacking it:

root@LS-GLE1D:/mnt/disk1/operator/kernel1# tar xzvf kernel-2.6.16.57-lsp_eabi-dh_v4.tar.gz

This produces a boot directory which has the kernel and a lib/modules directory which has the kernel modules.

Then one needs to replace the kernel by copying the new kernel to /boot, moving the original kernel out of the way, and symlinking uImage.buffalo to the new kernel:

root@LS-GLE1D:/mnt/disk1/operator/kernel1# cp boot/uImage-2.6.16.57-lsp_eabi-dh_v4 /boot/
root@LS-GLE1D:/mnt/disk1/operator/kernel1# cd /boot
root@LS-GLE1D:/boot# mv uImage.buffalo uImage.buffalo.fw115
root@LS-GLE1D:/boot# ln -s uImage-2.6.16.57-lsp_eabi-dh_v4 uImage.buffalo

Double check to make you did not mistype something, otherwise the new kernel will not be found at boot time, and the machine cannot boot.

By symlinking the new kernel it is easy to go back to the original kernel when necessary.

Finally one needs to also copy over the modules

root@LS-GLE1D:/boot# cd /mnt/disk1/operator/kernel1
root@LS-GLE1D:/mnt/disk1/operator/kernel1# cp -pr lib/ /

The -p flag is for preserving permission (and dates) based on the assumptions that the permissions were done correctly in the download package. (The -r flag stands for recursive and is necessary in order to copy whole directories).

5) reboot: the moment of truth

You can just type reboot at the prompt. You machine will go through its stop scripts (eg. you loose the connection) and reboot.

The machine should come back up and beep. It takes maybe a minute.

6) modprobe usblp

Now you have a usb printing enabled kernel. To actually enable usb printing one must load the usblp kernel module with modprobe:

root@LS-GLE1D:~# modprobe usblp

Check that it loaded with lsmod:

root@LS-GLE1D:~# lsmod
Module                  Size  Used by
*usblp                  12160  0
appletalk              32464  20
psnap                   3268  1 appletalk
llc                     6132  1 psnap

(* added for emphasis)

Connecting a USB printer and loading the module creates a device at /dev/usb/lp0 .

Test by:

root@LS-GLE1D:~# cat /dev/usb/lp0
cat: /dev/usb/lp0: No such device

If this error message appears you do not have the device and you cannot print. Either there is no usb printer connected or the module is not loaded. Instead, there should be no error message. For me the command clears the screen because the printer sends some control character.

Now you could start sending data to printer directly. Eg. you could print to a file with the windows printer driver, move the file to the LS, and cat it to the device to check if it does something, possibly print.

root@LS-GLE1D:~# cat printed.prn > /dev/usb/lp0

(I sent a wrong file to the printer and it started to spit out empty pages ..)

7) install lprng (from .tgz but just lprng not web stuff)

Let's not use samba printing because samba uses lpr anyways and windows actually includes a good lpr for printing to a lpd. This way we remove a layer which make it less complex and therefore easier to understand. Also, it works well. The idea is to pass through without filters (which otherwise are a convenience feature for unix printing) data from the windows printer driver to the USB printer via lpd. lpd listens on port 515 for data requesting print jobs and then jumps into action. It forwards data to the printer and also does accounting which I do not really need.

Get the package from

http://downloads.nas-central.org/LSPro_ARM9/Packages/lprng-withweb_2.04.tgz

Put it on the LS, say on /mnt/disk1/operator and unpack it.

root@LS-GLE1D:/mnt/disk1/operator# mkdir lprng-withweb
root@LS-GLE1D:/mnt/disk1/operator# mv lprng-withweb_2.04.tgz.gz lprng-withweb/
root@LS-GLE1D:/mnt/disk1/operator# cd lprng-withweb/
root@LS-GLE1D:/mnt/disk1/operator/lprng-withweb# tar xzvf lprng-withweb_2.04.tgz.gz

The instructions on

http://buffalo.nas-central.org/wiki/HowTo_add_a_PrintServer_to_the_LSPro

unpack right in the system root /. Let's do it more carefully. I will leave out the included web interface because it does not work for firmware 1.15 and is not really useful to me. The printer should just work when I connect it to the LS.

a) install binaries by copying them over to standard directories.

root@LS-GLE1D:/mnt/disk1/operator/lprng-withweb# cp -ipr usr /

The usr directories have all the executables and libraries and we can just copy them over. The -i flag makes sure we do not accidentally overwrite system files., and -p preserves permission (and symlinks).

b) install config files by copying them over to standard directories.

I did not want to overwrite the default samba init script smb.sh, so let's rename first the provided smb.sh and then copy.

root@LS-GLE1D:/mnt/disk1/operator/lprng-withweb# mv etc/init.d/smb.sh etc/init.d/smb.sh.lprng
root@LS-GLE1D:/mnt/disk1/operator/lprng-withweb# cp -ipr etc /

Again, we do not need a modified smb.sh but let's have the provided one there in case we want it later.

We could also copy over the man pages but since man is not included in stock it does not make a lot sense. One can always use google to read man pages.

c) setup directories

We could use the included lprng-enable.sh script to set up directories but let's do it step by step. The script first sets up the device directory but it should be already there by default:

root@LS-GLE1D:/mnt/disk1/operator/lprng-withweb# ls -la /dev/usb/lp*
crwxrwxrwx    1 root     root     180,   0 Dec  8  2006 /dev/usb/lp0
crwxrwxrwx    1 root     root     180,   1 Dec  8  2006 /dev/usb/lp1
crwxrwxrwx    1 root     root     180,   2 Dec  8  2006 /dev/usb/lp2

Then the scripts creates spool directories for lpd, so let's do that:

root@LS-GLE1D:/mnt/disk1/operator/lprng-withweb# mkdir /var/spool/win /var/spool/tmp /var/spool/samba

/var/spool/tmp and /var/spool/samba are for samba printing which we will not use but let's create the directories anyways for future use.

Then the script opens up wide the spool directories and /dev/null, so let's do that, too:

root@LS-GLE1D:/mnt/disk1/operator/lprng-withweb# chmod 777 /var/spool/* /dev/null

I am not sure if that is necessary and checkpc does complain:

root@LS-GLE1D:/mnt/disk1/operator/lprng-withweb# checkpc
Warning - owner/group of '/var/spool/win' are 0/0, not 2/2
Warning - permissions of '/var/spool/win' are 0777, not 0700
Warning - lp-ps: CATASTROPHIC ERROR! queue 'lp' also has spool directory '/var/spool/win'

This also shows that the included printcap file is not valid. It will still work but one should remove the second queue (lp-ps) or point it to another spool directory.

If you run "checkpc -f" checkpc will attempt to fix problems. Here, it will change the owner of the spool directories to daemon:daemon which is presumably preferable to root.

d) edit init scripts a bit

The only change I made to the provided /etc/init.d/lprng.sh script is to add a line to modprobe usblp. This way we do not need to modprobe manually each time after a reboot. I did not find another obvious place in the firmware where modules are loaded on boot. I put the line in the start section where to me it makes the most sense. One could also remove it again in the stop section but removing it does not gain anything except for a bit of memory. Modprobing after it is already loaded does not seem to hurt.

Before:

        #Let's check about melco
        if [ $printer = off ] ; then
            /usr/bin/logger -t ${tag} -p ${facility} 'Not started lpd'
            exit 0
        fi

        # Start daemons.
        echo -n "Starting lpd: "

After:

        #Let's check about melco
        if [ $printer = off ] ; then
            /usr/bin/logger -t ${tag} -p ${facility} 'Not started lpd'
            exit 0
        fi
        #AP: load module here because nowhere else is obvious
        modprobe usblp
        # Start daemons.
        echo -n "Starting lpd: "

Use vi to edit. (In vi use the arrow keys to navigate, press "i" to insert text or delete text with backspace, press "ESC" to get out of edit mode, and press ":wq" to write the file and quit.)

Going through the script now again, I found that the stop script does not work with the default busybox ps. Edit the script so it reads PSHOWALL="".

To automatically start the script at boot also edit /etc/init.d/rcS and add lprng.sh to the scripts in section 3:

Before:

echo "** step3 **"
for cmd in recover_shareinfo.sh micon_setup.sh atalk.sh ftpd.sh httpd.sh smb.sh clientUtil_servd.sh lsprcvd.sh daemonwatch.sh cron.sh logchkd.sh checkconfig.sh init_sem.sh sshd.sh
do

After:

echo "** step3 **"
for cmd in recover_shareinfo.sh micon_setup.sh atalk.sh ftpd.sh httpd.sh smb.sh clientUtil_servd.sh lsprcvd.sh daemonwatch.sh cron.sh logchkd.sh checkconfig.sh init_sem.sh sshd.sh lprng.sh
do

e) edit configs

The scipts are setup to look into /etc/melco/printer to check if printing is switched on. I guess that is how the web interface can control the setup. Let's just edit the file by hand, with vi, or with sed:

Before:

root@LS-GLE1D:~# more /etc/melco/printer
printer=off
printername=lp

After:

root@LS-GLE1D:~# more /etc/melco/printer
printer=on
printername=lp

In my case I cannot see a situation where I would want printer=off.

I also edited /etc/lpd/lpd.conf to keep spool directory from growing:

Before:

 # Purpose: keep the last NN done jobs for status purposes
#   default done_jobs= 1  (INTEGER)
# Purpose: keep done jobs for at most max age seconds
#   default done_jobs_max_age= 0  (INTEGER)

After:

 # Purpose: keep the last NN done jobs for status purposes
#   default done_jobs= 1  (INTEGER)
# AP: repeat to make sure it is set
done_jobs=1
# Purpose: keep done jobs for at most max age seconds
#   default done_jobs_max_age= 0  (INTEGER)
#AP: to make sure that things get removed
done_jobs_max_age= 7200

The lpd.conf edits are optional and there many more settings which might be useful.

8) start up lpd with init script

After installation we can now start lpd:

root@LS-GLE1D:~# /etc/init.d/lprng.sh start
Starting lpd:

check with ps if lpd is running:

root@LS-GLE1D:~# ps
...
15592 daemon      444 S   lpd Waiting
...

9) set up windows printers (clients): XP: print service for UNIX; Vista: LPR and LPD options

Now, the last step is to set up new windows printers. In windows language these will not be network printers but local printers with a special port. For some reason a standard tcp/ip port in lpr mode (port 515) does not work. One needs to use special LPR ports. In Vista and XP these need to be enabled first. In Vista this option is very hidden:

control Panel - programs and features - turn windows features on and off - print services: LPD print service and LPR port monitor on

In XP the equivalent is here:

control panel - network connections - advanced - optional networking components - other network file and print services - print services for unix

After enabling one now has the option to connect a new local printer to a new LPR port. The IP adress of the LPR port is the IP address of the LS in your network, and the queue name is "lp" (as defined in /etc/printcap)

Use the default windows printer driver for your printer. Some printer apparently need special advanced settings such as "start printing after last page is spooled" and "enable bidirectional support". For my Brother HL 2040 the defaults worked.

This is now a not so rough guide with pretty detailed instructions. It looks long but the explanations take up most of the space.