TPlink MR3020 V1 USB Print server

Experiments like this would be much easier when not restricted by the tiny hardware. If you have an old x86 box you could try making that an OpenWrt print server, to see if the concept is going to work at all with this particular printer. Then if it does work you could make a custom build to cram it into the MR3020.

1 Like

Thank you for your quick response! I don't have an x86 spare with me, I can naively follow the instructions and install it on the same router.

I do have some space on the router:

root@OpenWrt:~# free -hs
             total       used       free     shared    buffers     cached
Mem:         27820      21720       6100        508       2240       7168
-/+ buffers/cache:      12312      15508
Swap:            0          0          0

You have to build your own custom image. There will not be enough room to add any other packages, so you'll have to remove something (likely p910nd, maybe also LuCI). To be clear, there wasn't even enough room for opkg to be installed, thus why it was removed.

As stated by @mk24 , the 4MB limit of that device makes it exceedingly difficult to do anything with it, especially experimentation. If you can find any OpenWrt supported device with a USB port and at least 8MB flash storage, things will be much easier.

1 Like

@mk24 @psherman Folks, Point taken.
can I request you guys to help me troubleshoot this p910 server saga.?
for the starters, I don't see it in the logread command

I've given you as much help as I can (technically speaking) because my situation is a bit different... (as described earlier, I use the MR3020v1 > USB to parallel adapter > HP LaserJet MP with native postscript support; my computers use the standard generic postscript driver and it just works). I have never used any other printers with this setup (and obviously not a Canon device), so I don't know what might need to be different about the config. I wish I could help you solve the issue, but I'm out of ideas.

Sure thing. Thank you so much for your efforts. Much appreciated!
would it be ok for you, if i ask some questions?

I may not have answers, but sure go ahead and ask.

Thank you for being kind to me :slight_smile:
I am just trying to amend this code to relay p910nd log messages. I dont know where i am wrong. please guide me

#!/bin/sh /etc/rc.common
# Copyright (C) 2007 OpenWrt.org
START=99
USE_PROCD=1
DAEMON_NAME="p910nd"
CONFIG="p910nd"

append_bool() {
	local section="$1"
	local option="$2"
	local value="$3"
	local _val
	config_get_bool _val "$section" "$option" '0'
	[ "$_val" -gt 0 ] && append args "$3"
}

append_string() {
	local section="$1"
	local option="$2"
	local value="$3"
	local _val
	config_get _val "$section" "$option"
	[ -n "$_val" ] && append args "$3$_val"
}

start_service() {
	config_load $CONFIG
	config_foreach start_p910nd $CONFIG
}


start_p910nd() {
	local section="$1" runas_root
	config_get_bool "enabled" "$section" "enabled" '0'
	config_get device "$section" device
	# If the device path exists, the device is connected; set it up:
	if [ "$enabled" -gt 0 ] && [ -e "$device" ]; then
		args="-d "
		config_get port "$section" port
		append_bool "$section" bidirectional "-b"
		append_string "$section" device "-f "
		append_string "$section" bind "-i "
		append_string "$section" port ""
		procd_open_instance
		procd_set_param command /usr/sbin/$DAEMON_NAME $args
		procd_set_param respawn

		config_get_bool runas_root "$section" runas_root 0
		[ "$runas_root" -ne 1 ] && procd_set_param user $DAEMON_NAME

		config_get_bool "mdns" "$section" "mdns" '0'
		if [ "$mdns" -gt 0 ]; then
			config_get mdns_note "$section" mdns_note
			config_get mdns_ty "$section" mdns_ty
			config_get mdns_product "$section" mdns_product
			config_get mdns_mfg "$section" mdns_mfg
			config_get mdns_mdl "$section" mdns_mdl
			config_get mdns_cmd "$section" mdns_cmd
			# Optional parameters
			config_get mdns_cid "$section" mdns_cid
			config_get mdns_cls "$section" mdns_cls
			config_get mdns_cmt "$section" mdns_cmt
			config_get mdns_des "$section" mdns_des
			config_get mdns_drv "$section" mdns_drv
			config_get mdns_sn "$section" mdns_sn
			config_get mdns_ver "$section" mdns_ver

			# Set initial arguments
			set -- "pdl-datastream" "tcp" "$((port+9100))"
			set -- "$@" "txtvers=1"
			# bonjourprinting-1.2.1.pdf spec mandates (at least) MFG, MDL, CMD for Socket type
			[ -n "$mdns_note" ] && set -- "$@" "note=$mdns_note"
			[ -n "$mdns_ty" ] && set -- "$@" "ty=$mdns_ty"
			[ -n "$mdns_product" ] && set -- "$@" "product=$mdns_product"
			[ -n "$mdns_mfg" ] && set -- "$@" "usb_MFG=$mdns_mfg"
			[ -n "$mdns_mdl" ] && set -- "$@" "usb_MDL=$mdns_mdl"
			[ -n "$mdns_cmd" ] && set -- "$@" "usb_CMD=$mdns_cmd"
			# Optional parameters
			[ -n "$mdns_cid" ] && set -- "$@" "usb_CID=$mdns_cid"
			[ -n "$mdns_cls" ] && set -- "$@" "usb_CLS=$mdns_cls"
			[ -n "$mdns_cmt" ] && set -- "$@" "usb_CMT=$mdns_cmt"
			[ -n "$mdns_des" ] && set -- "$@" "usb_DES=$mdns_des"
			[ -n "$mdns_drv" ] && set -- "$@" "usb_DRV=$mdns_drv"
			[ -n "$mdns_sn" ] && set -- "$@" "usb_SN=$mdns_sn"
			[ -n "$mdns_ver" ] && set -- "$@" "usb_VER=$mdns_ver"

			# Call procd_add_mdns with the positional parameters
			MDNS_INSTANCE_NAME="$mdns_ty" procd_add_mdns "$@"
		fi
		procd_close_instance
	fi
}

