From owner-freebsd-questions@freebsd.org Sun May 3 17:24:49 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 B803E2E3491 for ; Sun, 3 May 2020 17:24:49 +0000 (UTC) (envelope-from freebsd@edvax.de) Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.17.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "mout.kundenserver.de", Issuer "TeleSec ServerPass Class 2 CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49FXt84FL3z3yNc for ; Sun, 3 May 2020 17:24:48 +0000 (UTC) (envelope-from freebsd@edvax.de) Received: from r56.edvax.de ([178.5.226.107]) by mrelayeu.kundenserver.de (mreue107 [212.227.15.183]) with ESMTPA (Nemesis) id 1MDy9C-1jLMCn06rs-009wh6; Sun, 03 May 2020 19:24:45 +0200 Date: Sun, 3 May 2020 19:24:44 +0200 From: Polytropon To: Victor Sudakov Cc: freebsd-questions@freebsd.org Subject: Re: Brother HL-L2340D printer and lpd? Message-Id: <20200503192444.2d700440.freebsd@edvax.de> In-Reply-To: <20200503171259.GA48627@admin.sibptus.ru> References: <20200503171259.GA48627@admin.sibptus.ru> Reply-To: Polytropon Organization: EDVAX X-Mailer: Sylpheed 3.1.1 (GTK+ 2.24.5; i386-portbld-freebsd8.2) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K1:Sj7M/AT5lNHoPNLcOjQRRC6AKGjbWsji8+JD6+WgqMe0mAWzEwz 4Dg/VEIf0UVCLplmsXCfc6ZxuFV0dq1XH26mTxcVYbH3JzSkh0HykG+k96s0ZfeB2ZcjcBo 8LuM1Z3ORdePsM40QIUvtTeEL+pCf3JEx7NFcjOF48ssndCV0VimrPy1HTxSqcyBXQi+ZJB gW/gUBAVHd9InYkkV/cXg== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:Ue0JgEpFXBo=:MSe80UdTLDt3cTxY9FvhNy koE/0jZM23zR2Wlg5k4TpXU3QNRcFxIbAll63F7m4kslya8QnRPClLreJC0nFSWNOh9cseaF4 +G1qDSm/twyKaoaF+tRC63j74WFM5o+v4XXaDcdhWJtR0a0npqG6f/xxr+BxlnvFlJsSx7JlN 9h4mxffEV3VeI4kuVeq7Y2y6XwxlcQq35RAdvlUKbya0WhXMPfWIx7euf6HlGaG+67F4kpsSb swofJ/e6SXb2RDXZbEkEbBV5SzGDW4l00xwsk1FD0c4Of6bBfTTfNZ9MNdA3vpkityS0n79Ck tjGHd4Qs1sNFANcqhFBhqE0Pzief7UGosmvn9AZIe69XuomkRcRHIgfxSa62yQLwvWjJodzjU qn9tOwgJkWo4bD1q6+uz9fP9FJRICRz8zdSoF9hlnj2gxvynhYCoNtCaf43TXhBDerXnDIaAe Leua5HTs17AW/3IJALAHvogZgx673Fdld4POxR/Opqyou2ShyPne1Czh96/M81bnZXlML23ii BXVtwlQ2DQNypjpaukSY8YZMoLD5Z70tj8xKjpXFXegrP3EfOSGH0NL/ilPb4BQM/HB3ltUeG fQLlawkl+CHt+JFvZuYGwMF+5ncf0vfLO03OIFOPxDedWtI9Vvd2y2xpyNrxf/wVa9Z7isIQe Tsd+iVTi4YkPEEgqLvBf+nbgldKga5CzsZswGD1Vve4S9foCzFypNkFhj7tGk5BdDSTwjMJtL hKdvvasJ2zzxKhKFd8i2bgZJQymGF6jWtLMCJepTqHimI80WUXkHNA+83nCJ9MVHT6QZtqk+F o6bAfWz+ur9Cu0SeTURCFJyi2jh+LBvKfb6orY1hTZJE2pXhnPofA++CMYCszxMzlZac2l+ X-Rspamd-Queue-Id: 49FXt84FL3z3yNc X-Spamd-Bar: ++++ Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=none (mx1.freebsd.org: domain of freebsd@edvax.de has no SPF policy when checking 212.227.17.24) smtp.mailfrom=freebsd@edvax.de X-Spamd-Result: default: False [4.94 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; HAS_REPLYTO(0.00)[freebsd@edvax.de]; TO_DN_SOME(0.00)[]; MV_CASE(0.50)[]; HAS_ORG_HEADER(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; RECEIVED_SPAMHAUS_PBL(0.00)[107.226.5.178.khpj7ygk5idzvmvt5x4ziurxhy.zen.dq.spamhaus.net : 127.0.0.11]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; ASN(0.00)[asn:8560, ipnet:212.227.0.0/16, country:DE]; SUBJECT_ENDS_QUESTION(1.00)[]; ARC_NA(0.00)[]; REPLYTO_EQ_FROM(0.00)[]; MIME_TRACE(0.00)[0:+]; FROM_HAS_DN(0.00)[]; MIME_GOOD(-0.10)[text/plain]; RCVD_TLS_LAST(0.00)[]; DMARC_NA(0.00)[edvax.de]; AUTH_NA(1.00)[]; NEURAL_SPAM_MEDIUM(0.49)[0.486,0]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_SPAM_LONG(1.00)[0.998,0]; RCVD_IN_DNSWL_NONE(0.00)[24.17.227.212.list.dnswl.org : 127.0.5.0]; MID_CONTAINS_FROM(1.00)[]; R_SPF_NA(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; IP_SCORE(0.05)[ip: (-0.54), ipnet: 212.227.0.0/16(-1.21), asn: 8560(2.04), country: DE(-0.02)] 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:24:49 -0000 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 -- Polytropon Magdeburg, Germany Happy FreeBSD user since 4.0 Andra moi ennepe, Mousa, ...