probe-printer.c revision 42a7bded1b1244af097afdc88654381a3d3879f9
/***************************************************************************
*
* probe-printer.c : Probe for prnio(7i) printer device information
*
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*
* Licensed under the Academic Free License version 2.1
*
**************************************************************************/
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <errno.h>
#include <string.h>
#include <strings.h>
#include <ctype.h>
#include <stdlib.h>
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include <ctype.h>
#include <libhal.h>
#include <logger.h>
#define NELEM(a) (sizeof (a) / sizeof (*(a)))
static char *
strip_ws(char *s)
{
if (s != NULL) {
char *p;
/* skip the leading whitespace */
/* drop the trailing whitespace */
p--) ;
*(++p) = '\0';
}
return (s);
}
static int
{
struct prn_1284_device_id id;
return (-1);
}
continue;
}
continue;
}
if ((strcasecmp(t, "MFG") == 0) ||
(strcasecmp(t, "MANUFACTURER") == 0)) {
"printer.vendor", strip_ws(u));
} else if ((strcasecmp(t, "MDL") == 0) ||
(strcasecmp(t, "MODEL") == 0)) {
"printer.product", strip_ws(u));
} else if ((strcasecmp(t, "SN") == 0) ||
(strcasecmp(t, "SERN") == 0) ||
(strcasecmp(t, "SERIALNUMBER") == 0)) {
} else if ((strcasecmp(t, "DES") == 0) ||
(strcasecmp(t, "DESCRIPTION") == 0)) {
"printer.description", strip_ws(u));
} else if ((strcasecmp(t, "CMD") == 0) ||
(strcasecmp(t, "COMMAND SET") == 0) ||
(strcasecmp(t, "COMMANDSET") == 0)) {
const char *cmds[32];
int i = 0;
}
}
}
return (0);
}
int
{
int ret = 1;
int fd = -1;
char *udi;
char *device_file;
goto out;
goto out;
setup_logger ();
dbus_error_init (&error);
goto out;
HAL_DEBUG (("Cannot allocate changeset"));
goto out;
}
HAL_DEBUG (("Doing probe-printer for %s (udi=%s)",
device_file, udi));
goto out;
}
goto out;
}
ret = 0;
out:
}
if (fd >= 0) {
}
if (dbus_error_is_set(&error)) {
dbus_error_free (&error);
}
}
return ret;
}