/*
- * "$Id: usb-unix.c 6911 2007-09-04 20:35:08Z mike $"
+ * "$Id: usb-unix.c 6910 2007-09-04 20:34:29Z mike $"
*
* USB port backend for the Common UNIX Printing System (CUPS).
*
*/
static int open_device(const char *uri, int *use_bc);
-static void side_cb(int print_fd, int device_fd, int use_bc);
+static void side_cb(int print_fd, int device_fd, int snmp_fd,
+ http_addr_t *addr, int use_bc);
/*
use_bc = strcasecmp(hostname, "Brother") &&
strcasecmp(hostname, "Canon") &&
- strcasecmp(hostname, "Konica Minolta") &&
- strcasecmp(hostname, "Minolta");
+ strncasecmp(hostname, "Konica", 6) &&
+ strncasecmp(hostname, "Minolta", 7);
#endif /* __FreeBSD__ || __NetBSD__ || __OpenBSD__ || __DragonFly__ */
if ((device_fd = open_device(uri, &use_bc)) == -1)
lseek(print_fd, 0, SEEK_SET);
}
- tbytes = backendRunLoop(print_fd, device_fd, use_bc, side_cb);
+ tbytes = backendRunLoop(print_fd, device_fd, -1, NULL, use_bc, side_cb);
if (print_fd != 0 && tbytes >= 0)
_cupsLangPrintf(stderr,
}
#elif defined(__hpux)
#elif defined(__osf)
-#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
+#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(__FreeBSD_kernel__)
int i; /* Looping var */
char device[255]; /* Device filename */
* Find the correct USB device...
*/
- do
+ for (;;)
{
for (busy = 0, i = 0; i < 16; i ++)
{
*/
if (busy)
- {
_cupsLangPuts(stderr,
_("INFO: Printer busy; will retry in 5 seconds...\n"));
- sleep(5);
- }
- }
- while (busy);
- /*
- * Couldn't find the printer, return "no such device or address"...
- */
-
- errno = ENODEV;
-
- return (-1);
+ sleep(5);
+ }
}
#elif defined(__sun) && defined(ECPPIOC_GETDEVID)
{
}
#else
{
- if (use_bc)
+ if (*use_bc)
fd = open(uri + 4, O_RDWR | O_EXCL);
else
fd = -1;
*/
static void
-side_cb(int print_fd, /* I - Print file */
- int device_fd, /* I - Device file */
- int use_bc) /* I - Using back-channel? */
+side_cb(int print_fd, /* I - Print file */
+ int device_fd, /* I - Device file */
+ int snmp_fd, /* I - SNMP socket (unused) */
+ http_addr_t *addr, /* I - Device address (unused) */
+ int use_bc) /* I - Using back-channel? */
{
cups_sc_command_t command; /* Request command */
cups_sc_status_t status; /* Request/response status */
int datalen; /* Request/response data size */
+ (void)snmp_fd;
+ (void)addr;
+
datalen = sizeof(data);
if (cupsSideChannelRead(&command, &status, data, &datalen, 1.0))
/*
- * End of "$Id: usb-unix.c 6911 2007-09-04 20:35:08Z mike $".
+ * End of "$Id: usb-unix.c 6910 2007-09-04 20:34:29Z mike $".
*/