CAPS Universe documentation  1.0.4
All you need to know to be successful
Brother HL Laser Printer Driver Development

Testing New Printers

If your own printer device is in the list of known, but not supported devices, please provide the following information:

  • USB Device ID
  • 1284DeviceID

The USB device ID can be retrieved with the lsusb command.

The 1284DeviceID can be retrieved from the file /sys/class/printer/FIXME

TODO Which file must be adapted. TODO How to check if the driver gets activated on printer plug in

Adding a new Printer

Files to add:

  • The printer device specific INI template:
    • src/hl<number>/caps-brother-HL<your-printer>-driver.ini.in

Files to modify:

  • Makefile.am
    • Add the new INI template file to the list of files in variable EXTRA_DIST
  • configure.ac
    • Let AC_CONFIG_FILES() create the INI file from the template by adding it like the other INI files
  • Makefile.am
    • Add the created INI file to the list of files in variable driverdatabase_DATA
  • src/caps-driver-brlaser.h
    • Add a new enum for your printer into #hl_printers
  • src/brother-hl<number>.c
    • Add the new string into the #hl_supported_printers array and use your new enum

Known PJL variables

Saving Energy

Via Printer Job Language (PJL) some energy related settings can be made:

  • POWERSAVE Can be ON or OFF
  • POWERSAVETIME If POWERSAVE is ON this variable defines the time in minutes the printer enters an energy save state when idle.
  • AUTOSLEEP Can be ON or OFF
  • TIMEOUTSLEEP If AUTOSLEEP is ON this variable define the time in minutes the printer enters sleep state when idle.

An active printer consumes 460 W, an idling printer 80 W and a sleeping printer consumes 5 W (according the HL-2140 datasheet).

Refer Printer Job Language Reference for further details of these variables.

Saving Toner

It is possible to save toner by reducing the amount of toner using to print a page. This is a per print job setting.

Some printers have only two levels for the amount of toner, some other have four levels.

The PJL related variable is ECONOMODE. Refer Printer Job Language Reference for further details.

Todo:
Relation of POWERSAVE and AUTOSLEEP to active, idling and sleep.

Printer Job Language Reference

The following list of PJL variables are found in the printers.

Since the USB interface is bidirectional, it is possible to "ask" the printer about known PJL variables by sending it the following command:

   ESC%-12345X@PJL
   @PJL COMMENT the INFO VARIABLES command
   @PJL INFO VARIABLES
   ESC%-12345X

