Difference between revisions of "USB printer on LS Pro V2 with 1.15 firmware"
m (→c) setup directories) |
m (→7) install lprng (from .tgz but just lprng not web stuff)) |
||
(7 intermediate revisions by the same user not shown) | |||
Line 41: | Line 41: | ||
This is more exciting since now you are about to leave the coziness of the company approved environment somewhat. The kernel available at | 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 | + | ftp://ftp.dmik.org/pub/common/buffalo/lspro/duncan_h/kernel-2.6.16.57-lsp_eabi-dh_v4.tar.gz (seems offline) |
+ | |||
+ | http://download.discountnetz.com/kernel/kernel-2.6.16.57-lsp_eabi-dh_v4.tar.gz (other source) | ||
+ | |||
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 | 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 | ||
Line 117: | Line 120: | ||
=== 7) install lprng (from .tgz but just lprng not web stuff) === | === 7) install lprng (from .tgz but just lprng not web stuff) === | ||
− | Let's not use samba printing because | + | Let's not use samba printing because it just adds complexity 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 | Get the package from | ||
Line 166: | Line 169: | ||
</pre> | </pre> | ||
− | By default the /dev/usb/lp* devices have 755 permissions as shown above. Change those to 777 permissions: | + | By default the /dev/usb/lp* devices have 755 permissions as shown above. Change those to 777 permissions to allow access by all users: |
<pre>root@LS-GLE1D:/mnt/disk1/operator/lprng-withweb# chmod 777 /dev/usb/lp* | <pre>root@LS-GLE1D:/mnt/disk1/operator/lprng-withweb# chmod 777 /dev/usb/lp* | ||
Line 263: | Line 266: | ||
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. | ||
− | I also edited /etc/lpd/lpd.conf to keep spool directory from growing: | + | I also edited /etc/lpd/lpd.conf to keep the spool directory from growing too much in size: |
Before: | Before: | ||
Line 301: | Line 304: | ||
=== 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 === | ||
− | 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: | + | 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 windows7, Vista and XP these need to be enabled first. In windows7 and Vista this option is very hidden: |
+ | Windows7: | ||
+ | control Panel - programs - programs and features - turn windows features on and off - print services: LPD print service and LPR port monitor on | ||
+ | |||
+ | Vista: | ||
control Panel - programs and features - turn windows features on and off - print services: LPD print service and LPR port monitor on | control Panel - programs and features - turn windows features on and off - print services: LPD print service and LPR port monitor on | ||
Line 317: | Line 324: | ||
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) | 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. | + | 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. For my Canon Imageclass MF4350d printer the defaults also simply 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. | This is now a not so rough guide with pretty detailed instructions. It looks long but the explanations take up most of the space. | ||
+ | |||
+ | === 10) raw printing, cups === | ||
+ | |||
+ | Since lprng also supports "raw" printing using port 9100 ("socket") as a special queue (?), it seems it might be possible to use the standard tcp/ip port in windows and avoid lpd/lpr print services enabling. Something to keep in mind in case MS gets rid but not worth changing if the setup is working. | ||
+ | |||
+ | cups would be interesting for "driverless" printing (eg. google cloud printing) since then cups would provide its own driver. It can be installed with optware quite straightforwardly. However, not all printers have cups drivers, especially under arm. In particular the Canon Imageclass MF4350d printer is not supported at all since Canon uses there its proprietary UFRII language for which it only provides binary x86 drivers. | ||
[[Category:LSPro]] | [[Category:LSPro]] | ||
[[Category:Software]] | [[Category:Software]] | ||
[[Category:Printing]] | [[Category:Printing]] |
Latest revision as of 19:53, 16 December 2011
Step by Step Guide
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:
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 (seems offline)
http://download.discountnetz.com/kernel/kernel-2.6.16.57-lsp_eabi-dh_v4.tar.gz (other source)
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 it just adds complexity 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
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* crwxr-xr-x 1 root root 180, 0 Dec 8 2006 /dev/usb/lp0 crwxr-xr-x 1 root root 180, 1 Dec 8 2006 /dev/usb/lp1 crwxr-xr-x 1 root root 180, 2 Dec 8 2006 /dev/usb/lp2
By default the /dev/usb/lp* devices have 755 permissions as shown above. Change those to 777 permissions to allow access by all users:
root@LS-GLE1D:/mnt/disk1/operator/lprng-withweb# chmod 777 /dev/usb/lp*
Alternatively, instead of changing the permissions to 777, change the ownership of the device files to daemon:daemon as in:
root@LS-GLE1D:/mnt/disk1/operator/lprng-withweb# chown daemon:daemon /dev/usb/lp*
These permissions should be safer as now only root and daemon can write to the device (print). lpd is run by user daemon, so lpd printing will work.
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/win /var/spool/tmp /var/spool/samba root@LS-GLE1D:/mnt/disk1/operator/lprng-withweb# chmod 666 /dev/null
I am not sure if that 777 on the spool directories 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. Edit the printcap file in /etc/lpd/printcap and copy it to /etc/printcap to make the changes permanent.
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. And the command will also change the permission to 700 which works just as well at least if you do not use samba.
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 the spool directory from growing too much in size:
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 windows7, Vista and XP these need to be enabled first. In windows7 and Vista this option is very hidden:
Windows7: control Panel - programs - programs and features - turn windows features on and off - print services: LPD print service and LPR port monitor on
Vista: 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:
First install print services for unix following this MS Knowledge article:
http://support.microsoft.com/kb/324078
Then enable the service:
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. For my Canon Imageclass MF4350d printer the defaults also simply 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.
10) raw printing, cups
Since lprng also supports "raw" printing using port 9100 ("socket") as a special queue (?), it seems it might be possible to use the standard tcp/ip port in windows and avoid lpd/lpr print services enabling. Something to keep in mind in case MS gets rid but not worth changing if the setup is working.
cups would be interesting for "driverless" printing (eg. google cloud printing) since then cups would provide its own driver. It can be installed with optware quite straightforwardly. However, not all printers have cups drivers, especially under arm. In particular the Canon Imageclass MF4350d printer is not supported at all since Canon uses there its proprietary UFRII language for which it only provides binary x86 drivers.