pdewacht / brlaser

Brother laser printer driver
GNU General Public License v2.0
576 stars 109 forks source link

Support for long-edge / short-edge duplexing #124

Closed evanmiller closed 1 year ago

evanmiller commented 3 years ago

The Tumble option is already gathered from CUPS, but was not being sent to the printer. (Tumble = true corresponds to short-edge duplexing, and Tumble = false means long-edge duplexing.) Replace the cryptic PCL short-edge duplexing command with the PJL commands SET DUPLEX = ON / OFF and SET BINDING = LONGEDGE / SHORTEDGE.

Tested on an HL-L2300D.

tumble

Isaacych commented 2 years ago

Hello Evan, Thank you so much for your contribution! I tested your version. The duplex printing is working on my HL-L2300D on Raspberry Pi OS. It works also when I print remotely. However, the two-side printing came out with the short-edged flipped no matter what I choose in the CUPS setting. It would be great if you can fix this!

mrlasers commented 2 years ago

Worked for my HL-L2320D on Raspberry Pi OS. The back sides of my booklet are no longer upside down!

contracode commented 2 years ago

When I install this fork of the driver, my HL-L2300D on Raspberry Pi OS no longer works. It no longer appears in the driver selection list. I tried to select "HL-L2320D, using brlaser v6 (en)" here, and the printer could not print a test page.

image

I reviewed the code and it makes sense, but I'm not sure why my printer model doesn't work. :/

contracode commented 2 years ago

The duplex printing is working on my HL-L2300D on Raspberry Pi OS. It works also when I print remotely.

Which model did you choose on the Add Printer page, @Isaacych?

Isaacych commented 2 years ago

The duplex printing is working on my HL-L2300D on Raspberry Pi OS. It works also when I print remotely.

Which model did you choose on the Add Printer page, @Isaacych?

I found the HL-2300D model over the list and used that.

contracode commented 2 years ago

Thank you @Isaacych. I found it and was able to successfully print, but I am only able to do one-sided printing in my environment.

Could you please share your OS and CUPS version? I am using Raspbian GNU/Linux 10 (buster) and CUPS 2.2.10.

$ cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 10 (buster)"
NAME="Raspbian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"

and

$ apt policy cups
cups:
  Installed: 2.2.10-6+deb10u4
  Candidate: 2.2.10-6+deb10u4
  Version table:
 *** 2.2.10-6+deb10u4 500
        500 http://raspbian.raspberrypi.org/raspbian buster/main armhf Packages
        100 /var/lib/dpkg/status
contracode commented 2 years ago

Including a debug log as well--

