Tag: pjl

PJL ReadBack – read response from printer

This is pretty hard to do that on USB printer connected to windows. You have to have bidirectional driver for your printer and somehow read it (there is no that option in win32 printing). There is no bidirectional windows drivers for most of printers.

It is much easier to ReadBack from printer connected to network. You can do that with simple app called PCL Paraphernalia
http://www.pclparaphernalia.eu/index.html

ReadBack from USB printer on Linux is possible! Printer is installed as a character device (you can read and write to it).

Some tips:

  • After read printer send to them ESCAPE character. If not, next send and work will not work.
    echo -e "\e" > /dev/usb/lp0
  • My printer does not respond nothing for @PJL INQUIRE *_* – no respond from printer for variables with underscore example: @PJL INQUIRE TOTALPAGE_LMT (probably total page limit) and others:
    ONLYFOR_PANEL
    TOTALPAGE_LMT
    COUNTPAGEPF1_LMT
    COUNTPAGEPFM_LMT
    A4PAGES_LMT
    LEGALPAGES_LMT
    JISB5PAGES_LMT
    A5PAGES_LMT
    A6PAGES_LMT
    MONARCPAGES_LMT
    PLAINPAGES_LMT
    THICKPAGES_LMT
    ENVELOPESPAGES_LMT
    POSTCARDPAGES_LMT
    LABELPAGES_LMT
  • You can try to check device is busy but it not work correctly. You should do the command in loop until you read more than zero length reponse (or set timeout in looop to next try)
    while true
            do
               fuser -s /dev/usb/lp0
               if [ $? -ne 0 ]
               then
                  break
               fi
    done
  • Send PJL:
    echo -e "\e%-12345X@PJL\r\n@PJL INFO ID \r\n\e%-12345X" > /dev/usb/lp0
  • Read PJL – I do not know when you should read and when the response is ready. So i try to read in loop or few cat commands, read or dd.
    #1way
    response=$(dd if=/dev/usb/lp0 of=temp.txt 2>&1)
    echo "$response"
    echo -e "\e" > /dev/usb/lp0
     
    #2way
    while IFS= read -r -n1 char
    do
     printf "$char"
    done < /dev/usb/lp0 echo -e "\e" > /dev/usb/lp0
     
    #3way
    cat /dev/usb/lp0
    echo -e "\e" > /dev/usb/lp0
  • Example script to read the printer ID:
    #!/bin/bash
     
    PRINTER=/dev/usb/lp0
    ESCAPE=$(echo -e "\e")
    FF=$(echo -e "\x0C")
    char=""
    IFS=""
    echo "" > temp.txt
     
    	while true
    	do
    		sleep 0.5
    		#WAIT FOR NOT BUSY
    		while true
    		do
    			fuser -s "$PRINTER"
    			if [ $? -ne 0 ]
    			then
    				break
    			fi
    		done
    		#send PJL to printer
    		echo -e "\e%-12345X@PJL\r\n@PJL INFO ID \r\n\e%-12345X" > "$PRINTER" 
    		#TRY TO READ IMMEDIATELY
    		char=$(dd if="$PRINTER" of=temp.txt 2>&1)
    		echo -e "\e" > "$PRINTER"
    		#CHECK THAT dd READ ANY BYTES
    		echo "$char" | grep "bytes copied" > /dev/null
    		if [ $? -ne 0 ]
    		then
    			printf "."
    		else
    			echo "$char" | grep "^0 bytes copied" > /dev/null
    			if [ $? -ne 0 ]
    			then
    				cat temp.txt
    				echo "" > temp.txt
    				break
    			else
    				printf "."
    			fi
    		fi
    		char=""
    	done

    the response:
    @PJL INFO ID
    "Brother HL-1110 series:84UE03:Ver1.08"

Brother HL-1110/1111/1112/1118 – service, toner reset, power off time, drum reset, firmware upgrade

I have prepared some PJL files. Enjoy and try create new one to other printers :)

It should work on other HL printers but you do it for your own risk.

First read: PJL – send commands to printer in RAW, BIN file

Firmware

LZ4326_E.blf – version 1.06
LZ4326_G.blf – version 1.08

