mirror of
https://github.com/pdewacht/brlaser
synced 2025-04-17 08:46:44 +02:00
Compare commits
No commits in common. "master" and "v4" have entirely different histories.
39
.github/workflows/build.yml
vendored
39
.github/workflows/build.yml
vendored
@ -1,39 +0,0 @@
|
|||||||
name: build
|
|
||||||
on: [ push, pull_request ]
|
|
||||||
jobs:
|
|
||||||
linux:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
compiler: [ clang++, gcc++ ]
|
|
||||||
steps:
|
|
||||||
- name: Add repository
|
|
||||||
run: sudo apt-add-repository -y "ppa:ubuntu-toolchain-r/test"
|
|
||||||
- name: Install packages
|
|
||||||
run: sudo apt install libcups2-dev
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
- name: Configure
|
|
||||||
run: cmake .
|
|
||||||
- name: Make
|
|
||||||
run: make
|
|
||||||
env:
|
|
||||||
CXX: ${{ matrix.compiler }}
|
|
||||||
- name: Run tests
|
|
||||||
run: make check
|
|
||||||
macos:
|
|
||||||
runs-on: macos-latest
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
compiler: [ clang++, gcc++ ]
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
- name: Configure
|
|
||||||
run: cmake .
|
|
||||||
- name: Make
|
|
||||||
run: make
|
|
||||||
env:
|
|
||||||
CXX: ${{ matrix.compiler }}
|
|
||||||
- name: Run tests
|
|
||||||
run: make check
|
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,2 +1 @@
|
|||||||
*~
|
|
||||||
build/
|
build/
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
cmake_minimum_required(VERSION 3.1)
|
cmake_minimum_required(VERSION 3.1)
|
||||||
project(brlaser CXX)
|
project(brlaser CXX)
|
||||||
set(BRLASER_VERSION "6")
|
set(BRLASER_VERSION "4")
|
||||||
|
|
||||||
if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
||||||
message(STATUS "No build type selected, default to RelWithDebInfo")
|
message(STATUS "No build type selected, default to RelWithDebInfo")
|
||||||
@ -39,11 +39,10 @@ endmacro(extra_cxx_compiler_flag)
|
|||||||
# Compiler warnings
|
# Compiler warnings
|
||||||
extra_cxx_compiler_flag("-Wall")
|
extra_cxx_compiler_flag("-Wall")
|
||||||
extra_cxx_compiler_flag("-Wno-missing-braces")
|
extra_cxx_compiler_flag("-Wno-missing-braces")
|
||||||
extra_cxx_compiler_flag("-Wdate-time")
|
# Some security flags
|
||||||
# Some hardening flags
|
|
||||||
extra_cxx_compiler_flag("-fstack-protector-strong")
|
extra_cxx_compiler_flag("-fstack-protector-strong")
|
||||||
extra_cxx_compiler_flag("-Wformat")
|
extra_cxx_compiler_flag("-Wformat")
|
||||||
extra_cxx_compiler_flag("-Wformat -Werror=format-security")
|
extra_cxx_compiler_flag("-Werror=format-security")
|
||||||
extra_cxx_compiler_flag("-D_FORTIFY_SOURCE=2")
|
extra_cxx_compiler_flag("-D_FORTIFY_SOURCE=2")
|
||||||
# Enable the supported flags, but give priority to CXXFLAGS env var
|
# Enable the supported flags, but give priority to CXXFLAGS env var
|
||||||
set(CMAKE_CXX_FLAGS "${EXTRA_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
|
set(CMAKE_CXX_FLAGS "${EXTRA_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
|
||||||
@ -113,21 +112,19 @@ target_compile_options(rastertobrlaser PRIVATE ${CUPS_CFLAGS})
|
|||||||
target_link_libraries(rastertobrlaser ${CUPS_LIBS})
|
target_link_libraries(rastertobrlaser ${CUPS_LIBS})
|
||||||
target_link_libraries(rastertobrlaser ${CUPS_LDFLAGS})
|
target_link_libraries(rastertobrlaser ${CUPS_LDFLAGS})
|
||||||
|
|
||||||
add_executable(brdecode EXCLUDE_FROM_ALL src/brdecode.cc)
|
add_executable(brdecode src/brdecode.cc)
|
||||||
add_executable(test_lest test/test_lest.cc)
|
add_executable(test_lest test/test_lest.cc)
|
||||||
add_executable(test_line test/test_line.cc src/line.cc)
|
add_executable(test_line test/test_line.cc src/line.cc)
|
||||||
add_executable(test_block test/test_block.cc)
|
add_executable(test_block test/test_block.cc)
|
||||||
add_executable(test_job test/test_job.cc src/job.cc src/line.cc)
|
|
||||||
|
|
||||||
enable_testing()
|
enable_testing()
|
||||||
add_test(test_lest test_lest)
|
add_test(test_lest test_lest)
|
||||||
add_test(test_line test_line)
|
add_test(test_line test_line)
|
||||||
add_test(test_block test_block)
|
add_test(test_block test_block)
|
||||||
add_test(test_job test_job)
|
|
||||||
|
|
||||||
# Autotools-style "make check" command
|
# Autotools-style "make check" command
|
||||||
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND})
|
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND})
|
||||||
add_dependencies(check test_lest test_line test_block test_job)
|
add_dependencies(check test_lest test_line test_block)
|
||||||
|
|
||||||
|
|
||||||
# Installation
|
# Installation
|
||||||
|
@ -1,12 +1,3 @@
|
|||||||
brlaser v6 (2019-09-22)
|
|
||||||
Added support for some more Brother HL-series printers. These printers
|
|
||||||
had glitched output in earlier releases.
|
|
||||||
|
|
||||||
brlaser v5 (2019-05-18)
|
|
||||||
Fixed problems with Brother HL-series printers in 600 dpi mode. Thanks
|
|
||||||
to Onno Kortmann for the fix.
|
|
||||||
Added several printers.
|
|
||||||
|
|
||||||
brlaser v4 (2018-02-25)
|
brlaser v4 (2018-02-25)
|
||||||
Added several printers.
|
Added several printers.
|
||||||
Merged duplex printing support from @xc-racer99. Enabled for DCP-7065DN.
|
Merged duplex printing support from @xc-racer99. Enabled for DCP-7065DN.
|
||||||
|
36
README.md
36
README.md
@ -8,43 +8,16 @@ such as PCL or PostScript, not all do. If you have a monochrome
|
|||||||
Brother laser printer (or multi-function device) and the other open
|
Brother laser printer (or multi-function device) and the other open
|
||||||
source drivers don't work, this one might help.
|
source drivers don't work, this one might help.
|
||||||
|
|
||||||
This driver has been reported to work with these printers:
|
This driver is known to work with these printers:
|
||||||
|
|
||||||
* Brother DCP-1510 series
|
* Brother DCP-1510
|
||||||
* Brother DCP-1600 series
|
|
||||||
* Brother DCP-7030
|
* Brother DCP-7030
|
||||||
* Brother DCP-7040
|
* Brother DCP-7040
|
||||||
* Brother DCP-7055
|
* Brother DCP-7055
|
||||||
* Brother DCP-7055W
|
* Brother DCP-7055W
|
||||||
* Brother DCP-7060D
|
|
||||||
* Brother DCP-7065DN
|
* Brother DCP-7065DN
|
||||||
* Brother DCP-7080
|
* Brother HL-L2300D
|
||||||
* Brother DCP-L2500D series
|
|
||||||
* Brother DCP-L2520D series
|
|
||||||
* Brother DCP-L2520DW series
|
|
||||||
* Brother DCP-L2540DW series
|
|
||||||
* Brother HL-1110 series
|
|
||||||
* Brother HL-1200 series
|
|
||||||
* Brother HL-2030 series
|
|
||||||
* Brother HL-2140 series
|
|
||||||
* Brother HL-2220 series
|
|
||||||
* Brother HL-2270DW series
|
|
||||||
* Brother HL-5030 series
|
|
||||||
* Brother HL-L2300D series
|
|
||||||
* Brother HL-L2320D series
|
|
||||||
* Brother HL-L2340D series
|
|
||||||
* Brother HL-L2360D series
|
|
||||||
* Brother HL-L2375DW series
|
|
||||||
* Brother HL-L2390DW
|
|
||||||
* Brother MFC-1910W
|
|
||||||
* Brother MFC-7240
|
|
||||||
* Brother MFC-7360N
|
* Brother MFC-7360N
|
||||||
* Brother MFC-7365DN
|
|
||||||
* Brother MFC-7420
|
|
||||||
* Brother MFC-7460DN
|
|
||||||
* Brother MFC-7840W
|
|
||||||
* Brother MFC-L2710DW series
|
|
||||||
* Lenovo M7605D
|
|
||||||
|
|
||||||
|
|
||||||
Other printers
|
Other printers
|
||||||
@ -65,8 +38,7 @@ Installation
|
|||||||
------------
|
------------
|
||||||
|
|
||||||
Some operating systems already ship this driver. This is the case for
|
Some operating systems already ship this driver. This is the case for
|
||||||
at least Debian, Gentoo, Ubuntu, Raspbian, openSUSE, NixOS, Arch Linux
|
at least Debian, Ubuntu, Raspbian, openSUSE, NixOS and Arch Linux.
|
||||||
and Guix.
|
|
||||||
Look for a package named `printer-driver-brlaser`.
|
Look for a package named `printer-driver-brlaser`.
|
||||||
|
|
||||||
You'll also need Ghostscript, in case that's not installed
|
You'll also need Ghostscript, in case that's not installed
|
||||||
|
205
brlaser.drv.in
205
brlaser.drv.in
@ -87,13 +87,6 @@ Option "brlaserEconomode/Toner save mode" Boolean AnySetup 10
|
|||||||
PCFileName "br1510.ppd"
|
PCFileName "br1510.ppd"
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
|
||||||
ModelName "DCP-1600 series"
|
|
||||||
Attribute "NickName" "" "Brother DCP-1600 series, $USING"
|
|
||||||
Attribute "1284DeviceID" "" "MFG:Brother;CMD:PJL,XL2HB;MDL:DCP-1600 series;CLS:PRINTER;CID:Brother Laser Type1;"
|
|
||||||
PCFileName "br1600.ppd"
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
ModelName "DCP-7030"
|
ModelName "DCP-7030"
|
||||||
Attribute "NickName" "" "Brother DCP-7030, $USING"
|
Attribute "NickName" "" "Brother DCP-7030, $USING"
|
||||||
@ -126,14 +119,6 @@ Option "brlaserEconomode/Toner save mode" Boolean AnySetup 10
|
|||||||
PCFileName "br7055w.ppd"
|
PCFileName "br7055w.ppd"
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
|
||||||
ModelName "DCP-7060D"
|
|
||||||
Attribute "NickName" "" "Brother DCP-7060D, $USING"
|
|
||||||
Attribute "1284DeviceID" "" "MFG:Brother;CMD:PJL,HBP;MDL:DCP-7060D;CLS:PRINTER;CID:Brother Laser Type1;"
|
|
||||||
Duplex rotated
|
|
||||||
PCFileName "br7060d.ppd"
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
ModelName "DCP-7065DN"
|
ModelName "DCP-7065DN"
|
||||||
Attribute "NickName" "" "Brother DCP-7065DN, $USING"
|
Attribute "NickName" "" "Brother DCP-7065DN, $USING"
|
||||||
@ -142,203 +127,17 @@ Option "brlaserEconomode/Toner save mode" Boolean AnySetup 10
|
|||||||
PCFileName "br7065dn.ppd"
|
PCFileName "br7065dn.ppd"
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
|
||||||
ModelName "DCP-7080"
|
|
||||||
Attribute "NickName" "" "Brother DCP-7080, $USING"
|
|
||||||
Attribute "1284DeviceID" "" "MFG:Brother;CMD:PJL,HBP;MDL:DCP-7080;CLS:PRINTER;CID:Brother Laser Type1;"
|
|
||||||
PCFileName "br7080.ppd"
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
ModelName "DCP-7080D"
|
|
||||||
Attribute "NickName" "" "Brother DCP-7080D, $USING"
|
|
||||||
Attribute "1284DeviceID" "" "MFG:Brother;CMD:PJL,HBP;MDL:DCP-7080D;CLS:PRINTER;CID:Brother Laser Type1;"
|
|
||||||
Duplex rotated
|
|
||||||
PCFileName "br7080d.ppd"
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
ModelName "DCP-L2500D"
|
|
||||||
Attribute "NickName" "" "Brother DCP-L2500D series, $USING"
|
|
||||||
Attribute "1284DeviceID" "" "MFG:Brother;CMD:PJL,HBP;MDL:DCP-L2500D series;CLS:PRINTER;CID:Brother Laser Type1;"
|
|
||||||
Duplex rotated
|
|
||||||
PCFileName "brl2500d.ppd"
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
ModelName "DCP-L2520D"
|
|
||||||
Attribute "NickName" "" "Brother DCP-L2520D series, $USING"
|
|
||||||
Attribute "1284DeviceID" "" "MFG:Brother;CMD:PJL,HBP;MDL:DCP-L2520D series;CLS:PRINTER;CID:Brother Laser Type1;"
|
|
||||||
Duplex rotated
|
|
||||||
PCFileName "brl2520d.ppd"
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
ModelName "DCP-L2520DW"
|
|
||||||
Attribute "NickName" "" "Brother DCP-L2520DW series, $USING"
|
|
||||||
Attribute "1284DeviceID" "" "MFG:Brother;CMD:PJL,HBP;MDL:DCP-L2520DW series;CLS:PRINTER;CID:Brother Laser Type1;"
|
|
||||||
Duplex rotated
|
|
||||||
PCFileName "brl2520dw.ppd"
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
ModelName "DCP-L2540DW"
|
|
||||||
Attribute "NickName" "" "Brother DCP-L2540DW series, $USING"
|
|
||||||
Attribute "1284DeviceID" "" "MFG:Brother;CMD:PJL,HBP;MDL:DCP-L2540DW series;CLS:PRINTER;CID:Brother Laser Type1;"
|
|
||||||
Duplex rotated
|
|
||||||
PCFileName "brl2540.ppd"
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
ModelName "HL-1110"
|
|
||||||
Attribute "NickName" "" "Brother HL-1110 series, $USING"
|
|
||||||
Attribute "1284DeviceID" "" "MFG:Brother;CMD:PJL,HBP;MDL:HL-1110 series;CLS:PRINTER;CID:Brother Laser Type3;"
|
|
||||||
Resolution k 1 0 0 0 "300dpi/300 DPI"
|
|
||||||
PCFileName "br1110.ppd"
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
ModelName "HL-1200"
|
|
||||||
Attribute "NickName" "" "Brother HL-1200 series, $USING"
|
|
||||||
Attribute "1284DeviceID" "" "MFG:Brother;CMD:PJL,HBP;MDL:HL-1200 series;CLS:PRINTER;CID:Brother Laser Type3;"
|
|
||||||
PCFileName "br1200.ppd"
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
ModelName "HL-2030 series"
|
|
||||||
Attribute "NickName" "" "Brother HL-2030 series, $USING"
|
|
||||||
Attribute "1284DeviceID" "" "MFG:Brother;CMD:PJL,HBP;MDL:HL-2030 series;CLS:PRINTER;"
|
|
||||||
PCFileName "br2030.ppd"
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
ModelName "HL-2140 series"
|
|
||||||
Attribute "NickName" "" "Brother HL-2140 series, $USING"
|
|
||||||
Attribute "1284DeviceID" "" "MFG:Brother;CMD:PJL,HBP;MDL:HL-2140 series;CLS:PRINTER;"
|
|
||||||
PCFileName "br2140.ppd"
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
ModelName "HL-2220 series"
|
|
||||||
Attribute "NickName" "" "Brother HL-2220 series, $USING"
|
|
||||||
Attribute "1284DeviceID" "" "MFG:Brother;CMD:PJL,HBP;MDL:HL-2220 series;CLS:PRINTER;"
|
|
||||||
PCFileName "br2220.ppd"
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
ModelName "HL-2270DW series"
|
|
||||||
Attribute "NickName" "" "Brother HL-2270DW series, $USING"
|
|
||||||
Attribute "1284DeviceID" "" "MFG:Brother;CMD:PJL,PCL,PCLXL;MDL:HL-2270DW series;CLS:PRINTER;CID:Brother Laser Type1;"
|
|
||||||
Resolution k 1 0 0 0 "300dpi/300 DPI"
|
|
||||||
Duplex rotated
|
|
||||||
PCFileName "br2270dw.ppd"
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
ModelName "HL-5030 series"
|
|
||||||
Attribute "NickName" "" "Brother HL-5030 series, $USING"
|
|
||||||
Attribute "1284DeviceID" "" "MFG:Brother;CMD:PJL,PCL;MDL:HL-5030 series;CLS:PRINTER;"
|
|
||||||
PCFileName "br5030.ppd"
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
ModelName "HL-L2300D"
|
ModelName "HL-L2300D"
|
||||||
Attribute "NickName" "" "Brother HL-L2300D series, $USING"
|
Attribute "NickName" "" "Brother HL-L2300D, $USING"
|
||||||
Attribute "1284DeviceID" "" "MFG:Brother;CMD:PJL,HBP;MDL:HL-L2300D series;CLS:PRINTER;CID:Brother Laser Type1;"
|
Attribute "1284DeviceID" "" " MFG:Brother;CMD:PJL,HBP;MDL:HL-L2300D series;CLS:PRINTER;CID:Brother Laser Type1;"
|
||||||
Duplex rotated
|
Duplex rotated
|
||||||
PCFileName "brl2300d.ppd"
|
PCFileName "brl2300d.ppd"
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
|
||||||
ModelName "HL-L2320D"
|
|
||||||
Attribute "NickName" "" "Brother HL-L2320D series, $USING"
|
|
||||||
Attribute "1284DeviceID" "" "MFG:Brother;CMD:PJL,HBP;MDL:HL-L2320D series;CLS:PRINTER;CID:Brother Laser Type1;"
|
|
||||||
Duplex rotated
|
|
||||||
PCFileName "brl2320d.ppd"
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
ModelName "HL-L2340D"
|
|
||||||
Attribute "NickName" "" "Brother HL-L2340D series, $USING"
|
|
||||||
Attribute "1284DeviceID" "" "MFG:Brother;CMD:PJL,HBP,URF;MDL:HL-L2340D series;CLS:PRINTER;CID:Brother Laser Type1;URF:W8,CP1,IS4-1,MT1-3-4-5-8,OB10,PQ4,RS300-600,V1.3,DM1;"
|
|
||||||
Duplex rotated
|
|
||||||
PCFileName "brl2340d.ppd"
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
ModelName "HL-L2360D"
|
|
||||||
Attribute "NickName" "" "Brother HL-L2360D series, $USING"
|
|
||||||
Attribute "1284DeviceID" "" "MFG:Brother;CMD:PJL,PCL,PCLXL,URF;MDL:HL-L2360D series;CLS:PRINTER;CID:Brother Laser Type1;URF:W8,CP1,IS4-1,MT1-3-4-5-8,OB10,PQ4,RS300-600,V1.3,DM1;"
|
|
||||||
Duplex rotated
|
|
||||||
PCFileName "brl2360d.ppd"
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
ModelName "HL-L2375DW"
|
|
||||||
Attribute "NickName" "" "Brother HL-L2375DW series, $USING"
|
|
||||||
Attribute "1284DeviceID" "" "MFG:Brother;CMD:PJL,PCL,PCLXL,URF;MDL:HL-L2375DW series;CLS:PRINTER;CID:Brother Laser Type1;URF:W8,CP1,IS4-1,MT1-3-4-5-8,OB10,PQ3-4-5,RS300-600-1200,V1.4,DM1;"
|
|
||||||
Duplex rotated
|
|
||||||
PCFileName "brl2375w.ppd"
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
ModelName "HL-L2390DW"
|
|
||||||
Attribute "NickName" "" "Brother HL-L2390DW, $USING"
|
|
||||||
Attribute "1284DeviceID" "" "MFG:Brother;CMD:PJL,HBP,URF;MDL:HL-L2390DW;CLS:PRINTER;CID:Brother Laser Type1;URF:W8,CP1,IS4-1,MT1-3-4-5-8,OB10,PQ3-4-5,RS300-600-1200,V1.4,DM1;"
|
|
||||||
Duplex rotated
|
|
||||||
PCFileName "brl2390w.ppd"
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
ModelName "MFC-1910W"
|
|
||||||
Attribute "NickName" "" "Brother MFC-1910W, $USING"
|
|
||||||
Attribute "1284DeviceID" "" "MFG:Brother;MFG:Brother;CMD:PJL,HBP;MDL:MFC-1910W series;CLS:PRINTER;CID:Brother Laser Type1;"
|
|
||||||
PCFileName "br1910w.ppd"
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
ModelName "MFC-7240"
|
|
||||||
Attribute "NickName" "" "Brother MFC-7240, $USING"
|
|
||||||
Attribute "1284DeviceID" "" "MFG:Brother;MFG:Brother;CMD:PJL,HBP;MDL:MFC-7240;CLS:PRINTER;CID:Brother Laser Type1;"
|
|
||||||
PCFileName "br7240.ppd"
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
ModelName "MFC-7360N"
|
ModelName "MFC-7360N"
|
||||||
Attribute "NickName" "" "Brother MFC-7360N, $USING"
|
Attribute "NickName" "" "Brother MFC-7360N, $USING"
|
||||||
Attribute "1284DeviceID" "" "MFG:Brother;CMD:PJL,HBP;MDL:MFC-7360N;CLS:PRINTER;CID:Brother Laser Type1;"
|
Attribute "1284DeviceID" "" "MFG:Brother;CMD:PJL,HBP;MDL:MFC-7360N;CLS:PRINTER;CID:Brother Laser Type1;"
|
||||||
PCFileName "br7360n.ppd"
|
PCFileName "br7360n.ppd"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
{
|
|
||||||
ModelName "MFC-7365DN"
|
|
||||||
Attribute "NickName" "" "Brother MFC-7365DN, $USING"
|
|
||||||
Attribute "1284DeviceID" "" "MFG:Brother;CMD:PJL,HBP;MDL:MFC-7365DN;CLS:PRINTER;CID:Brother Laser Type1;"
|
|
||||||
Resolution k 1 0 0 0 "300dpi/300 DPI"
|
|
||||||
Duplex rotated
|
|
||||||
PCFileName "br7365dn.ppd"
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
ModelName "MFC-7420"
|
|
||||||
Attribute "NickName" "" "Brother Brother MFC-7420, $USING"
|
|
||||||
Attribute "1284DeviceID" "" "MFG:Brother;CMD:PJL,HBP;MDL:MFC-7420;CLS:PRINTER;"
|
|
||||||
PCFileName "br7420.ppd"
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
ModelName "MFC-7460DN"
|
|
||||||
Attribute "NickName" "" "Brother MFC-7460DN, $USING"
|
|
||||||
Attribute "1284DeviceID" "" "MFG:Brother;CMD:PJL,HBP;MDL:MFC-7460DN;CLS:PRINTER;CID:Brother Laser Type1;"
|
|
||||||
Duplex rotated
|
|
||||||
PCFileName "br7460dn.ppd"
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
ModelName "MFC-L2710DW series"
|
|
||||||
Attribute "NickName" "" "Brother MFC-L2710DW series, $USING"
|
|
||||||
Attribute "1284DeviceID" "" "MFG:Brother;CMD:PJL,HBP,URF;MDL:MFC-L2710DW series;CLS:PRINTER;CID:Brother Laser Type1;URF:W8,CP1,IS4-1,MT1-3-4-5-8,OB10,PQ3-4-5,RS300-600-1200,V1.4,DM1;"
|
|
||||||
Duplex rotated
|
|
||||||
PCFileName "brl2710.ppd"
|
|
||||||
}
|
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
class block {
|
class block {
|
||||||
public:
|
public:
|
||||||
block(): line_bytes_(0) {
|
block(): line_bytes_(0) {
|
||||||
|
lines_.reserve(max_lines_per_block_);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool empty() const {
|
bool empty() const {
|
||||||
@ -39,7 +40,8 @@ class block {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool line_fits(unsigned size) {
|
bool line_fits(unsigned size) {
|
||||||
return line_bytes_ + size < max_block_size_;
|
return lines_.size() != max_lines_per_block_
|
||||||
|
&& line_bytes_ + size < max_block_size_;
|
||||||
}
|
}
|
||||||
|
|
||||||
void flush(FILE *f) {
|
void flush(FILE *f) {
|
||||||
@ -57,6 +59,7 @@ class block {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
static const unsigned max_block_size_ = 16350;
|
static const unsigned max_block_size_ = 16350;
|
||||||
|
static const unsigned max_lines_per_block_ = 128;
|
||||||
|
|
||||||
std::vector<std::vector<uint8_t>> lines_;
|
std::vector<std::vector<uint8_t>> lines_;
|
||||||
int line_bytes_;
|
int line_bytes_;
|
||||||
|
28
src/job.cc
28
src/job.cc
@ -26,18 +26,17 @@
|
|||||||
job::job(FILE *out, const std::string &job_name)
|
job::job(FILE *out, const std::string &job_name)
|
||||||
: out_(out),
|
: out_(out),
|
||||||
job_name_(job_name),
|
job_name_(job_name),
|
||||||
page_params_(),
|
page_params_() {
|
||||||
pages_(0) {
|
|
||||||
// Delete dubious characters from job name
|
// Delete dubious characters from job name
|
||||||
std::replace_if(job_name_.begin(), job_name_.end(), [](char c) {
|
std::replace_if(job_name_.begin(), job_name_.end(), [](char c) {
|
||||||
return c < 32 || c >= 127 || c == '"' || c == '\\';
|
return c < 32 || c >= 127 || c == '"' || c == '\\';
|
||||||
}, ' ');
|
}, ' ');
|
||||||
|
|
||||||
|
begin_job();
|
||||||
}
|
}
|
||||||
|
|
||||||
job::~job() {
|
job::~job() {
|
||||||
if (pages_ != 0) {
|
end_job();
|
||||||
end_job();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void job::begin_job() {
|
void job::begin_job() {
|
||||||
@ -87,11 +86,6 @@ void job::encode_page(const page_params &page_params,
|
|||||||
int lines,
|
int lines,
|
||||||
int linesize,
|
int linesize,
|
||||||
nextline_fn nextline) {
|
nextline_fn nextline) {
|
||||||
if (pages_ == 0) {
|
|
||||||
begin_job();
|
|
||||||
}
|
|
||||||
++pages_;
|
|
||||||
|
|
||||||
if (!(page_params_ == page_params)) {
|
if (!(page_params_ == page_params)) {
|
||||||
page_params_ = page_params;
|
page_params_ = page_params;
|
||||||
write_page_header();
|
write_page_header();
|
||||||
@ -109,20 +103,10 @@ void job::encode_page(const page_params &page_params,
|
|||||||
|
|
||||||
fputs("\033*b1030m", out_);
|
fputs("\033*b1030m", out_);
|
||||||
|
|
||||||
// XXX brother driver uses 128 lines per band
|
|
||||||
const int lines_per_band = 64;
|
|
||||||
|
|
||||||
for (int i = 1; i < lines && nextline(line); ++i) {
|
for (int i = 1; i < lines && nextline(line); ++i) {
|
||||||
std::vector<uint8_t> encoded;
|
std::vector<uint8_t> encoded = encode_line(line, reference);
|
||||||
if (i % lines_per_band == 0) {
|
if (!block.line_fits(encoded.size())) {
|
||||||
block.flush(out_);
|
block.flush(out_);
|
||||||
encoded = encode_line(line);
|
|
||||||
} else {
|
|
||||||
encoded = encode_line(line, reference);
|
|
||||||
if (!block.line_fits(encoded.size())) {
|
|
||||||
block.flush(out_);
|
|
||||||
encoded = encode_line(line);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
block.add_line(std::move(encoded));
|
block.add_line(std::move(encoded));
|
||||||
std::swap(line, reference);
|
std::swap(line, reference);
|
||||||
|
@ -55,10 +55,6 @@ class job {
|
|||||||
int linesize,
|
int linesize,
|
||||||
nextline_fn nextline);
|
nextline_fn nextline);
|
||||||
|
|
||||||
int pages() const {
|
|
||||||
return pages_;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void begin_job();
|
void begin_job();
|
||||||
void end_job();
|
void end_job();
|
||||||
@ -67,7 +63,6 @@ class job {
|
|||||||
FILE *out_;
|
FILE *out_;
|
||||||
std::string job_name_;
|
std::string job_name_;
|
||||||
page_params page_params_;
|
page_params page_params_;
|
||||||
int pages_;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // JOB_H
|
#endif // JOB_H
|
||||||
|
12
src/line.cc
12
src/line.cc
@ -145,12 +145,10 @@ vector<uint8_t> encode_line(const vector<uint8_t> &line,
|
|||||||
int num_edits = 0;
|
int num_edits = 0;
|
||||||
|
|
||||||
auto line_it = line.begin();
|
auto line_it = line.begin();
|
||||||
auto line_end_it =
|
|
||||||
std::mismatch(line.rbegin(), line.rend(), reference.rbegin()).first.base();
|
|
||||||
auto ref_it = reference.begin();
|
auto ref_it = reference.begin();
|
||||||
while (1) {
|
while (1) {
|
||||||
int offset = skip_to_next_mismatch(&line_it, line_end_it, &ref_it);
|
int offset = skip_to_next_mismatch(&line_it, line.end(), &ref_it);
|
||||||
if (line_it == line_end_it) {
|
if (line_it == line.end()) {
|
||||||
// No more differences, we're done.
|
// No more differences, we're done.
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -158,17 +156,17 @@ vector<uint8_t> encode_line(const vector<uint8_t> &line,
|
|||||||
if (++num_edits == max_edits) {
|
if (++num_edits == max_edits) {
|
||||||
// We've run out of edits. Just output the rest of the line in a big
|
// We've run out of edits. Just output the rest of the line in a big
|
||||||
// substitute command.
|
// substitute command.
|
||||||
write_substitute(offset, line_it, line_end_it, &output);
|
write_substitute(offset, line_it, line.end(), &output);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
int s = substitute_length(line_it, line_end_it, ref_it);
|
int s = substitute_length(line_it, line.end(), ref_it);
|
||||||
if (s > 0) {
|
if (s > 0) {
|
||||||
write_substitute(offset, line_it, std::next(line_it, s), &output);
|
write_substitute(offset, line_it, std::next(line_it, s), &output);
|
||||||
line_it += s;
|
line_it += s;
|
||||||
ref_it += s;
|
ref_it += s;
|
||||||
} else {
|
} else {
|
||||||
int r = repeat_length(line_it, line_end_it);
|
int r = repeat_length(line_it, line.end());
|
||||||
assert(r >= 2);
|
assert(r >= 2);
|
||||||
write_repeat(offset, r, *line_it, &output);
|
write_repeat(offset, r, *line_it, &output);
|
||||||
line_it += r;
|
line_it += r;
|
||||||
|
20
src/main.cc
20
src/main.cc
@ -29,10 +29,6 @@
|
|||||||
#include "job.h"
|
#include "job.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
|
|
||||||
#ifndef O_BINARY
|
|
||||||
#define O_BINARY 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
@ -150,7 +146,7 @@ int main(int argc, char *argv[]) {
|
|||||||
|
|
||||||
int fd = STDIN_FILENO;
|
int fd = STDIN_FILENO;
|
||||||
if (job_filename) {
|
if (job_filename) {
|
||||||
fd = open(job_filename, O_RDONLY | O_BINARY);
|
fd = open(job_filename, O_RDONLY);
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
fprintf(stderr, "ERROR: " PACKAGE ": Unable to open raster file\n");
|
fprintf(stderr, "ERROR: " PACKAGE ": Unable to open raster file\n");
|
||||||
return 1;
|
return 1;
|
||||||
@ -170,6 +166,7 @@ int main(int argc, char *argv[]) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int pages = 0;
|
||||||
{
|
{
|
||||||
job job(stdout, ascii_job_name(job_id, job_user, job_name));
|
job job(stdout, ascii_job_name(job_id, job_user, job_name));
|
||||||
cups_page_header2_t header;
|
cups_page_header2_t header;
|
||||||
@ -178,11 +175,11 @@ int main(int argc, char *argv[]) {
|
|||||||
|| header.cupsBitsPerColor != 1
|
|| header.cupsBitsPerColor != 1
|
||||||
|| header.cupsNumColors != 1
|
|| header.cupsNumColors != 1
|
||||||
|| header.cupsBytesPerLine > 10000) {
|
|| header.cupsBytesPerLine > 10000) {
|
||||||
fprintf(stderr, "ERROR: " PACKAGE ": Page %d: Bogus raster data.\n", job.pages() + 1);
|
fprintf(stderr, "ERROR: " PACKAGE ": Page %d: Bogus raster data.\n", pages + 1);
|
||||||
dump_page_header(header);
|
dump_page_header(header);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if (job.pages() == 0) {
|
if (pages == 0) {
|
||||||
fprintf(stderr, "DEBUG: " PACKAGE ": Page header of first page\n");
|
fprintf(stderr, "DEBUG: " PACKAGE ": Page header of first page\n");
|
||||||
dump_page_header(header);
|
dump_page_header(header);
|
||||||
}
|
}
|
||||||
@ -190,12 +187,13 @@ int main(int argc, char *argv[]) {
|
|||||||
header.cupsHeight,
|
header.cupsHeight,
|
||||||
header.cupsBytesPerLine,
|
header.cupsBytesPerLine,
|
||||||
next_line);
|
next_line);
|
||||||
fprintf(stderr, "PAGE: %d %d\n", job.pages(), header.NumCopies);
|
fprintf(stderr, "PAGE: %d %d\n", ++pages, header.NumCopies);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (job.pages() == 0) {
|
if (pages == 0) {
|
||||||
fprintf(stderr, "ERROR: " PACKAGE ": No pages were found.\n");
|
fprintf(stderr, "ERROR: " PACKAGE ": No pages were found.\n");
|
||||||
}
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
|
@ -18,7 +18,6 @@
|
|||||||
#ifndef TEMPFILE_H
|
#ifndef TEMPFILE_H
|
||||||
#define TEMPFILE_H
|
#define TEMPFILE_H
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
@ -37,6 +37,16 @@ const lest::test specification[] = {
|
|||||||
EXPECT(!b.empty());
|
EXPECT(!b.empty());
|
||||||
},
|
},
|
||||||
|
|
||||||
|
"A block can contain 128 lines",
|
||||||
|
[] {
|
||||||
|
block b;
|
||||||
|
for (int i = 0; i < 128; ++i) {
|
||||||
|
EXPECT(b.line_fits(1));
|
||||||
|
b.add_line(vec(1));
|
||||||
|
}
|
||||||
|
EXPECT(!b.line_fits(1));
|
||||||
|
},
|
||||||
|
|
||||||
"A block has a size limit of about 16 kilobyte",
|
"A block has a size limit of about 16 kilobyte",
|
||||||
[] {
|
[] {
|
||||||
block b;
|
block b;
|
||||||
|
@ -1,35 +0,0 @@
|
|||||||
// This file is part of the brlaser printer driver.
|
|
||||||
//
|
|
||||||
// Copyright 2020 Peter De Wachter
|
|
||||||
//
|
|
||||||
// brlaser is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU General Public License as published by
|
|
||||||
// the Free Software Foundation, either version 2 of the License, or
|
|
||||||
// (at your option) any later version.
|
|
||||||
//
|
|
||||||
// brlaser is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU General Public License
|
|
||||||
// along with brlaser. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
#include "lest.hpp"
|
|
||||||
#include "tempfile.h"
|
|
||||||
#include "../src/job.h"
|
|
||||||
|
|
||||||
const lest::test specification[] = {
|
|
||||||
"An empty job produces no output",
|
|
||||||
[] {
|
|
||||||
tempfile f;
|
|
||||||
{
|
|
||||||
job j(f.file(), "name");
|
|
||||||
}
|
|
||||||
EXPECT(f.data().empty());
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
int main() {
|
|
||||||
return lest::run(specification);
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user