From owner-freebsd-questions@freebsd.org Sun May 3 17:50:28 2020 Return-Path: Delivered-To: freebsd-questions@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D9A332E3D8D for ; Sun, 3 May 2020 17:50:28 +0000 (UTC) (envelope-from rcarter@pinyon.org) Received: from h2.pinyon.org (h2.pinyon.org [65.101.20.170]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 49FYRl1sp9z40kY for ; Sun, 3 May 2020 17:50:26 +0000 (UTC) (envelope-from rcarter@pinyon.org) Received: from [10.0.10.15] (unknown [10.0.10.15]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by h2.pinyon.org (Postfix) with ESMTPSA id 743B63CEED for ; Sun, 3 May 2020 10:50:20 -0700 (MST) Subject: Re: Brother HL-L2340D printer and lpd? To: freebsd-questions@freebsd.org References: <20200503171259.GA48627@admin.sibptus.ru> <20200503192444.2d700440.freebsd@edvax.de> From: "Russell L. Carter" Message-ID: Date: Sun, 3 May 2020 10:50:20 -0700 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <20200503192444.2d700440.freebsd@edvax.de> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 49FYRl1sp9z40kY X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of rcarter@pinyon.org designates 65.101.20.170 as permitted sender) smtp.mailfrom=rcarter@pinyon.org X-Spamd-Result: default: False [-4.06 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; R_SPF_ALLOW(-0.20)[+mx]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; MIME_TRACE(0.00)[0:+]; PREVIOUSLY_DELIVERED(0.00)[freebsd-questions@freebsd.org]; RCPT_COUNT_ONE(0.00)[1]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; TO_DN_NONE(0.00)[]; DMARC_NA(0.00)[pinyon.org]; IP_SCORE(-2.76)[ip: (-9.29), ipnet: 65.101.0.0/18(-4.30), asn: 209(-0.15), country: US(-0.05)]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; SUBJECT_ENDS_QUESTION(1.00)[]; ASN(0.00)[asn:209, ipnet:65.101.0.0/18, country:US]; MID_RHS_MATCH_FROM(0.00)[]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 May 2020 17:50:28 -0000 On 2020-05-03 10:24, Polytropon wrote: > On Mon, 4 May 2020 00:12:59 +0700, Victor Sudakov wrote: >> Dear Colleagues, >> >> I'm trying to use a Brother HL-L2340D printer as a simple >> networked line printer with lpd. I've successfully used HP and >> Canon printers like that with a simple printcap like this: >> >> # by VAS lp|Brother HL-L2340D series:\ :sh:\ :rp=TEXT_P1:\ >> :rm=192.168.1.74:sd=/var/spool/output/lpd1:lf=/var/log/lpd-errs: >> >> but the story with Brother HL-L2340D is different. When fed some >> input with "lptest |lpr", it just spits out 3 empty pages. I've >> never seen anything like that before. > > It's possible that your previous printers could understand regular > (unformatted) ASCII text, but the new one doesn't. > > > >> I'm wondering if someone has this printer and made it work as a >> line printer. >> >> From the specification at >> https://support.brother.com/g/b/spec.aspx?c=us&lang=en&prod=hll2340dw_us_eu_as >> it should support LPD. > > It's not a matter of supporting LPD - it's the question which printer > language the printer can process. The default output format for > programs is PS. According to the above specification, the printer > does not understand PS. However, it supports PCL, and tools like gs > (GhostScript) should be able to convert PS to PCL. This is what you > need to send to the printer. > > I assume you're not using CUPS? In this case, a PPD file for this > printer would probably be the easiest thing, but you can get around > using CUPS of course. > > Maybe this example can help: > > First verify that the printer really understands PCL. You can use nc > (netcat) to send it some data directly. If it works, instantiate a > simple printer filter in /etc/printcap, for example: > > Laserjet|ljet4d;r=600x600;q=high;c=full;p=a4;m=auto:\ > :rm=192.168.100.100:\ :rp=raw:\ :lp=:\ > :if=/opt/libexec/ps2pcl-dup.sh:\ :sd=/var/spool/lpd/Laserjet:\ > :lf=/var/spool/lpd/Laserjet/log:\ :af=/var/spool/lpd/Laserjet/acct:\ > :mx#0:\ :sh: > > Then rebuild printcap.db. Make sure the required directories do > exist. Here is the printer filter, /opt/libexec/ps2pcl-dup.sh: > > #!/bin/sh /usr/bin/printf "\033&k2G" || exit 2 /usr/local/bin/gs -q > -dBATCH -dNOPAUSE -dPARANOIDSAFER -dSAFER \ -sDEVICE=ljet4d > -sPAPERSIZE=a4 -r600x600 \ -dDuplex=true \ -sOutputFile=- - && exit > 0 exit 2 > > I use that one with a HP Laserjet 4000 DN. There is also a filter > (and printer) for non-duplex, it's simply missing the -dDuplex=true > entry. ;-) > > Adjust parameters you need, for example if you don't have standard A4 > paper or need a different resolution. > > It might even be possible that you can use this example 1:1, if the > Brother HL-L2340D speaks PCL in a similar way to the HP Laserjet 4000 > DN - see the "ljet4d" device format, which works both for a Laserjet > 4 and a Laserjet 4000 (I have both). Sidenote: That Laserjet printer > can understand PS, PCL, and ASCII text (including escape sequences > for formatting etc., or real plain text without any preprocessing). > > > > For more inspiration, check: > > http://www.wonkity.com/~wblock/docs/html/lpdprinting.html > > > I print to an HL-L2340DW by using CUPS to remotely print to a Debian CUPS that has it configured as a "driverless" printer: https://wiki.debian.org/CUPSDriverlessPrinting I mention this because otherwise it seems like a real hassle to install using the Brother drivers. There are entries in the lists where we went through what it would take... a real maintenance PITA, no thanks. And I don't believe there should be any problem doing what works in Debian on FreeBSD. I tried very hard to get driverless working on FreeBSD but failed, and I think it's because of the versions: Debian: 2.3.1, FreeBSD: 2.2.13 <- up-to-date However, I am no expert, so I might have done something stupid somewhere. Anyway, options all seem to work, eg two sided printing. Russell