Download:
http://www.mediafire.com/file/2goftr513skg44l/hl-1110-hl-1111-hl1112-firmware.zip

Firmware installation

You can send the firmware blf file directly to the printer with . I have described how to send RAW BIN files to printer: PJL – send commands to printer in RAW, BIN file

PrintFile:
http://www.lerup.com/printfile/

You can use FILEDG32.exe against PrintFile from there:
https://www.brother.com.au/pdf/support/controlcodes/PJL-SampleCommands.zip

Official firmware upgrade procedure

To flash firmware in official way you have to do it on 32bit system. Most recommended is Windows XP (you can do it on the virtual machine with redirected USB via virtualbox addons). I have found drivers for x64 but this printer works Maintenance Driver(1/3) which not works on x64.

Brother Brother Maintenance USB Port drivers:
USBPRINT\BrotherBHL2-MaintenaE3D8
BrotherBHL2-MaintenaE3D8
USB\VID_04F9&PID_0152&MI_02

Download:
http://www.helpjet.net/Fs-51291369-25569943-49736873-devices.html
or
http://www.mediafire.com/file/8bwoblgteobbpou/MaintenanceDriver.zip

There is mainteance drivers for win7 on a newer printers (both platform x64 and x86):
http://www.helpjet.net/Fs-33236229-25569943-22124897.html
or
http://www.mediafire.com/file/6bd7zrj65fgb9np/Maintenance_driver+win7.zip

On windows 8 and above you have to disable driver singing policy: Manual install drivers and disable drivers signing policy on Windows 10, 8, 8.1

First you have to switch printer to maintenance mode then install drivers and send the firmware file with FILEDG32 or PrintFile.

  1. Turn off the printer. AC power cord connected.
  2. Press and hold Power button (Ready and Error LED lit) – you can release on the step 6.
  3. While still holding open top cover.  Only Ready LED lit.
  4. Take out Drum unit, Error led lit. Put back drum unit.
  5. Close top cover. If both leds lit you can release Power button. All leds goes out (off).
  6. Hold Power button for 2 seconds until Error led lits then release. Ready led will lit.
  7. Connect USB to machine and install drivers.
  8. Send firmware file to printer called Maintenance.
  9. READY and ERROR led will blinks (that’s mean firmware is flashing – wait for finish).
  10. Done.

Toner Reset

There is a few ways.

  1. TESTED Manually set the gear in the toner cartridge:
    https://youtu.be/frV8CSEOVAA?t=1m40s
  2. TESTED Do some stuff with the printer:
    1. Turn off the printer. AC connected.
    2. Hold Power button and both: Ready (Green) and Error (Orange) LEDs lit.
    3. While still holding Power open top cover. Ready LED lit, Error off.
    4. While still holding Power take out Drum unit with toner.
    5. Both LEDs lit then release Power.
    6. Both LEDs off.
    7. Set on drum unit and close top cover
    8. Press Power twice. Error led lit.
    9. Press Power:
      1. five times to reset Starter toner
      2. six times to reset Standard toner
  3. NOT CONFIRMED the correct syntax Send PJL file with commands (i have to test it – is it command or value):
    <ESC>%-12345X@PJL
    @PJL SET SETTONER=STANDARD
    @PJL DEFAULT SETTONER=STANDARD
    @PJL EXECUTE
    @PJL SET REPLACETONER=CONTINUE
    @PJL DEFAULT REPLACETONER=CONTINUE
    <ESC>%-12345X
    Set toner to standard model and continue mode.
    Download prepared file:

Disable Power Off

To disable Power off you can change the regional setting  (probably with EXECUTE BRLOCALIZE) or just send PJL:
<ESC>%-12345X@PJL
@PJL SET POWERDOWN=HOUR8
@PJL DEFAULT POWERDOWN=HOUR8

<ESC>%-12345X
Possible values:
MIN0
MIN1
HOUR1
HOUR2
HOUR4
HOUR8

FILE: https://tosiek.pl/wp-content/uploads/2017/01/POWER-OFF.zip

Where MIN0 is Powef Off = OFF. Default for european countries is 1 hour. Turkey 4 hours.

