OpenWrt Forum Archive

Topic: Control Printer Power via TL-MR3020 Print Server

The content of this topic has been archived on 1 May 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

I am having trouble finding a solution to this (or understanding this since I am kind of a novice). Want I want to do is turn on my printer when I want to print something and then after a certain amount of time (or after its done printing), power it off. That way I won't waste standby power in between prints (I don't print that often).

My setup is a TP-Link TL-MR3020 wireless router using the p910nd print server which I currently can print wirelessly with no problems.

After some testing, what I think I need to do is the following;

1. Send a document to the printer.
2. Some type of program/script starts to run when it receives traffic on port 9100 (printer port).
3. GPIO pin 7 goes high (flips a relay that switches the AC power on for the printer).
4. GPIO pin 8 toggles (this resets the USB interface).
5. Document is printed.
6. GPIO pin 7 goes low after 30 min (not sure if there is a way to know when the printer is done printing and just shut it off then).

Is this even possible? Is there a better way to do this?

Thank you for the help in advanced.

So another question would be, Can I write a custom version of p910nd to control GPIO ports? If so, how do I build and install it onto my router?

What about a USB or LAN controlled power outlet? Gembird comes to my mind... http://gmb.nl/item.aspx?id=7415
AFAIK there's another manufacturer of such devices, but I don't remember the name...

OK, it's plug & play and far less nerdy than via gpio...

Anyway, hope this helps.

Well, one way or the other, that is probably not the big deal. More important is certainly how to first do:

cheeznips wrote:

2. Some type of program/script starts to run when it receives traffic on port 9100 (printer port).

And due to the lack of experience with p910nd, I can't help out there.

tmo26 wrote:

What about a USB or LAN controlled power outlet? Gembird comes to my mind... http://gmb.nl/item.aspx?id=7415

Thanks for that info. Unfortunately I only have one USB port available and that is used for the printer. I have successfully controlled GPIOs via the terminal already by doing the following;

# turn off USB power
echo 0 > /sys/devices/virtual/gpio/gpio8/value
# turn on USB power
echo 1 > /sys/devices/virtual/gpio/gpio8/value

That was done for step 4 since after turning on the power to my printer (or plugging it in) for some reason the usb port has to be reset. I will be using this method to switch another (unused) GPIO with this, www.sparkfun.com/tutorials/119
I just need to make sure the GPIO can power it, but I am not quite there yet.

MBS <-- I agree that should be done first.

I was able to use a tcpdump to listen to the port and verify that I only get traffic when I send something to print. So, I came across libpcap and will see if I can use this to make my own program to do what I want. If anyone has any knowledge with libpcap, any input would be helpful.

Thanks!

The discussion might have continued from here.