From 8bcf586b78fea574a791fcf1f3522a800a4d5c79 Mon Sep 17 00:00:00 2001
From: Richard Hughes
+It's actually really easy.
+Simple Scan already knows the SANE_Device
object of the
+scanner that it wants to use.
+From the SANE_Device
object we can easily get the
+device_id for the color managed device in colord.
+To do this, refer to the
+device and profile specification for scanner devices.
+This specifies the device_id for a sane device is made up from
+"sane_" + sane_device->model
.
+
+We can now query colord using +libcolord for the device that matches this ID: +
++ CdClient *client = NULL; + CdDevice *device = NULL; + CdProfile *profile = NULL; + GError *error = NULL; + + /* create a connection to colord */ + client = cd_client_new (); + + /* find the device for a specific ID */ + device = cd_client_find_device_sync (client, device_id, NULL, &error); + if (device == NULL) { + g_warning ("failed to find a device in colord: %s, + error->message); + g_error_free (error); + goto out; + } + + /* get the default profile for this device */ + profile = cd_device_get_default_profile (device); + if (profile == NULL) + goto out; + + /* TODO: use lcms to convert the scanned image */ + g_message ("need to use: %s", cd_profile_get_filename (profile)); +out: + if (profile != NULL) + g_object_unref (profile); + if (device != NULL) + g_object_unref (device); + g_object_unref (client); ++
+If you're not happy gaining an additional dependency of libcolord, then +it's also pretty easy to use raw DBus calls to do the same thing. +See the +examples folder for some code samples. +
+-- cgit v1.2.1