Restore default configuration

  1. Manual method
    1. Turn off printer. AC connected.
    2. Press and hold Power button.
    3. While still holding Power open and close top cover and release power.
    4. Press power button ten times
  2. PJL send
    1. <ESC>%-12345X@PJL
      @PJL INITIALIZE
      @PJL RESET
      @PJL EXECUTE SHUTDOWN
      <ESC>%-12345X
      Download: https://tosiek.pl/wp-content/uploads/2017/01/INITIALIZE.zip

Printer zeroing

That PJL command will reset every part of printer:

  • errors log, codes
  • fuser
  • page counter, roller counter, feeder
  • toner
  • drum
  • all configuration
  • everything else

<ESC>%-12345X@PJL
@PJL EXECUTE REVIVALRESET
<ESC>%-12345X

Download: https://tosiek.pl/wp-content/uploads/2017/01/REVIVALRESET.zip

 

PJL Variables:
Documented:

@PJL INFO VARIABLESValues
COPIES=1 [2 RANGE]From 1 to 999
LPARM:PCL PAPER=A4 [4 ENUMERATED]LETTER, LEGAL, A4, FOLIO
MANUALFEED=OFF [2 ENUMERATED]OFF ON
RESOLUTION=600 [3 ENUMERATED]300, 600, 1200
TIMEOUT=5 [2 RANGE]From 1 to 99
AUTOCONT=OFF [2 ENUMERATED]OFF ON
AUTOSLEEP=ON [2 ENUMERATED]OFF ON
TIMEOUTSLEEP=1 [2 RANGE]From 0 to 210
POWERSAVE=ON [2 ENUMERATED]OFF ON
POWERSAVETIME=1 [2 RANGE]From 0 to 210
ECONOMODE=OFF [2 ENUMERATED]OFF ON
ECONOLEVEL=1 [2 RANGE]From 0 to 3
MEDIATYPE=REGULAR [2 ENUMERATED]REGULAR, RECYCLED
INTRAY2=UNLOCKED [2 ENUMERATED READONLY]UNLOCKED, LOCKED
SOURCETRAY=AUTO [2 ENUMERATED]AUTO, TRAY1
XOFFSET=0 [2 RANGE]From -500 to 500
YOFFSET=0 [2 RANGE]From -500 to 500
AUTOFF=OFF [2 ENUMERATED]OFF ON
TIMEOUTFF=5 [2 RANGE]From 1 to 99
FFSUPPRESS=OFF [2 ENUMERATED]OFF ON
DEFPAPER=A4 [2 ENUMERATED]A4, LETTER
RAS1200MODE=OFF [3 ENUMERATED]OFF, ON, TRUE
DENSITY=0 [2 RANGE]From -6 to 6
TRANSFER=AUTO [3 ENUMERATED]AUTO, LOW, HIGH
STRINGCODESET=HPROMAN8 [6 ENUMERATED]HPROMAN8, ISO88592, ISO88595, JISX02011976, ISO88599, UTF8
LESSPAPERCURL=OFF [2 ENUMERATED]OFF ON
FIXINTENSITYUP=OFF [2 ENUMERATED]OFF ON
DENSITYLEVELUP=OFF [2 ENUMERATED]OFF ON
TRANSFERLEVELUP=OFF [2 ENUMERATED]OFF ON
PCLCONPULSORYFFIGNOREMODE=OFF [2 ENUMERATED]OFF ON
HQMMODE=OFF [2 ENUMERATED]OFF ON
TRANSFERLEVEL=0 [2 RANGE]From -2 to 2

PJL documentation:

https://www.brother.com.au/pdf/support/controlcodes/PCL_Tech_Manual.pdf

GDE Error: Error retrieving file - if necessary turn off error checking (404:Not Found)

RAW PJL command list

There is a list of commands and special values (constants, other values could be alphanumerical) . Most of them aren’t exist in official documentation BUT WORKS, be carefull. Continue reading

PJL – send commands to printer in RAW, BIN file

Printer Job Language (PJL) – that’s a script language to communicate with printer. Every manufacturer has its own commands. There is a few standarized KERNEL commands.

I will describe how to send commands to printer in Windows. I will write all examples based on brother printers because HP has better documentation.

You can include PCL and other languages in PJL files. Just use ENTER PJL command with supported language.

