summaryrefslogtreecommitdiffstats
path: root/main/gnome-bluetooth/udev-hwdb.patch
blob: 3fd7cae67c857f8aee057e6767daafbda199b1e2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
diff --git a/lib/pin.c b/lib/pin.c
index 61e87ab..fa05599 100644
--- a/lib/pin.c
+++ b/lib/pin.c
@@ -40,11 +40,12 @@
 char *
 oui_to_vendor (const char *oui)
 {
+	char *vendor = NULL;
+#if HAVE_UDEV_HWDB_NEW
 	struct udev *udev;
 	struct udev_hwdb *hwdb;
 	struct udev_list_entry *list, *l;
 	char *modalias;
-	char *vendor = NULL;
 
 	if (oui == NULL ||
 	    strlen (oui) < 8)
@@ -81,7 +82,7 @@ bail:
 	g_clear_pointer (&modalias, g_free);
 	g_clear_pointer (&hwdb, udev_hwdb_unref);
 	g_clear_pointer (&udev, udev_unref);
-
+#endif
 	return vendor;
 }
 
@@ -207,7 +208,7 @@ get_pincode_for_device (guint       type,
 	data.confirm = TRUE;
 
 	tmp_vendor = oui_to_vendor (address);
-	data.vendor = g_ascii_strdown (tmp_vendor, -1);
+	data.vendor = g_ascii_strdown (tmp_vendor ? tmp_vendor : "unknown", -1);
 	g_free (tmp_vendor);
 
 	ctx = g_markup_parse_context_new (&parser, 0, &data, NULL);
@@ -227,7 +228,8 @@ get_pincode_for_device (guint       type,
 
 	g_debug ("Got pin '%s' (max digits: %d, confirm: %d) for device '%s' (type: %s address: %s, vendor: %s)",
 		 data.ret_pin, data.max_digits, data.confirm,
-		 name ? name : "", bluetooth_type_to_string (type), address, data.vendor);
+		 name ? name : "", bluetooth_type_to_string (type), address,
+		 data.vendor ? data.vendor : "unknown");
 
 	g_free (data.vendor);