/*
- * "$Id: scsi-linux.c 4703 2005-09-26 19:33:58Z mike $"
+ * "$Id: scsi-linux.c 6649 2007-07-11 21:46:42Z mike $"
*
* Linux SCSI printer support for the Common UNIX Printing System (CUPS).
*
+ * Copyright 2007 by Apple Inc.
* Copyright 2003-2005 by Easy Software Products, all rights reserved.
*
* Redistribution and use in source and binary forms, with or
*/
#include <scsi/sg.h>
+#include <cups/i18n.h>
/*
if (strncmp(resource, "/dev/sg", 7) != 0)
{
- fprintf(stderr, "ERROR: Bad SCSI device file \"%s\"!\n", resource);
+ fprintf(stderr, _("ERROR: Bad SCSI device file \"%s\"!\n"), resource);
return (CUPS_BACKEND_STOP);
}
* Open the SCSI device file...
*/
+ fputs("STATE: +connecting-to-device\n", stderr);
+
do
{
if ((scsi_fd = open(resource, O_RDWR | O_EXCL)) == -1)
* available printer in the class.
*/
- fputs("INFO: Unable to open SCSI device, queuing on next printer in class...\n",
- stderr);
+ _cupsLangPuts(stderr,
+ _("INFO: Unable to contact printer, queuing on next "
+ "printer in class...\n"));
/*
* Sleep 5 seconds to keep the job from requeuing too rapidly...
if (errno != EAGAIN && errno != EBUSY)
{
- fprintf(stderr, "ERROR: Unable to open SCSI device \"%s\" - %s\n",
- resource, strerror(errno));
+ fprintf(stderr, _("ERROR: Unable to open device file \"%s\": %s\n"),
+ resource, strerror(errno));
return (CUPS_BACKEND_FAILED);
}
else
{
- fprintf(stderr, "INFO: SCSI device \"%s\" busy; retrying...\n",
- resource);
+ fputs(_("INFO: Printer busy; will retry in 30 seconds...\n"), stderr);
sleep(30);
}
}
}
while (scsi_fd == -1);
+ fputs("STATE: -connecting-to-device\n", stderr);
+
/*
* Now that we are "connected" to the port, ignore SIGTERM so that we
* can finish out any page data the driver sends (e.g. to eject the
if (ioctl(scsi_fd, SG_IO, &scsi_req) < 0 ||
scsi_req.status != 0)
{
- fprintf(stderr, "WARNING: SCSI command timed out (%d); retrying...\n",
+ fprintf(stderr,
+ _("WARNING: SCSI command timed out (%d); retrying...\n"),
scsi_req.status);
sleep(try + 1);
}
if (try >= 10)
{
- fprintf(stderr, "ERROR: Unable to send print data (%d)\n",
+ fprintf(stderr, _("ERROR: Unable to send print data (%d)\n"),
scsi_req.status);
close(scsi_fd);
return (CUPS_BACKEND_FAILED);
/*
- * End of "$Id: scsi-linux.c 4703 2005-09-26 19:33:58Z mike $".
+ * End of "$Id: scsi-linux.c 6649 2007-07-11 21:46:42Z mike $".
*/