*
* Contents:
*
- * ieee1284GetDeviceID() - Get the IEEE-1284 device ID string and
+ * cfIEEE1284GetDeviceID() - Get the IEEE-1284 device ID string and
* corresponding URI.
- * ieee1284GetMakeModel() - Get the make and model string from the
+ * cfIEEE1284GetMakeModel() - Get the make and model string from the
* device ID.
- * ieee1284GetValues() - Get 1284 device ID keys and values.
- * ieee1284NormalizeMakeAndModel() - Normalize a product/make-and-model
+ * cfIEEE1284GetValues() - Get 1284 device ID keys and values.
+ * cfIEEE1284NormalizeMakeModel() - Normalize a product/make-and-model
* string.
*/
/*
- * 'ieee1284GetDeviceID()' - Get the IEEE-1284 device ID string and
+ * 'cfIEEE1284GetDeviceID()' - Get the IEEE-1284 device ID string and
* corresponding URI.
*/
int /* O - 0 on success, -1 on failure */
-ieee1284GetDeviceID(
+cfIEEE1284GetDeviceID(
int fd, /* I - File descriptor */
char *device_id, /* O - 1284 device ID */
int device_id_size, /* I - Size of buffer */
char *ptr; /* Pointer into device ID */
- DEBUG_printf(("ieee1284GetDeviceID(fd=%d, device_id=%p, device_id_size=%d, "
+ DEBUG_printf(("cfIEEE1284GetDeviceID(fd=%d, device_id=%p, device_id_size=%d, "
"make_model=%p, make_model_size=%d, scheme=\"%s\", "
"uri=%p, uri_size=%d)\n", fd, device_id, device_id_size,
make_model, make_model_size, scheme ? scheme : "(null)",
if (!device_id || device_id_size < 32)
{
- DEBUG_puts("ieee1284GetDeviceID: Bad args!");
+ DEBUG_puts("cfIEEE1284GetDeviceID: Bad args!");
return (-1);
}
}
else
{
- DEBUG_printf(("ieee1284GetDeviceID: ioctl failed - %s\n",
+ DEBUG_printf(("cfIEEE1284GetDeviceID: ioctl failed - %s\n",
strerror(errno)));
*device_id = '\0';
}
}
# ifdef DEBUG
else
- DEBUG_printf(("ieee1284GetDeviceID: ioctl failed - %s\n",
+ DEBUG_printf(("cfIEEE1284GetDeviceID: ioctl failed - %s\n",
strerror(errno)));
# endif /* DEBUG */
# endif /* __sun && ECPPIOC_GETDEVID */
*ptr = ' ';
else if ((*ptr & 255) < ' ' || *ptr == 127)
{
- DEBUG_printf(("ieee1284GetDeviceID: Bad device_id character %d.",
+ DEBUG_printf(("cfIEEE1284GetDeviceID: Bad device_id character %d.",
*ptr & 255));
*device_id = '\0';
break;
}
- DEBUG_printf(("ieee1284GetDeviceID: device_id=\"%s\"\n", device_id));
+ DEBUG_printf(("cfIEEE1284GetDeviceID: device_id=\"%s\"\n", device_id));
if (scheme && uri)
*uri = '\0';
*/
if (make_model)
- ieee1284GetMakeModel(device_id, make_model, make_model_size);
+ cfIEEE1284GetMakeModel(device_id, make_model, make_model_size);
/*
* Then generate a device URI...
* Get the make, model, and serial numbers...
*/
- num_values = ieee1284GetValues(device_id, &values);
+ num_values = cfIEEE1284GetValues(device_id, &values);
if ((sern = cupsGetOption("SERIALNUMBER", num_values, values)) == NULL)
if ((sern = cupsGetOption("SERN", num_values, values)) == NULL)
/*
- * 'ieee1284GetMakeModel()' - Get the make and model string from the device ID.
+ * 'cfIEEE1284GetMakeModel()' - Get the make and model string from the device ID.
*/
int /* O - 0 on success, -1 on failure */
-ieee1284GetMakeModel(
+cfIEEE1284GetMakeModel(
const char *device_id, /* O - 1284 device ID */
char *make_model, /* O - Make/model */
int make_model_size) /* I - Size of buffer */
*des; /* Description string */
- DEBUG_printf(("ieee1284GetMakeModel(device_id=\"%s\", "
+ DEBUG_printf(("cfIEEE1284GetMakeModel(device_id=\"%s\", "
"make_model=%p, make_model_size=%d)\n", device_id,
make_model, make_model_size));
if (!device_id || !*device_id || !make_model || make_model_size < 32)
{
- DEBUG_puts("ieee1284GetMakeModel: Bad args!");
+ DEBUG_puts("cfIEEE1284GetMakeModel: Bad args!");
return (-1);
}
* Look for the description field...
*/
- num_values = ieee1284GetValues(device_id, &values);
+ num_values = cfIEEE1284GetValues(device_id, &values);
if ((mdl = cupsGetOption("MODEL", num_values, values)) == NULL)
mdl = cupsGetOption("MDL", num_values, values);
* Just copy the model string, since it has the manufacturer...
*/
- ieee1284NormalizeMakeAndModel(mdl, NULL, IEEE1284_NORMALIZE_HUMAN, NULL,
+ cfIEEE1284NormalizeMakeModel(mdl, NULL, CF_IEEE1284_NORMALIZE_HUMAN, NULL,
make_model, make_model_size, NULL, NULL,
NULL);
}
snprintf(temp, sizeof(temp), "%s %s", mfg, mdl);
- ieee1284NormalizeMakeAndModel(temp, NULL, IEEE1284_NORMALIZE_HUMAN, NULL,
+ cfIEEE1284NormalizeMakeModel(temp, NULL, CF_IEEE1284_NORMALIZE_HUMAN, NULL,
make_model, make_model_size, NULL, NULL,
NULL);
}
}
if (spaces && letters)
- ieee1284NormalizeMakeAndModel(des, NULL, IEEE1284_NORMALIZE_HUMAN, NULL,
+ cfIEEE1284NormalizeMakeModel(des, NULL, CF_IEEE1284_NORMALIZE_HUMAN, NULL,
make_model, make_model_size, NULL, NULL,
NULL);
}
/*
- * 'ieee1284GetValues()' - Get 1284 device ID keys and values.
+ * 'cfIEEE1284GetValues()' - Get 1284 device ID keys and values.
*
* The returned dictionary is a CUPS option array that can be queried with
* cupsGetOption and freed with cupsFreeOptions.
*/
int /* O - Number of key/value pairs */
-ieee1284GetValues(
+cfIEEE1284GetValues(
const char *device_id, /* I - IEEE-1284 device ID string */
cups_option_t **values) /* O - Array of key/value pairs */
{
}
/*
- * 'ieee1284NormalizeMakeAndModel()' - Normalize a product/make-and-model
+ * 'cfIEEE1284NormalizeMakeModel()' - Normalize a product/make-and-model
* string.
*
* This function tries to undo the mistakes made by many printer manufacturers
char * /* O - Normalized make-and-model string
or NULL on error */
-ieee1284NormalizeMakeAndModel(
+cfIEEE1284NormalizeMakeModel(
const char *make_and_model, /* I - Original make-and-model string
or device ID */
const char *make, /* I - Manufacturer name as hint for
or NULL,
ignored on device ID with "MFG"
field or for NO_MAKE_MODEL */
- ieee1284_normalize_modes_t mode, /* I - Bit field to describe how to
+ cf_ieee1284_normalize_modes_t mode, /* I - Bit field to describe how to
normalize */
regex_t *extra_regex, /* I - Compiled regex to determine
where the extra info after
*/
if (!mode)
- mode = IEEE1284_NORMALIZE_HUMAN;
+ mode = CF_IEEE1284_NORMALIZE_HUMAN;
- if (mode & IEEE1284_NORMALIZE_SEPARATOR_SPACE)
+ if (mode & CF_IEEE1284_NORMALIZE_SEPARATOR_SPACE)
sepchr = ' ';
- else if (mode & IEEE1284_NORMALIZE_SEPARATOR_DASH)
+ else if (mode & CF_IEEE1284_NORMALIZE_SEPARATOR_DASH)
sepchr = '-';
- else if (mode & IEEE1284_NORMALIZE_SEPARATOR_UNDERSCORE)
+ else if (mode & CF_IEEE1284_NORMALIZE_SEPARATOR_UNDERSCORE)
sepchr = '_';
- if (mode & IEEE1284_NORMALIZE_LOWERCASE)
+ if (mode & CF_IEEE1284_NORMALIZE_LOWERCASE)
lower = 1;
- if (mode & IEEE1284_NORMALIZE_UPPERCASE)
+ if (mode & CF_IEEE1284_NORMALIZE_UPPERCASE)
upper = 1;
- if (mode & IEEE1284_NORMALIZE_PAD_NUMBERS)
+ if (mode & CF_IEEE1284_NORMALIZE_PAD_NUMBERS)
pad = 1;
- if (mode & IEEE1284_NORMALIZE_SEPARATE_COMPONENTS)
+ if (mode & CF_IEEE1284_NORMALIZE_SEPARATE_COMPONENTS)
separate = 1;
- if (mode & IEEE1284_NORMALIZE_NO_MAKE_MODEL)
+ if (mode & CF_IEEE1284_NORMALIZE_NO_MAKE_MODEL)
nomakemodel = 1;
- if (mode & IEEE1284_NORMALIZE_IPP)
+ if (mode & CF_IEEE1284_NORMALIZE_IPP)
{
compare = 1;
lower = 1;
upper = 0;
sepchr = '-';
}
- else if (mode & IEEE1284_NORMALIZE_ENV)
+ else if (mode & CF_IEEE1284_NORMALIZE_ENV)
{
compare = 1;
lower = 0;
upper = 1;
sepchr = '_';
}
- else if (mode & IEEE1284_NORMALIZE_COMPARE)
+ else if (mode & CF_IEEE1284_NORMALIZE_COMPARE)
{
compare = 1;
if (lower == 0 && upper == 0)
if (lower == 1 && upper == 1)
upper = 0;
}
- else if (mode & IEEE1284_NORMALIZE_HUMAN)
+ else if (mode & CF_IEEE1284_NORMALIZE_HUMAN)
human = 1;
/*
*/
/* Bit field to describe how to normalize make/model/device ID strings */
-enum ieee1284_normalize_modes_e
+enum cf_ieee1284_normalize_modes_e
{
- IEEE1284_NORMALIZE_COMPARE = 0x01, /* Optimized for comparing,
+ CF_IEEE1284_NORMALIZE_COMPARE = 0x01, /* Optimized for comparing,
replacing any sequence of
non-alpha-numeric characters
by a single separator char,
make/model/extra,
make all letters lowercase (or
uppercase) */
- IEEE1284_NORMALIZE_IPP = 0x02, /* Only chars allowed in
+ CF_IEEE1284_NORMALIZE_IPP = 0x02, /* Only chars allowed in
IPP keywords */
- IEEE1284_NORMALIZE_ENV = 0x04, /* Environment variable format
+ CF_IEEE1284_NORMALIZE_ENV = 0x04, /* Environment variable format
upparcaser and underscore */
- IEEE1284_NORMALIZE_HUMAN = 0x08, /* Human-readable, conserves
+ CF_IEEE1284_NORMALIZE_HUMAN = 0x08, /* Human-readable, conserves
spaces and special characters
but does some clean-up */
- IEEE1284_NORMALIZE_LOWERCASE = 0x10, /* All letters lowercase */
- IEEE1284_NORMALIZE_UPPERCASE = 0x20, /* All letters uppercase */
- IEEE1284_NORMALIZE_SEPARATOR_SPACE = 0x40, /* Separator char is ' ' */
- IEEE1284_NORMALIZE_SEPARATOR_DASH = 0x80, /* Separator char is '-' */
- IEEE1284_NORMALIZE_SEPARATOR_UNDERSCORE = 0x100,/* Separator char is '_' */
- IEEE1284_NORMALIZE_PAD_NUMBERS = 0x200, /* Zero-pad numbers in stings
+ CF_IEEE1284_NORMALIZE_LOWERCASE = 0x10, /* All letters lowercase */
+ CF_IEEE1284_NORMALIZE_UPPERCASE = 0x20, /* All letters uppercase */
+ CF_IEEE1284_NORMALIZE_SEPARATOR_SPACE = 0x40,/* Separator char is ' ' */
+ CF_IEEE1284_NORMALIZE_SEPARATOR_DASH = 0x80, /* Separator char is '-' */
+ CF_IEEE1284_NORMALIZE_SEPARATOR_UNDERSCORE = 0x100,/* Separator char is '_' */
+ CF_IEEE1284_NORMALIZE_PAD_NUMBERS = 0x200, /* Zero-pad numbers in stings
to get better list sorting
results */
- IEEE1284_NORMALIZE_SEPARATE_COMPONENTS = 0x400,/* In the output buffer put
+ CF_IEEE1284_NORMALIZE_SEPARATE_COMPONENTS = 0x400,/* In the output buffer put
'\0' bytes between make,
model, and extra, to use
as separate strings */
- IEEE1284_NORMALIZE_NO_MAKE_MODEL = 0x800, /* No make/model/extra separation,
+ CF_IEEE1284_NORMALIZE_NO_MAKE_MODEL = 0x800, /* No make/model/extra separation,
do not try to identify, add,
or clean up manufacturer
name */
};
-typedef unsigned ieee1284_normalize_modes_t;
+typedef unsigned cf_ieee1284_normalize_modes_t;
/*
* Prototypes...
*/
-extern int ieee1284GetDeviceID(int fd, char *device_id,
+extern int cfIEEE1284GetDeviceID(int fd, char *device_id,
int device_id_size,
char *make_model,
int make_model_size,
const char *scheme, char *uri,
int uri_size);
-extern int ieee1284GetMakeModel(const char *device_id,
+extern int cfIEEE1284GetMakeModel(const char *device_id,
char *make_model,
int make_model_size);
-extern int ieee1284GetValues(const char *device_id,
+extern int cfIEEE1284GetValues(const char *device_id,
cups_option_t **values);
-extern char *ieee1284NormalizeMakeAndModel(const char *make_and_model,
- const char *make,
- ieee1284_normalize_modes_t mode,
- regex_t *extra_regex,
- char *buffer, size_t bufsize,
- char **model, char **extra,
- char **drvname);
+extern char *cfIEEE1284NormalizeMakeModel(const char *make_and_model,
+ const char *make,
+ cf_ieee1284_normalize_modes_t mode,
+ regex_t *extra_regex,
+ char *buffer, size_t bufsize,
+ char **model, char **extra,
+ char **drvname);
# ifdef __cplusplus