diff --git a/etc/init.d/p910nd b/etc/init.d/p910nd
--- a/etc/init.d/p910nd
+++ b/etc/init.d/p910nd
@@ -53,7 +53,26 @@ start_p910nd() {
                config_get mdns_mdl "$section" mdns_mdl
                config_get mdns_cmd "$section" mdns_cmd
                [ "$mdns" -gt 0 ] && procd_add_mdns "pdl-datastream" "tcp" "$((p
ort+9100))" "note=$mdns_note" "ty=$mdns_ty" "product=$mdns_product" "usb_MFG=$md
ns_mfg" "usb_MDL=$mdns_mdl" "usb_CMD=$mdns_cmd"
+
+               procd_set_param stdout 1 # relay stdout to logd
+               procd_set_param stderr 1 # relay stderr to logd
 
                procd_close_instance
        fi
 }

service_triggers()
{
	procd_open_trigger
	procd_add_config_trigger "config.change" $DAEMON_NAME /etc/init.d/$DAEMON_NAME reload
	procd_close_trigger
}


Honestly, I have no idea... I've never needed to touch the standard init functions.

You can insert stuff into the system log by simply adding logger <stuff you want to log>, but aside from that, I don't really have much to add.

@NPeca75 would you help me pls. I see you're quite active on this subject

Hi @mohit0121
you want to debug things so you want stdout/stderr ?

no need to mess with init
simply, ssh to box, stop all p910nd instance
then run
/usr/sbin/p910nd -d -b -f /dev/usb/lp0 -i :: 0

it will run p910 daemon in front, so you will see live log on console

I was little unsure about the p910nd service. In some posts I saw the service is down or doesnt boot up. Btw, Tried Printing twice, but no luck. at one time it showed me an error the other time the data was sent to the printer.

