Codebase list colord / 03f9c61
Make udev hwdb optional by using pnp.ids as fallback FreeBSD libudev-devd doesn't implement udev hwdb, and I cannot find any way to do the conversion in the FreeBSD source tree. Therefore, the fallback code removed in commit c9650c0bb7324c32d82fa6d7d898e236f10ea63b is brought back to use the pnp.ids file. Ting-Wei Lan authored 6 years ago Richard Hughes committed 6 years ago
3 changed file(s) with 29 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
105105 static gchar *
106106 cd_edid_convert_pnp_id_to_string (const gchar *pnp_id)
107107 {
108 #ifndef PNP_IDS
108109 gchar *vendor = NULL;
109110 struct udev_hwdb *hwdb = NULL;
110111 struct udev_list_entry *e;
139140 if (udev != NULL)
140141 udev_unref (udev);
141142 return vendor;
143 #else
144 g_autofree gchar *data = NULL;
145
146 /* load pnp.ids */
147 if (!g_file_get_contents (PNP_IDS, &data, NULL, NULL))
148 return NULL;
149 if (data == NULL)
150 return NULL;
151
152 /* get the vendor name from the tab delimited data */
153 for (gchar *idx = data; idx != NULL; ) {
154 if (strncmp (idx, pnp_id, 3) == 0) {
155 gchar *idx2 = g_strstr_len (idx, -1, "\n");
156 if (idx2 != NULL)
157 *idx2 = '\0';
158 return g_strdup (idx + 4);
159 }
160 idx = g_strstr_len (idx, -1, "\n");
161 if (idx != NULL)
162 idx++;
163 }
164 return NULL;
165 #endif
142166 }
143167
144168 /**
181181 message('RUNNING THIS AS root IS NOT A GOOD IDEA SEE --with-daemon-user')
182182 endif
183183
184 if get_option('with-pnp-ids') != ''
185 conf.set_quoted('PNP_IDS', get_option('with-pnp-ids'))
186 endif
187
184188 polkit = dependency('polkit-gobject-1', version : '>= 0.103')
185189 if polkit.version().version_compare('>= 0.114')
186190 conf.set('POLKIT_HAS_AUTOPTR_MACROS', '1')
1010 option('enable-tests', type : 'boolean', value : true, description : 'Build self tests')
1111 option('enable-installed-tests', type : 'boolean', value : false, description : 'Install tests')
1212 option('with-daemon-user', type : 'string', value : 'root', description : 'User for running the colord daemon')
13 option('with-pnp-ids', type : 'string', value : '', description : 'Location of pnp.ids if hwdb is not available')
1314 option('enable-man', type : 'boolean', value : true, description : 'Generate man pages')
1415 option('enable-docs', type : 'boolean', value : true, description : 'Generate documentation')