Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added: support for m02s #8

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions cups/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ ppds:
install:
install -D drv/phomemo-m02.drv -t $(DESTDIR)/usr/share/cups/drv/
install -D ppd/Phomemo-M02.ppd.gz -t $(DESTDIR)/usr/share/cups/model/Phomemo
install -D drv/phomemo-m02s.drv -t $(DESTDIR)/usr/share/cups/drv/
install -D ppd/Phomemo-M02S.ppd.gz -t $(DESTDIR)/usr/share/cups/model/Phomemo
install -D drv/phomemo-m110.drv -t $(DESTDIR)/usr/share/cups/drv/
install -D ppd/Phomemo-M110.ppd.gz -t $(DESTDIR)/usr/share/cups/model/Phomemo
install -Dm 755 filter/rastertopm02.py $(DESTDIR)/usr/lib/cups/filter/rastertopm02
Expand Down
66 changes: 66 additions & 0 deletions cups/drv/phomemo-m02s.drv
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
//
// Driver info file for Phomemo M02S
//
// Copyright © 2020 Laurent Vivier <laurent@vivier.eu>
//

#include <font.defs>
#include <media.defs>
#include <label.h>

#media "w50h10/Label 50mmx25mm" 50mm 10mm
#media "w50h20/Label 50mmx20mm" 50mm 20mm
#media "w50h25/Label 50mmx25mm" 50mm 25mm
#media "w50h30/Label 50mmx30mm" 50mm 30mm
#media "w50h40/Label 50mmx40mm" 50mm 40mm
#media "w50h50/Label 50mmx50mm" 50mm 50mm
#media "w50h60/Label 50mmx60mm" 50mm 60mm
#media "w50h70/Label 50mmx70mm" 50mm 70mm
#media "w50h75/Label 50mmx75mm" 50mm 75mm
#media "w50h80/Label 50mmx80mm" 50mm 80mm
#media "w50h90/Label 50mmx90mm" 50mm 90mm
#media "w50h100/Label 50mmx100mm" 50mm 100mm
#media "w50h110/Label 50mmx110mm" 50mm 110mm
#media "w50h120/Label 50mmx120mm" 50mm 120mm
#media "w50h125/Label 50mmx125mm" 50mm 125mm
#media "w50h130/Label 50mmx130mm" 50mm 130mm
#media "w50h140/Label 50mmx140mm" 50mm 140mm
#media "w50h150/Label 50mmx150mm" 50mm 150mm
{
Manufacturer "Phomemo"
ModelName "M02S"
PCFileName "Phomemo-M02S.ppd"
Version 1.0
Attribute "NickName" "" "Phomemo M02S"
DriverType label
ColorDevice No
Attribute "cupsSNMPSupplies" "" "false"
HWMargins 1mm 0 1mm 0

Filter "application/vnd.cups-raster 100 rastertopm02"
*Resolution - 8 0 0 0 304dpi
ColorModel Gray/Grayscale w chunky 0

MediaSize "w50h10"
MediaSize "w50h20"
MediaSize "w50h25"
MediaSize "w50h30"
MediaSize "w50h40"
MediaSize "w50h50"
*MediaSize "w50h60"
MediaSize "w50h70"
MediaSize "w50h75"
MediaSize "w50h80"
MediaSize "w50h90"
MediaSize "w50h100"
MediaSize "w50h110"
MediaSize "w50h120"
MediaSize "w50h125"
MediaSize "w50h130"
MediaSize "w50h140"
MediaSize "w50h150"

VariablePaperSize Yes
MinSize 0.00 0.00
MaxSize 0.00 0.00
}
2 changes: 1 addition & 1 deletion cups/filter/rastertopm02.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def print_raster(file, image, line, lines = 0xff, mode = 0):
file.write(mode.to_bytes(1, 'little'))
# number of bytes / line
file.write(int((image.width + 7) / 8).to_bytes(2, 'little'))
# nulber of lines in the image
# number of lines in the image
file.write(lines.to_bytes(2, 'little'))
# bit image
block = image.crop((0, line, image.width, line + lines))
Expand Down
3 changes: 2 additions & 1 deletion phomemo-tools.spec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Name: phomemo-tools
Version: 1.0
Release: 1%{?dist}
Summary: A set of tools to use Phomemo M02 printer
Summary: A set of tools to use Phomemo M02, M02S and M110 printer
License: GPLv3

Source: %{name}-%{version}.tar.xz
Expand Down Expand Up @@ -37,6 +37,7 @@ make DESTDIR=%{buildroot} install
/usr/share/phomemo/phomemo-filter.py
/usr/share/phomemo/format-checker.py
/usr/share/cups/model/Phomemo/Phomemo-M02.ppd.gz
/usr/share/cups/model/Phomemo/Phomemo-M02S.ppd.gz
/usr/share/cups/model/Phomemo/Phomemo-M110.ppd.gz
/usr/share/cups/drv/phomemo-m02.drv
/usr/share/cups/drv/phomemo-m110.drv
Expand Down
6 changes: 3 additions & 3 deletions tools/phomemo-filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def print_marker(lines=0x100):
with os.fdopen(sys.stdout.fileno(), "wb", closefd=False) as stdout:
stdout.write(0x761d.to_bytes(2, 'little'))
stdout.write(0x0030.to_bytes(2, 'little'))
stdout.write(0x0030.to_bytes(2, 'little'))
stdout.write(0x0048.to_bytes(2, 'little'))
stdout.write((lines - 1).to_bytes(2, 'little'))
return

Expand Down Expand Up @@ -74,8 +74,8 @@ def usage():
if image.width > image.height:
image = image.transpose(Image.ROTATE_90)

# width 384 dots
image = image.resize(size=(384, int(image.height * 384 / image.width)))
# width 576 dots
image = image.resize(size=(576, int(image.height * 576 / image.width)))

# black&white printer: dithering
image = image.convert(mode='1')
Expand Down