Reading back from the printer's device node gives the following result:

  @PJL INFO VARIABLES
  COPIES=1 [2 RANGE]
          1
          999
  LPARM:PCL PAPER=A4 [17 ENUMERATED]
          LETTER
          LEGAL
          A4
          EXECUTIVE
          COM10
          MONARCH
          C5
          DL
          DLL
          B5
          A5
          A6
          B6
          JISB5
          A4LONG
          POSTCARD
          FOLIO
  MANUALFEED=OFF [2 ENUMERATED]
          OFF
          ON
  PAGEPROTECT=AUTO [5 ENUMERATED]
          OFF
          LETTER
          LEGAL
          A4
          AUTO
  RESOLUTION=600 [3 ENUMERATED]
          300
          600
          1200
  TIMEOUT=5 [2 RANGE]
          1
          99
  AUTOCONT=OFF [2 ENUMERATED]
          OFF
          ON
  CPLOCK=OFF [2 ENUMERATED]
          OFF
          ON
  PASSWORD=DISABLED [2 RANGE]
          0
          65535
  LANG=GERMAN [19 ENUMERATED]
          ENGLISH
          FRENCH
          GERMAN
          DUTCH
          SPANISH
          ITALIAN
          FINNISH
          NORWEGIAN
          PORTUGUESE
          DANISH
          JAPANESE
          SWEDISH
          RUSSIAN
          CZECH
          HUNGARIAN
          POLISH
          BULGARIAN
          ROMANIAN
          SLOVAKIAN
  AUTOSLEEP=ON [2 ENUMERATED]
          OFF
          ON
  TIMEOUTSLEEP=2 [2 RANGE]
          1
          99
  POWERSAVE=ON [2 ENUMERATED]
          OFF
          ON
  POWERSAVETIME=2 [2 RANGE]
          1
          99
  ECONOMODE=OFF [2 ENUMERATED]
          OFF
          ON
  ECONOLEVEL=1 [2 RANGE]
          0
          3
  MEDIATYPE=REGULAR [10 ENUMERATED]
          REGULAR
          THICK
          THICK2
          TRANSPARENCY
          THIN
          BOND
          ENVELOPES
          ENVTHICK
          ENVTHIN
          RECYCLED
  IMAGEADAPT=ON [3 ENUMERATED]
          OFF
          ON
          AUTO
  INTRAY2=UNLOCKED [2 ENUMERATED READONLY]
          UNLOCKED
          LOCKED
  SOURCETRAY=AUTO [2 ENUMERATED]
          AUTO
          TRAY1
  XOFFSET=0 [2 RANGE]
          -500
          500
  YOFFSET=0 [2 RANGE]
          -500
          500
  AUTOFF=OFF [2 ENUMERATED]
          OFF
          ON
  TIMEOUTFF=5 [2 RANGE]
          1
          99
  FFSUPPRESS=OFF [2 ENUMERATED]
          OFF
          ON
  DEMOPRINT=OFF [2 ENUMERATED]
          OFF
          ON
  DEFPAPER=A4 [2 ENUMERATED]
          A4
          LETTER
  HPESCE=RESET [2 ENUMERATED]
          RESET
          FF
  PROTECTOFF=AUTO [2 ENUMERATED]
          AUTO
          NORMAL
  RAS1200MODE=OFF [3 ENUMERATED]
          OFF
          ON
          TRUE
  DENSITY=0 [2 RANGE]
          -6
          6
  TRANSFER=AUTO [3 ENUMERATED]
          AUTO
          LOW
          HIGH
  DOUBLESTRIKE=OFF [2 ENUMERATED]
          OFF
          ON
  ERRORPRINT=ON [3 ENUMERATED]
          OFF
          ON
          EXCEPTCDCC
  DEMOLANG=ENGLISH [8 ENUMERATED]
          ENGLISH
          USA
          CANADA
          FRENCHDUTCH
          GERMANFRENCH
          SPANISHPORTUGUESE
          ITALIAN
          NORDIC
  STRINGCODESET=HPROMAN8 [4 ENUMERATED]
          HPROMAN8
          ISO88592
          ISO88595
          JISX02011976
  LESSPAPERCURL=OFF [2 ENUMERATED]
          OFF
          ON
  FIXINTENSITYUP=OFF [2 ENUMERATED]
          OFF
          ON
  DENSITYLEVELUP=OFF [2 ENUMERATED]
          OFF
          ON

Printer Data Encoders

The image data must be encoded to send it to the printer. Different encoding methods are supported and can be used.

  • Encoding method 3
  • Encoding method 1027
  • Encoding method 1030

They are named according to their used numbers in the encoded data stream. For example the 1030 encoding method starts its data with a leading *b1030m and a trailing 1030M\f character pattern.

All three methods share the behaviour to detect specific pattern in the input image data on a line by line base and based on that, encode (and maybe reduce its size) the data for the line prior sending it to the printer. They also share the behaviour to "construct" each line with the help of the previous line content: if the previous line and the current line match (even only partially) the encoding supports to re-use parts of the previous line for the current line.

You can describe this process by editing the current line byte by byte at the printer to contruct it with parts from the previous line, repeating some pattern or replacing some parts by new (and uncompressed) data.

That is why the encoded data is a stream of 'edits'.

List of known encodings Brother's printer (may) handle.

This list is imperfect, but may give you some insights about available methods.

The information is extracted from the "Brother Technical Reference Guide (Ver AC. March 2018, Page 412)"

Possible encoding method values via the Set Compression Mode (e.g. "ESC*b…M") command:

  • 0: no compression
  • 1: RLE
  • 2: TIFF
  • 3: Delta-Row (page 91)
  • 5: Adaptive Compression (page 91)
  • 9: Mode 9 Compression (page 92)
  • 1024: TIFF 5.0 (@600 DPI), this includes CCIT G3/G3
  • 1025: Brother original Compression Method
  • 1026: Brother Advanced Data Transfer Mode
  • 1027: horizontal 1200 DPI image format (page 98, section 6.3.13)
  • 1028:
  • 1030: (used here, page 422)
  • 1032: (page 422)
  • 1152: CCIT G3/G4
  • 2010: (page 422)
  • 2048:
  • 2049:
Note
The methods 0…9 seem ordinary PCL encoding methods.