D [05/Jan/2022:19:27:52 -0500] [Job 316] Applying default options...
I [05/Jan/2022:19:27:52 -0500] [Job 316] Adding start banner page "none".
I [05/Jan/2022:19:27:52 -0500] [Job 316] Adding end banner page "none".
I [05/Jan/2022:19:27:52 -0500] [Job 316] File of type application/vnd.cups-raw queued by "contracode".
D [05/Jan/2022:19:27:52 -0500] [Job 316] hold_until=0
I [05/Jan/2022:19:27:52 -0500] [Job 316] Queued on "Brother_HL-L2300D" by "contracode".
D [05/Jan/2022:19:27:52 -0500] [Job 316] time-at-processing=1641428872
D [05/Jan/2022:19:27:52 -0500] [Job 316] 2 filters for job:
D [05/Jan/2022:19:27:52 -0500] [Job 316] - (application/vnd.cups-raw to printer/Brother_HL-L2300D/application/octet-stream, cost 0)
D [05/Jan/2022:19:27:52 -0500] [Job 316] - (printer/Brother_HL-L2300D/application/octet-stream to printer/Brother_HL-L2300D, cost 0)
D [05/Jan/2022:19:27:52 -0500] [Job 316] job-sheets=none,none
D [05/Jan/2022:19:27:52 -0500] [Job 316] argv[0]="Brother_HL-L2300D"
D [05/Jan/2022:19:27:52 -0500] [Job 316] argv[1]="316"
D [05/Jan/2022:19:27:52 -0500] [Job 316] argv[2]="contracode"
D [05/Jan/2022:19:27:52 -0500] [Job 316] argv[3]="Spring 2022 CS7643 Deep Learning Syllabus and Schedule_v5.1.pdf"
D [05/Jan/2022:19:27:52 -0500] [Job 316] argv[4]="1"
D [05/Jan/2022:19:27:52 -0500] [Job 316] argv[5]="job-uuid=urn:uuid:78dd9db0-97e6-3b31-5113-8fdda2593f8d job-originating-host-name=192.168.1.39 date-time-at-creation= date-time-at-processing= time-at-creation=1641428872 time-at-processing=1641428872"
D [05/Jan/2022:19:27:52 -0500] [Job 316] argv[6]="/var/spool/cups/d00316-001"
D [05/Jan/2022:19:27:52 -0500] [Job 316] envp[0]="CUPS_CACHEDIR=/var/cache/cups"
D [05/Jan/2022:19:27:52 -0500] [Job 316] envp[1]="CUPS_DATADIR=/usr/share/cups"
D [05/Jan/2022:19:27:52 -0500] [Job 316] envp[2]="CUPS_DOCROOT=/usr/share/cups/doc-root"
D [05/Jan/2022:19:27:52 -0500] [Job 316] envp[3]="CUPS_FONTPATH=/usr/share/cups/fonts"
D [05/Jan/2022:19:27:52 -0500] [Job 316] envp[4]="CUPS_REQUESTROOT=/var/spool/cups"
D [05/Jan/2022:19:27:52 -0500] [Job 316] envp[5]="CUPS_SERVERBIN=/usr/lib/cups"
D [05/Jan/2022:19:27:52 -0500] [Job 316] envp[6]="CUPS_SERVERROOT=/etc/cups"
D [05/Jan/2022:19:27:52 -0500] [Job 316] envp[7]="CUPS_STATEDIR=/run/cups"
D [05/Jan/2022:19:27:52 -0500] [Job 316] envp[8]="HOME=/var/spool/cups/tmp"
D [05/Jan/2022:19:27:52 -0500] [Job 316] envp[9]="PATH=/usr/lib/cups/filter:/usr/bin:/usr/sbin:/bin:/usr/bin"
D [05/Jan/2022:19:27:52 -0500] [Job 316] envp[10]="SERVER_ADMIN=root@raspberrypi"
D [05/Jan/2022:19:27:52 -0500] [Job 316] envp[11]="SOFTWARE=CUPS/2.2.10"
D [05/Jan/2022:19:27:52 -0500] [Job 316] envp[12]="TMPDIR=/var/spool/cups/tmp"
D [05/Jan/2022:19:27:52 -0500] [Job 316] envp[13]="USER=root"
D [05/Jan/2022:19:27:52 -0500] [Job 316] envp[14]="CUPS_MAX_MESSAGE=2047"
D [05/Jan/2022:19:27:52 -0500] [Job 316] envp[15]="CUPS_SERVER=/run/cups/cups.sock"
D [05/Jan/2022:19:27:52 -0500] [Job 316] envp[16]="CUPS_ENCRYPTION=IfRequested"
D [05/Jan/2022:19:27:52 -0500] [Job 316] envp[17]="IPP_PORT=631"
D [05/Jan/2022:19:27:52 -0500] [Job 316] envp[18]="CHARSET=utf-8"
D [05/Jan/2022:19:27:52 -0500] [Job 316] envp[19]="LANG=en_US.UTF-8"
D [05/Jan/2022:19:27:52 -0500] [Job 316] envp[20]="PPD=/etc/cups/ppd/Brother_HL-L2300D.ppd"
D [05/Jan/2022:19:27:52 -0500] [Job 316] envp[21]="RIP_MAX_CACHE=128m"
D [05/Jan/2022:19:27:52 -0500] [Job 316] envp[22]="CONTENT_TYPE=application/vnd.cups-raw"
D [05/Jan/2022:19:27:52 -0500] [Job 316] envp[23]="DEVICE_URI=usb://Brother/HL-L2300D%20series?serial=U63878J8N563746"
D [05/Jan/2022:19:27:52 -0500] [Job 316] envp[24]="PRINTER_INFO=Brother HL-L2300D series"
D [05/Jan/2022:19:27:52 -0500] [Job 316] envp[25]="PRINTER_LOCATION=raspberrypi"
D [05/Jan/2022:19:27:52 -0500] [Job 316] envp[26]="PRINTER=Brother_HL-L2300D"
D [05/Jan/2022:19:27:52 -0500] [Job 316] envp[27]="PRINTER_STATE_REASONS=none"
D [05/Jan/2022:19:27:52 -0500] [Job 316] envp[28]="CUPS_FILETYPE=document"
D [05/Jan/2022:19:27:52 -0500] [Job 316] envp[29]="FINAL_CONTENT_TYPE=application/octet-stream"
D [05/Jan/2022:19:27:52 -0500] [Job 316] envp[30]="AUTH_I****"
I [05/Jan/2022:19:27:52 -0500] [Job 316] Started backend /usr/lib/cups/backend/usb (PID 10571)
D [05/Jan/2022:19:27:52 -0500] [Job 316] Loading USB quirks from \"/usr/share/cups/usb\".
D [05/Jan/2022:19:27:52 -0500] [Job 316] Loaded 172 quirks.
D [05/Jan/2022:19:27:52 -0500] [Job 316] Printing on printer with URI: usb://Brother/HL-L2300D%20series?serial=U63878J8N563746
D [05/Jan/2022:19:27:52 -0500] [Job 316] libusb_get_device_list=5
D [05/Jan/2022:19:27:52 -0500] [Job 316] STATE: +connecting-to-device
D [05/Jan/2022:19:27:52 -0500] [Job 316] STATE: -connecting-to-device
D [05/Jan/2022:19:27:52 -0500] [Job 316] STATE: +connecting-to-device
D [05/Jan/2022:19:27:53 -0500] [Job 316] STATE: -connecting-to-device
D [05/Jan/2022:19:27:53 -0500] [Job 316] Device protocol: 2
D [05/Jan/2022:19:27:53 -0500] [Job 316] Sending data to printer.
D [05/Jan/2022:19:27:53 -0500] [Job 316] Set job-printer-state-message to "Sending data to printer.", current level=INFO
D [05/Jan/2022:19:27:53 -0500] [Job 316] PAGE: 1 1
D [05/Jan/2022:19:27:53 -0500] [Job 316] Read 8192 bytes of print data...
D [05/Jan/2022:19:27:53 -0500] [Job 316] Wrote 8192 bytes of print data...
D [05/Jan/2022:19:27:53 -0500] [Job 316] Sending print file, 8192 bytes...
D [05/Jan/2022:19:27:53 -0500] [Job 316] Read 8192 bytes of print data...
...
...
D [05/Jan/2022:19:27:57 -0500] [Job 316] Wrote 4151 bytes of print data...
D [05/Jan/2022:19:27:57 -0500] [Job 316] Sending print file, 2142263 bytes...
D [05/Jan/2022:19:27:57 -0500] [Job 316] Sent 2142263 bytes...
D [05/Jan/2022:19:27:57 -0500] [Job 316] Waiting for read thread to exit...
D [05/Jan/2022:19:27:57 -0500] [Job 316] PID 10571 (/usr/lib/cups/backend/usb) exited with no errors.
D [05/Jan/2022:19:27:57 -0500] [Job 316] time-at-completed=1641428877
I [05/Jan/2022:19:27:57 -0500] [Job 316] Job completed.
D [05/Jan/2022:19:27:58 -0500] [Job 316] Unloading...
D [05/Jan/2022:19:33:20 -0500] [Job 316] Loading attributes...
D [05/Jan/2022:19:34:21 -0500] [Job 316] Unloading...
mrlasers commented 2 years ago

Worked for my HL-L2320D on Raspberry Pi OS. The back sides of my booklet are no longer upside down!

I spoke too soon. It only prints short-edge flipped, like @Isaacych reported.

Isaacych commented 2 years ago

@contracode Sorry for the late reply. Please find the info here. I hope you have already solved the issues.

cat /etc/os-release PRETTY_NAME="Raspbian GNU/Linux 10 (buster)" NAME="Raspbian GNU/Linux" VERSION_ID="10" VERSION="10 (buster)" VERSION_CODENAME=buster ID=raspbian ID_LIKE=debian HOME_URL="http://www.raspbian.org/" SUPPORT_URL="http://www.raspbian.org/RaspbianForums" BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"

apt policy cups cups: Installed: 2.2.10-6+deb10u4 Candidate: 2.2.10-6+deb10u4 Version table: *** 2.2.10-6+deb10u4 500 500 http://raspbian.raspberrypi.org/raspbian buster/main armhf Packages 100 /var/lib/dpkg/status

evanmiller commented 1 year ago

Closing in favor of https://github.com/QORTEC/brlaser/pull/2 – if long-edge printing didn't work for you with this PR, please try that one!