root@OpenWrt:~# /usr/sbin/p910nd -d -b -f /dev/usb/lp0 -i :: 0
Connection from ::ffff:192.168.1.2 port 55367 accepted
read 7300 bytes from network
wrote 7300 bytes to printer
read 7300 bytes from network
read 892 bytes from network
write: I/O error
Finished job: 7300/15492 bytes sent to printer, 0/0 bytes sent to network
copy_stream: I/O error
Connection from ::ffff:192.168.1.2 port 55429 accepted
read 8192 bytes from network
wrote 8192 bytes to printer
read 6408 bytes from network
read 1460 bytes from network
read 324 bytes from network
wrote 8192 bytes to printer
read 8192 bytes from network
wrote 8192 bytes to printer
read 8192 bytes from network
wrote 8192 bytes to printer
read 8192 bytes from network
wrote 8192 bytes to printer
read 8192 bytes from network
wrote 8192 bytes to printer
read 8192 bytes from network
wrote 8192 bytes to printer
read 8192 bytes from network
read 6 bytes from printer
wrote 6 bytes to network
wrote 8192 bytes to printer
read 8192 bytes from network
wrote 8192 bytes to printer
read 8192 bytes from network
wrote 8192 bytes to printer
read 8192 bytes from network
wrote 8192 bytes to printer
read 8192 bytes from network
wrote 8192 bytes to printer
read 8192 bytes from network
wrote 8192 bytes to printer
read 8192 bytes from network
wrote 8192 bytes to printer
read 8192 bytes from network
wrote 8192 bytes to printer
read 8192 bytes from network
read 6 bytes from printer
wrote 6 bytes to network
wrote 8192 bytes to printer
read 8192 bytes from network
wrote 8192 bytes to printer
read 8192 bytes from network
wrote 8192 bytes to printer
read 8192 bytes from network
wrote 8192 bytes to printer
read 2822 bytes from network
read: eof
wrote 2822 bytes to printer
Finished job: 158470/158470 bytes sent to printer, 12/12 bytes sent to network
Connection from ::ffff:192.168.1.2 port 55430 accepted
read 8192 bytes from network
wrote 8192 bytes to printer
read 6408 bytes from network
read 1784 bytes from network
wrote 8192 bytes to printer
read 8192 bytes from network
wrote 8192 bytes to printer
read 8192 bytes from network
wrote 8192 bytes to printer
read 8192 bytes from network
wrote 8192 bytes to printer
read 8192 bytes from network
wrote 8192 bytes to printer
read 8192 bytes from network
wrote 8192 bytes to printer
read 8192 bytes from network
read 6 bytes from printer
wrote 6 bytes to network
wrote 8192 bytes to printer
read 8192 bytes from network
wrote 8192 bytes to printer
read 8192 bytes from network
wrote 8192 bytes to printer
read 8192 bytes from network
wrote 8192 bytes to printer
read 8192 bytes from network
wrote 8192 bytes to printer
read 8192 bytes from network
wrote 8192 bytes to printer
read 8192 bytes from network
wrote 8192 bytes to printer
read 8192 bytes from network
wrote 8192 bytes to printer
read 8192 bytes from network
read 6 bytes from printer
wrote 6 bytes to network
wrote 8192 bytes to printer
read 8192 bytes from network
wrote 8192 bytes to printer
read 8192 bytes from network
wrote 8192 bytes to printer
read 8192 bytes from network
wrote 8192 bytes to printer
read 2822 bytes from network
read: eof

sorry
after all, it is a CAPT printer with device specific protocol
there is a daemons in linux which translate printing stream into CAPT and send to printer, but they are cups based ? if i am right
as @mk24 mentioned, and my own post abowe

sudo /usr/sbin/ccpdadmin -p LBP2900 -o /dev/usb/lp0
sudo service ccpd start
sudo service ccpd status

i feel you are out of luck :frowning:
no, i don't have lbp2900 and have no time to experiment on this toppic

1 Like

Yes you are moving bytes from the network to the printer, which is all that P910nd was ever intended to do. If it doesn't print anything that is probably because it is expecting some other tricks over USB.

Thank you for your prompt response!
Sudo not found, I tried searching for ccpdadmin, no luck.

root@OpenWrt:~# sudo /usr/sbin/ccpdadmin -p LBP2900 -o /dev/usb/lp0
-ash: sudo: not found
root@OpenWrt:~# sudo
-ash: sudo: not found
root@OpenWrt:~# ls /usr/sbin/ccpdadmin
ls: /usr/sbin/ccpdadmin: No such file or directory
root@OpenWrt:~# ls /usr/sbin
avahi-daemon    dnsmasq         iw              p910nd
brctl           dropbear        ntpd            uhttpd
chroot          fw_printenv     ntpd-hotplug    wpa_supplicant
crond           fw_setenv       odhcpd          wpad
dbus-daemon     hostapd         odhcpd-update

the example i wrote with sudo commands, are from real Linux system, not openwrt
they are needed for linux/cups driver
and they aprove my theory that lbp2900 will NOT work without translator, aka CAPT driver

no, you will never fit CUPS + 130MB driver onto OWRT device
sorry :frowning:

1 Like

Gentleman, I think we've reached a dead end.
I just want to thank everyone specially @psherman @takimata @brada4 @NPeca75 @mk24 @ValdikSS to respond back promptly in supporting me. Much appreciated!

Hello again. I was just wondering, what if, I expand the router storage with a powered usb hub, usb drive and do a ext configuration, will it work?

Possibly, but it would still be stuck with only 32 MB of RAM which is not good for loading up experimental stuff. As I said before, first prove the concept (that this particular printer is able to work at all as a network printer using OpenWrt drivers) on unrestricted hardware then try to port it to the old 3020.