Updated colord patch from upstream review.
This commit is contained in:
parent
85d072c20b
commit
c444f44358
@ -12,10 +12,10 @@ index 0decf8f..a35ee82 100644
|
|||||||
log.o \
|
log.o \
|
||||||
diff --git a/scheduler/colord.c b/scheduler/colord.c
|
diff --git a/scheduler/colord.c b/scheduler/colord.c
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 0000000..2fdf401
|
index 0000000..7428bf7
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/scheduler/colord.c
|
+++ b/scheduler/colord.c
|
||||||
@@ -0,0 +1,663 @@
|
@@ -0,0 +1,668 @@
|
||||||
+/*
|
+/*
|
||||||
+ * "$Id$"
|
+ * "$Id$"
|
||||||
+ *
|
+ *
|
||||||
@ -63,12 +63,16 @@ index 0000000..2fdf401
|
|||||||
+
|
+
|
||||||
+#define COLORD_SPACE_RGB "rgb" /* RGB colorspace */
|
+#define COLORD_SPACE_RGB "rgb" /* RGB colorspace */
|
||||||
+#define COLORD_SPACE_CMYK "cmyk" /* CMYK colorspace */
|
+#define COLORD_SPACE_CMYK "cmyk" /* CMYK colorspace */
|
||||||
|
+#define COLORD_SPACE_GRAY "gray" /* Gray colorspace */
|
||||||
+
|
+
|
||||||
+#define COLORD_MODE_PHYSICAL "physical" /* Actual device */
|
+#define COLORD_MODE_PHYSICAL "physical" /* Actual device */
|
||||||
+#define COLORD_MODE_VIRTUAL "virtual" /* Virtual device with no hardware */
|
+#define COLORD_MODE_VIRTUAL "virtual" /* Virtual device with no hardware */
|
||||||
+
|
+
|
||||||
+#define COLORD_KIND_PRINTER "printer" /* printing output device */
|
+#define COLORD_KIND_PRINTER "printer" /* printing output device */
|
||||||
+
|
+
|
||||||
|
+/* the timeout for connecting to colord */
|
||||||
|
+#define COLORD_DBUS_TIMEOUT 5000 /* ms */
|
||||||
|
+
|
||||||
+/* This is static */
|
+/* This is static */
|
||||||
+static DBusConnection *con = NULL;
|
+static DBusConnection *con = NULL;
|
||||||
+
|
+
|
||||||
@ -137,7 +141,6 @@ index 0000000..2fdf401
|
|||||||
+ DBusMessageIter args; /* D-Bus method arguments */
|
+ DBusMessageIter args; /* D-Bus method arguments */
|
||||||
+ DBusMessageIter dict; /* D-Bus method arguments */
|
+ DBusMessageIter dict; /* D-Bus method arguments */
|
||||||
+ DBusError error; /* D-Bus error */
|
+ DBusError error; /* D-Bus error */
|
||||||
+ int options = 1; /* Options for CreateProfile */
|
|
||||||
+ char *idstr; /* Profile ID string */
|
+ char *idstr; /* Profile ID string */
|
||||||
+ size_t idstrlen; /* Profile ID allocated length */
|
+ size_t idstrlen; /* Profile ID allocated length */
|
||||||
+ const char *profile_path; /* Device object path */
|
+ const char *profile_path; /* Device object path */
|
||||||
@ -184,11 +187,11 @@ index 0000000..2fdf401
|
|||||||
+
|
+
|
||||||
+ /* send syncronous */
|
+ /* send syncronous */
|
||||||
+ dbus_error_init(&error);
|
+ dbus_error_init(&error);
|
||||||
+ cupsdLogMessage(CUPSD_LOG_DEBUG, "Calling CreateProfile(%s,%d)",
|
+ cupsdLogMessage(CUPSD_LOG_DEBUG, "Calling CreateProfile(%s,%s)",
|
||||||
+ idstr, options);
|
+ idstr, scope);
|
||||||
+ reply = dbus_connection_send_with_reply_and_block(con,
|
+ reply = dbus_connection_send_with_reply_and_block(con,
|
||||||
+ message,
|
+ message,
|
||||||
+ -1,
|
+ COLORD_DBUS_TIMEOUT,
|
||||||
+ &error);
|
+ &error);
|
||||||
+ if (reply == NULL)
|
+ if (reply == NULL)
|
||||||
+ {
|
+ {
|
||||||
@ -252,7 +255,7 @@ index 0000000..2fdf401
|
|||||||
+ dbus_error_init(&error);
|
+ dbus_error_init(&error);
|
||||||
+ reply = dbus_connection_send_with_reply_and_block(con,
|
+ reply = dbus_connection_send_with_reply_and_block(con,
|
||||||
+ message,
|
+ message,
|
||||||
+ -1,
|
+ COLORD_DBUS_TIMEOUT,
|
||||||
+ &error);
|
+ &error);
|
||||||
+ if (reply == NULL)
|
+ if (reply == NULL)
|
||||||
+ {
|
+ {
|
||||||
@ -275,6 +278,7 @@ index 0000000..2fdf401
|
|||||||
+
|
+
|
||||||
+static void
|
+static void
|
||||||
+colordCreateDevice (cupsd_printer_t *p, /* I - Printer */
|
+colordCreateDevice (cupsd_printer_t *p, /* I - Printer */
|
||||||
|
+ ppd_file_t *ppd, /* I - PPD file */
|
||||||
+ cups_array_t *profiles, /* I - Profiles array */
|
+ cups_array_t *profiles, /* I - Profiles array */
|
||||||
+ const char *colorspace, /* I - Device colorspace, e.g. 'rgb' */
|
+ const char *colorspace, /* I - Device colorspace, e.g. 'rgb' */
|
||||||
+ const char *relation, /* I - Profile relation, either 'soft' or 'hard' */
|
+ const char *relation, /* I - Profile relation, either 'soft' or 'hard' */
|
||||||
@ -315,9 +319,10 @@ index 0000000..2fdf401
|
|||||||
+ &dict);
|
+ &dict);
|
||||||
+ message_dict_add_strings(&dict, "Colorspace", colorspace);
|
+ message_dict_add_strings(&dict, "Colorspace", colorspace);
|
||||||
+ message_dict_add_strings(&dict, "Mode", COLORD_MODE_PHYSICAL);
|
+ message_dict_add_strings(&dict, "Mode", COLORD_MODE_PHYSICAL);
|
||||||
+ if (p->make_model != NULL)
|
+ if (ppd->manufacturer != NULL)
|
||||||
+ message_dict_add_strings(&dict, "Vendor", p->make_model);
|
+ message_dict_add_strings(&dict, "Vendor", ppd->manufacturer);
|
||||||
+ message_dict_add_strings(&dict, "Model", p->name);
|
+ if (ppd->modelname != NULL)
|
||||||
|
+ message_dict_add_strings(&dict, "Model", ppd->modelname);
|
||||||
+ if (p->sanitized_device_uri != NULL)
|
+ if (p->sanitized_device_uri != NULL)
|
||||||
+ message_dict_add_strings(&dict, "Serial", p->sanitized_device_uri);
|
+ message_dict_add_strings(&dict, "Serial", p->sanitized_device_uri);
|
||||||
+ message_dict_add_strings(&dict, "Kind", COLORD_KIND_PRINTER);
|
+ message_dict_add_strings(&dict, "Kind", COLORD_KIND_PRINTER);
|
||||||
@ -329,7 +334,7 @@ index 0000000..2fdf401
|
|||||||
+ device_id, scope);
|
+ device_id, scope);
|
||||||
+ reply = dbus_connection_send_with_reply_and_block(con,
|
+ reply = dbus_connection_send_with_reply_and_block(con,
|
||||||
+ message,
|
+ message,
|
||||||
+ -1,
|
+ COLORD_DBUS_TIMEOUT,
|
||||||
+ &error);
|
+ &error);
|
||||||
+ if (reply == NULL)
|
+ if (reply == NULL)
|
||||||
+ {
|
+ {
|
||||||
@ -398,10 +403,11 @@ index 0000000..2fdf401
|
|||||||
+ cupsdLogMessage(CUPSD_LOG_DEBUG, "Calling DeleteDevice(%s)", device_id);
|
+ cupsdLogMessage(CUPSD_LOG_DEBUG, "Calling DeleteDevice(%s)", device_id);
|
||||||
+ reply = dbus_connection_send_with_reply_and_block(con,
|
+ reply = dbus_connection_send_with_reply_and_block(con,
|
||||||
+ message,
|
+ message,
|
||||||
+ -1,
|
+ COLORD_DBUS_TIMEOUT,
|
||||||
+ &error);
|
+ &error);
|
||||||
+ if (reply == NULL)
|
+ if (reply == NULL)
|
||||||
+ {
|
+ {
|
||||||
|
+ /* this can happen normally on start-up */
|
||||||
+ cupsdLogMessage(CUPSD_LOG_DEBUG,
|
+ cupsdLogMessage(CUPSD_LOG_DEBUG,
|
||||||
+ "failed to DeleteDevice: %s:%s",
|
+ "failed to DeleteDevice: %s:%s",
|
||||||
+ error.name, error.message);
|
+ error.name, error.message);
|
||||||
@ -540,14 +546,10 @@ index 0000000..2fdf401
|
|||||||
+ * See if we have any embedded profiles...
|
+ * See if we have any embedded profiles...
|
||||||
+ */
|
+ */
|
||||||
+
|
+
|
||||||
|
+ /* old CUPS has no cupsArrayNew3... */
|
||||||
+ profiles = cupsArrayNew (NULL, NULL);
|
+ profiles = cupsArrayNew (NULL, NULL);
|
||||||
+ profile_key = "APTiogaProfile";
|
+ profile_key = "cupsICCProfile";
|
||||||
+ attr = ppdFindAttr(ppd, profile_key, NULL);
|
+ attr = ppdFindAttr(ppd, profile_key, NULL);
|
||||||
+ if (attr == NULL)
|
|
||||||
+ {
|
|
||||||
+ profile_key = "cupsICCProfile";
|
|
||||||
+ attr = ppdFindAttr(ppd, profile_key, NULL);
|
|
||||||
+ }
|
|
||||||
+ for (; attr; attr = ppdFindNextAttr(ppd, profile_key, NULL))
|
+ for (; attr; attr = ppdFindNextAttr(ppd, profile_key, NULL))
|
||||||
+ if (attr->spec[0] && attr->value && attr->value[0])
|
+ if (attr->spec[0] && attr->value && attr->value[0])
|
||||||
+ {
|
+ {
|
||||||
@ -612,6 +614,8 @@ index 0000000..2fdf401
|
|||||||
+ COLORD_SCOPE_TEMP);
|
+ COLORD_SCOPE_TEMP);
|
||||||
+ break;
|
+ break;
|
||||||
+ case PPD_CS_GRAY :
|
+ case PPD_CS_GRAY :
|
||||||
|
+ device_colorspace = COLORD_SPACE_GRAY;
|
||||||
|
+ break;
|
||||||
+ case PPD_CS_N :
|
+ case PPD_CS_N :
|
||||||
+ colordCreateProfile(profiles,
|
+ colordCreateProfile(profiles,
|
||||||
+ p->name,
|
+ p->name,
|
||||||
@ -629,6 +633,7 @@ index 0000000..2fdf401
|
|||||||
+ cupsdLogMessage(CUPSD_LOG_INFO, "Registering ICC color profiles for \"%s\"",
|
+ cupsdLogMessage(CUPSD_LOG_INFO, "Registering ICC color profiles for \"%s\"",
|
||||||
+ p->name);
|
+ p->name);
|
||||||
+ colordCreateDevice (p,
|
+ colordCreateDevice (p,
|
||||||
|
+ ppd,
|
||||||
+ profiles,
|
+ profiles,
|
||||||
+ device_colorspace,
|
+ device_colorspace,
|
||||||
+ COLORD_RELATION_SOFT,
|
+ COLORD_RELATION_SOFT,
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
Summary: Common Unix Printing System
|
Summary: Common Unix Printing System
|
||||||
Name: cups
|
Name: cups
|
||||||
Version: 1.4.6
|
Version: 1.4.6
|
||||||
Release: 15%{?dist}
|
Release: 16%{?dist}
|
||||||
License: GPLv2
|
License: GPLv2
|
||||||
Group: System Environment/Daemons
|
Group: System Environment/Daemons
|
||||||
Source: http://ftp.easysw.com/pub/cups/%{version}/cups-%{version}-source.tar.bz2
|
Source: http://ftp.easysw.com/pub/cups/%{version}/cups-%{version}-source.tar.bz2
|
||||||
@ -610,6 +610,9 @@ rm -rf $RPM_BUILD_ROOT
|
|||||||
%{php_extdir}/phpcups.so
|
%{php_extdir}/phpcups.so
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue May 17 2011 Richard Hughes <rhughes@redhat.com> 1:1.4.6-16
|
||||||
|
- Updated colord patch from upstream review.
|
||||||
|
|
||||||
* Fri Mar 25 2011 Jiri Popelka <jpopelka@redhat.com> 1:1.4.6-15
|
* Fri Mar 25 2011 Jiri Popelka <jpopelka@redhat.com> 1:1.4.6-15
|
||||||
- Polished patches according to results from static analysis of code (bug #690130).
|
- Polished patches according to results from static analysis of code (bug #690130).
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user