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
47
48
49
50
51
52
53
54
55
56
57
|
$NetBSD: patch-ae,v 1.5 2008/12/26 15:35:51 jmcneill Exp $
From http://svn.gnome.org/viewvc/rhythmbox?view=revision&revision=5992
--- plugins/generic-player/rb-generic-player-source.c 2008/10/01 19:28:24 5961
+++ plugins/generic-player/rb-generic-player-source.c 2008/10/23 11:50:40 5992
@@ -824,21 +824,43 @@
char *udi = get_hal_udi_for_player (ctx, mount);
if (udi != NULL) {
DBusError error;
+ char **proplist;
char *prop;
rb_debug ("Checking udi %s", udi);
/* check that it can be accessed as mass-storage */
dbus_error_init (&error);
- prop = libhal_device_get_property_string (ctx, udi, "portable_audio_player.access_method", &error);
- if (prop != NULL && strcmp (prop, "storage") == 0 && !dbus_error_is_set (&error)) {
- /* the device has passed all tests, so it should be a usable player */
- result = TRUE;
- } else {
+ proplist = libhal_device_get_property_strlist (ctx, udi, "portable_audio_player.access_method.protocols", &error);
+ if (proplist != NULL && !dbus_error_is_set (&error)) {
+ int i;
+ for (i = 0; proplist[i] != NULL; i++) {
+ rb_debug ("device access method: %s", proplist[i]);
+ if (strcmp (proplist[i], "storage") == 0) {
+ result = TRUE;
+ break;
+ }
+ }
+
+ libhal_free_string_array (proplist);
+ }
+ free_dbus_error ("checking device access method", &error);
+
+ if (result == FALSE) {
+ dbus_error_init (&error);
+ prop = libhal_device_get_property_string (ctx, udi, "portable_audio_player.access_method", &error);
+ if (prop != NULL && strcmp (prop, "storage") == 0 && !dbus_error_is_set (&error)) {
+ /* the device has passed all tests, so it should be a usable player */
+ result = TRUE;
+ }
+
+ libhal_free_string (prop);
+ free_dbus_error ("checking device access method", &error);
+ }
+
+ if (result == FALSE) {
rb_debug ("device cannot be accessed via storage");
}
- libhal_free_string (prop);
- free_dbus_error ("checking device access method", &error);
} else {
rb_debug ("device is not an audio player");
}
|