Skip to content

Commit

Permalink
Finalize SLP driver (Issue #58)
Browse files Browse the repository at this point in the history
This fixes the margin (centering) of the label image and sorts the label sizes
so that it is easier to find the size.  Note, however, that the advertised size
reflects the printable area (per the CUPS driver usage) and not the marketing
size, e.g., the 36x89mm large shipping label is reported as 35x83mm - half a mm
on the sides and 3mm top/bottom for margins.  I might decide to change that if
there is enough interest...

Note: These printers don't support status reporting of any kind despite having
a status command defined (0x01).  The USB Get-Status values are also wrong -
the printer always says its cover is open and it is out of media/labels...
  • Loading branch information
michaelrsweet committed Dec 8, 2023
1 parent d6508af commit 4afcb33
Showing 1 changed file with 21 additions and 35 deletions.
56 changes: 21 additions & 35 deletions lprint-sii.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,31 +52,31 @@ typedef struct lprint_sii_s // SII driver data

static const char * const lprint_sii_media[] =
{ // Supported media sizes for labels
"om_4-part-label_48x96mm",
"om_8mm-spine_9x66mm",
"om_35mm-slide_9x37mm",
"om_address-large_35x83mm",
"om_8mm-spine_9x66mm",
"om_file-folder_13x81mm",
"om_return_16x43mm",
"om_vhs-spine_18x141mm",
"om_round_22x24mm",
"om_multi-purpose_24x44mm",
"om_address-small_24x83mm",
"om_cut-hanging-13_32x78mm",
"om_jewelry_27x48mm",
"om_retail-label_32x37mm",
"om_cut-hanging-15_32x40mm",
"om_diskette_48x64mm",
"om_euro-file-folder_39x49mm",
"om_euro-folder-narrow_38x186mm",
"om_euro-folder-wide_48x186mm",
"om_cut-hanging-13_32x78mm",
"om_address-large_35x83mm",
"om_euro-name-badge_38x67mm",
"om_euro-name-badge-large_48x79mm",
"om_file-folder_13x81mm",
"om_jewelry_27x48mm",
"om_euro-folder-narrow_38x186mm",
"om_euro-file-folder_39x49mm",
"om_vhs-face_45x72mm",
"om_zip-disk_48x55mm",
"om_diskette_48x64mm",
"om_media-badge_48x64mm",
"om_multi-purpose_24x44mm",
"om_retail-label_32x37mm",
"om_return_16x43mm",
"om_round_22x24mm",
"om_euro-name-badge-large_48x79mm",
"om_4-part-label_48x96mm",
"om_shipping_48x96mm",
"om_top-coated-paper_48x140mm",
"om_vhs-face_45x72mm",
"om_vhs-spine_18x141mm",
"om_zip-disk_48x55mm",
"om_euro-folder-wide_48x186mm",
"roll_max_48x186mm",
"roll_min_9x13mm"
};
Expand All @@ -94,7 +94,6 @@ static bool lprint_sii_rendpage(pappl_job_t *job, pappl_pr_options_t *options, p
static bool lprint_sii_rstartjob(pappl_job_t *job, pappl_pr_options_t *options, pappl_device_t *device);
static bool lprint_sii_rstartpage(pappl_job_t *job, pappl_pr_options_t *options, pappl_device_t *device, unsigned page);
static bool lprint_sii_rwriteline(pappl_job_t *job, pappl_pr_options_t *options, pappl_device_t *device, unsigned y, const unsigned char *line);
static bool lprint_sii_status(pappl_printer_t *printer);


//
Expand All @@ -118,7 +117,6 @@ lprintSII(
data->rstartjob_cb = lprint_sii_rstartjob;
data->rstartpage_cb = lprint_sii_rstartpage;
data->rwriteline_cb = lprint_sii_rwriteline;
data->status_cb = lprint_sii_status;

// Vendor-specific format...
data->format = LPRINT_SLP_MIMETYPE;
Expand Down Expand Up @@ -247,7 +245,7 @@ lprint_sii_printfile(
// Copy the raw file...
papplJobSetImpressions(job, 1);

if ((fd = open(papplJobGetFilename(job), O_RDONLY)) < 0)
if ((fd = open(papplJobGetFilename(job), O_RDONLY)) < 0)
{
papplLogJob(job, PAPPL_LOGLEVEL_ERROR, "Unable to open print file \"%s\": %s", papplJobGetFilename(job), strerror(errno));
return (false);
Expand Down Expand Up @@ -371,6 +369,8 @@ lprint_sii_rstartpage(
if (!lprintDitherAlloc(&siidata->dither, job, options, CUPS_CSPACE_K, options->header.HWResolution[0] == 300 ? 1.2 : 1.0))
return (false);

papplDevicePrintf(device, "%c%c", LPRINT_SLP_CMD_MARGIN, (int)(12.7 * (lprint_sii_get_max_width(driver_name) - options->header.cupsWidth) / options->header.HWResolution[0]));

siidata->blanks = 0;

// Set darkness...
Expand Down Expand Up @@ -455,17 +455,3 @@ lprint_sii_rwriteline(

return (true);
}


//
// 'lprint_sii_status()' - Get current printer status.
//

static bool // O - `true` on success, `false` on failure
lprint_sii_status(
pappl_printer_t *printer) // I - Printer
{
(void)printer;

return (true);
}

0 comments on commit 4afcb33

Please sign in to comment.