Special characters – you can write it with ALT + CODE where code for <ESC> is 27. If you do not have numpad you should use hex editor like HxD. You can’t send literally <ESC> it has to be 1B in binary hex. In notepad++ it should be like:

LF and CR is just enter in text editor (check editor settings!). In PJL use always: <CR><LF> because printers should ignore all that can’t recognize (f.ex. CR – windows end line).

<HT>Horizontal Tab
ASCII 9 HEX 09
ALT + 9
<LF>Line Feed
ASCII 10 HEX 0A
ALT + 10 or Enter
<CR>Carirage Return
ASCII 13 HEX 0D
ALT + 13 or Enter
<SP>Space
ASCII 32 HEX 20
ALT + 32 or Space
<ESC>Escape
ASCII 27 HEX 1B
ALT + 27
<FF>Form Feed
ASCII 12 HEX 0C
ALT+12
<WS>White Spaceadd some spaces or horizontal tabs with the CRLF at the end of line

There is a bin file with these characters: pjl-chars

PJL Info

To run PJL commands you have to prepare file and send it in RAW format to printer. Use only capital letters. You can edit it with Notepad++. For HEX editint use HxD.

Universal format for example PJL:
<ESC>%-12345X@PJL
@PJL EXECUTE command
<ESC>%-12345X
Bin RAW download example: pjl-example

Test PJL Support

You can test that your printer support PJL. Send to the printer:
<ESC>%-12345X@PJL
@PJL EXECUTE MAINTENANCEPRINT
@PJL EXECUTE TESTPRINT
@PJL EXECUTE DEMOPAGE
@PJL EXECUTE RESIFONT
@PJL EXECUTE PERMFONT
@PJL EXECUTE PRTCONFIG
<ESC>%-12345X

Download test: test-pjl

Printer should print some test pages.
If print %-12345X@PJL[...] you have send it in wrong way! (as text no RAW binary file)

Run PJL on Local Printer

To send RAW file to local printer connected via USB, LPT you can use freeware program: PrintFile
http://www.lerup.com/printfile/

Works on x64 and x86 windows (Windows 10 too).

  1. Download and install
  2. Run PrintFile as admin
  3. Click Settings, choose on the bottom your printer and click Save
  4. Click PrintFile and choose your prepared file. The receiving LED or LCD should say Rece3iving Data (for one second if it is small file).

Run PJL on Network or Local Printer

First run CMD as admin. Change directory to directory with pjl files. Disable firewall for a while.

If your printer is local (USB or LPT) you can make it Network by just sharing the Printer in Windows (set simple name – one word). Then you can run commands to send PJL RAW files in CMD:
copy /b test.pjl  \\%COMPUTERNAME%\PrinterSharedName
or
type test.pjl > \\%COMPUTERNAME%\PrinterSharedName

You can map network printer to LPT port if you need:
NET USE LPT1: \\%COMPUTERNAME%\PrinterSharedName
persistent:
NET USE LPT1: \\%COMPUTERNAME%\PrinterSharedName /PERSISTENT:YES

If you will install  in windows additions (Programs and functions) LPR and LPD service you can use:
lpr -S %COMPUTERNAME% -P PrinterSharedName "-o l" test.pjl
or to the network printer (check the printer working with RAW or something else):
lpr -S 192.168.1.x -P raw "-o l" test.pjl

Receive the response

I do not know how to receive response PJL. I can’t read any output.
There is post how to read PJL responses from printer connected to USB and network devices:PJL ReadBack – read response from printer
For example command:
<ESC>%-12345X@PJL <CR><LF>
@PJL INFO ID <CR><LF>
<ESC>%-12345X
printer should response something like:
<ESC>%-12345X@PJL <CR><LF>
@PJL INFO ID <CR><LF>
ID=Brother HL-1660e
<ESC>%-12345X

 

PJL Documentations:
Brother:
https://www.brother.com.au/pdf/support/controlcodes/PCL_Tech_Manual.pdf

GDE Error: Error retrieving file - if necessary turn off error checking (404:Not Found)

HP:
http://h10032.www1.hp.com/ctg/Manual/bpl13208.pdf

Download (PDF, 2.86MB)