pklaus / brother_ql

Python package for the raster language protocol of the Brother QL series label printers (QL-500, QL-550, QL-560, QL-570, QL-700, QL-710W, QL-720NW, QL-800, QL-810W, QL-820NWB, QL-1050, QL-1060N and more).
GNU General Public License v3.0
558 stars 165 forks source link

Disable auto power off #50

Open obeone opened 6 years ago

obeone commented 6 years ago

Hi,

Is there a solution using brother_ql to disable auto power off of the printer ?

I know it's possible using Windows or Mac utilities, but I'm working on a project which will use Brother printers at large scale and I would like to be able to disable it directly from linux, avoiding the need to pre-configure the printer.

pklaus commented 6 years ago

Hi Grégoire,

while I think that it's not part of the raster language, I guess this should be perfectly possible with some code based on the PyUSB backend. Unfortunately with my current workload, it would take me some time until I can sit down, do the required reverse engineering, programming and testing necessary to make it work. Feel free to contact me via email (see Readme) about sponsored development options, which could speed up things.

Best regards, Philipp

obeone commented 6 years ago

Hi Philipp,

Thanks for you reply. Ok about that, I will see if we can do something, and which solution the project manager will choose (we are not 100% sure at this time to use Brother printer)

raat1979 commented 5 years ago

Actually raster commands for this do exist, did a usb capture under windows last night using the brother tools to change these settings of a ql-800. I still need to try some of the functions but for now I have the auto power off timeout settings figured out. Still need to write some code to strip unneeded sequences (the tool always does the full init: esc @, status information request, switch to raster etc, etc, ) and check if it works, don't have any python knowlege though...

raat1979 commented 5 years ago

will continue on this tonight/ tomorrow...

hydroid7 commented 5 years ago

Maybe you can share the file and the procedure how you did the capture.

kornpow commented 5 years ago

Curious about this on this QL-800. My big problem currently is once the printer auto-shuts off, once I turn it back on manually I continually get usb.core.USBError: [Errno 19] No such device (it may have been disconnected) errors. Even when unplugging the usb, and restarting the program. A reboot is required for me.

kornpow commented 5 years ago

I was able to create a USB bus capture by installing the windows drivers, installing "Device Monitoring Studio" by HHD software, and then using the Printer Settings Tool to update the printer.

I enabled "Auto Turn On", which so far doesn't actually turn it on once plugging it in. Also I set Auto-Poweroff to None. We'll see if it stays on indefinitely. Could be a good workaround if this setting stays somewhere in the device memory so I dont have to keep booting into Windows.

Abhi0725 commented 4 years ago

@pklaus Any chance we can get this?

meirg commented 4 years ago

Here are the codes for setting from the command line in Linux, sniffed from QL-800:

# Disable Auto Power-Off
echo -n -e '\x1b\x69\x55\x41\x00\x00' | brother_ql send -
# Auto Power-Off After 10 Minutes
echo -n -e '\x1b\x69\x55\x41\x00\x01' | brother_ql send -
# Auto Power-Off After 20 Minutes
echo -n -e '\x1b\x69\x55\x41\x00\x02' | brother_ql send -
# Auto Power-Off After 30 Minutes
echo -n -e '\x1b\x69\x55\x41\x00\x03' | brother_ql send -
# Auto Power-Off After 40 Minutes
echo -n -e '\x1b\x69\x55\x41\x00\x04' | brother_ql send -
# Auto Power-Off After 50 Minutes
echo -n -e '\x1b\x69\x55\x41\x00\x05' | brother_ql send -
# Auto Power-Off After 60 Minutes
echo -n -e '\x1b\x69\x55\x41\x00\x06' | brother_ql send -

For auto power-on (not sure what this actually does)

# Enable Auto Power-On
echo -n -e '\x1b\x69\x55\x70\x00\x01' | brother_ql send -
# Disable Auto Power-On
echo -n -e '\x1b\x69\x55\x70\x00\x00' | brother_ql send -
raat1979 commented 4 years ago

"Auto" power on should be the state when plugging in the device (power)

kosmic247 commented 4 years ago

@meirg Solution works for QL-700 model, too. Thank you so much :+1:

On linux systems the codes can be also set by a simple echo to the device without using brother_ql send:

echo -n -e '\x1b\x69\x55\x41\x00\x00' > /dev/usb/lp0

To make this settings persistent, we used a simple udev rule that gets triggered whenever the device is added by the kernel (boot, hotplug, etc.):

# /etc/udev/rules.d/99-brotherql.rules

ACTION=="add", SUBSYSTEMS=="usb", KERNEL=="lp0", RUN+="/usr/bin/disable_poweroff.sh /dev/usb/lp0"

Custom disable power-off script

# /usr/bin/disable_poweroff.sh

#!/bin/bash
echo -n -e '\x1b\x69\x55\x41\x00\x00' > $1

Make it executable

chmod +x /usr/bin/disable_poweroff.sh

Reload the rules

udevadm control --reload-rules && udevadm trigger
caish5 commented 3 years ago

Thanks so very much. You have no idea how many QL-700s I've temporarily install in Windows VMs just to get rid of the 60 min poweroff.

On the subject of persistence. I don't actually think you need to do anything, just set it and then they've always been fine on Raspberry Pis.