[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

rpms/gnome-vfs2-obexftp/F-7 README.licence, NONE, 1.1 TODO, NONE, 1.1 gnome-vfs2-obexftp-use-rfcomm-sockets.patch, NONE, 1.1 gnome-vfs2-obexftp.spec, NONE, 1.1 osso-gwobex-check-read-retval-2.patch, NONE, 1.1 osso-gwobex-check-read-retval.patch, NONE, 1.1 osso-gwobex-check-write-retval.patch, NONE, 1.1 .cvsignore, 1.1, 1.2 sources, 1.1, 1.2



Author: hadess

Update of /cvs/pkgs/rpms/gnome-vfs2-obexftp/F-7
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv21017/F-7

Modified Files:
	.cvsignore sources 
Added Files:
	README.licence TODO 
	gnome-vfs2-obexftp-use-rfcomm-sockets.patch 
	gnome-vfs2-obexftp.spec osso-gwobex-check-read-retval-2.patch 
	osso-gwobex-check-read-retval.patch 
	osso-gwobex-check-write-retval.patch 
Log Message:
Import gnome-vfs2-obexftp into F7 branch


--- NEW FILE README.licence ---
The gnome-vfs2-obexftp package in binary format is believed to be
released under the GPL.

>From https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=231005#c3

"
- dbus-glib is AFL/GPL.  AFL 2.1 is not compatible with GPL [...].
- gnome-vfs2 is LGPL or GPL.
- openobex is a mixture of LGPL and GPL code, probably making it GPL.
"

The sources retain their original licences.

Saturday 26 May 2007
Bastien Nocera <bnocera redhat com>



--- NEW FILE TODO ---
TODO list for gnome-vfs2-obexftp

- filter to only show obex transfer enabled devices in obex:/// (but only from cache!)
- deal nicely with adapters being removed/added, right now it hangs listings or copies
- make delete while creating thumbnails work (concurrency--)


gnome-vfs2-obexftp-use-rfcomm-sockets.patch:

--- NEW FILE gnome-vfs2-obexftp-use-rfcomm-sockets.patch ---
diff -upr gnome-vfs-obexftp-0.2.orig/src/Makefile.am gnome-vfs-obexftp-0.2/src/Makefile.am
--- gnome-vfs-obexftp-0.2.orig/src/Makefile.am	2007-05-26 14:27:16.000000000 +0100
+++ gnome-vfs-obexftp-0.2/src/Makefile.am	2007-05-29 18:20:35.000000000 +0100
@@ -23,6 +23,7 @@ libobex_la_LIBADD = 			\
 	$(top_builddir)/osso-gwobex/src/libgwobex.la \
 	$(OBEX_MODULE_LIBS) 		\
 	$(XML_LIBS)			\
+	-lbluetooth			\
 	libom.la
 
 noinst_LTLIBRARIES = libom.la
diff -upr gnome-vfs-obexftp-0.2.orig/src/obex-method.c gnome-vfs-obexftp-0.2/src/obex-method.c
--- gnome-vfs-obexftp-0.2.orig/src/obex-method.c	2007-05-26 14:27:16.000000000 +0100
+++ gnome-vfs-obexftp-0.2/src/obex-method.c	2007-05-30 14:15:56.000000000 +0100
@@ -61,7 +61,7 @@ typedef struct {
 	gchar  *dev;
 
 	/* The device we're connected to if we're connected. */
-	gchar  *connected_dev;
+	gint    fd;
 
 	GMainContext *context;
 	GwObex       *obex;
@@ -251,11 +251,10 @@ om_connection_free (ObexConnection *conn
 		gw_obex_close (conn->obex);
 	}
 	
-	if (conn->connected_dev) {
+	if (conn->fd >= 0) {
 		d(g_printerr ("obex: om_connection_free calls disconnect\n"));
-		om_dbus_disconnect_dev (conn->connected_dev);
-		g_free (conn->connected_dev);
-		conn->connected_dev = NULL;
+		om_dbus_disconnect_dev (conn->fd);
+		conn->fd = -1;
 	}
 
 	if (conn->context) {
@@ -315,7 +314,7 @@ om_connection_reset (ObexConnection *con
 {
 	GnomeVFSResult  result;
 	GwObex         *obex;
-	gchar          *real_dev;
+	gint            fd;
 	gint            error;
 
 	if (conn->obex) {
@@ -325,39 +324,32 @@ om_connection_reset (ObexConnection *con
 		conn->disconnected = TRUE;
 	}
 
-	if (conn->connected_dev) {
+	if (conn->fd > 0) {
 		d(g_printerr ("obex: om_connection_reset calls disconnect\n"));
-		om_dbus_disconnect_dev (conn->connected_dev);
-		g_free (conn->connected_dev);
-		conn->connected_dev = NULL;
-	}
-	
-	if (strncmp (conn->dev, "/dev/rfcomm", 11) == 0) {
-		real_dev = g_strdup (conn->dev);
-	} else {
-		real_dev = om_dbus_get_dev (conn->dev, &result);
-		if (real_dev == NULL) {
-			return result;
-		}
+		om_dbus_disconnect_dev (conn->fd);
+		conn->fd = -1;
 	}
 
+	fd = om_dbus_get_dev (conn->dev, &result);
+	if (fd < 0)
+		return result;
+
 	/* New connection, set it up. */
 	if (!conn->context) {
 		conn->context = g_main_context_new ();
 	}
 
 	error = 0;
-	obex = gw_obex_setup_dev (real_dev, OBEX_FTP_UUID, 
-                                  OBEX_FTP_UUID_LEN, conn->context, &error);
+	obex = gw_obex_setup_fd (fd, OBEX_FTP_UUID,
+				 OBEX_FTP_UUID_LEN, conn->context, &error);
 	if (obex == NULL) {
 		d(g_printerr ("obex: om_connection_reset calls disconnect (error)\n"));
-		om_dbus_disconnect_dev (real_dev);
-		g_free (real_dev);
-		
+		om_dbus_disconnect_dev (fd);
+
 		return om_utils_obex_error_to_vfs_result (error);
 	}
 	
-	conn->connected_dev = real_dev;
+	conn->fd = fd;
 	conn->obex = obex;
 	conn->disconnected = FALSE;
 
@@ -374,7 +366,6 @@ om_connection_reset (ObexConnection *con
 
 /* Get an OBEX connection. The URI should be on the form:
  *
- * obex://rfcommX/path/to/file, where "rfcommX" maps to /dev/rfcommX or
  * obex://[00:00:00:00:00:00]/path/to/file, in which case gwcond is used to lookup
  * the device with the specific BDA.
  */
diff -upr gnome-vfs-obexftp-0.2.orig/src/om-dbus.c gnome-vfs-obexftp-0.2/src/om-dbus.c
--- gnome-vfs-obexftp-0.2.orig/src/om-dbus.c	2007-05-26 14:27:17.000000000 +0100
+++ gnome-vfs-obexftp-0.2/src/om-dbus.c	2007-05-30 14:11:23.000000000 +0100
@@ -18,9 +18,23 @@
  * Boston, MA 02111-1307, USA.
  */
 
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
+
+#include <errno.h>
+#include <stdlib.h>
+#include <stdint.h>
 #include <ctype.h>
-#include <string.h>
+
+/* FIXME stupid thing */
+#define inline
+
+#include <bluetooth/bluetooth.h>
+#include <bluetooth/sdp.h>
+#include <bluetooth/sdp_lib.h>
+#include <bluetooth/rfcomm.h>
+
 #include <gw-obex.h>
 
 #define DBUS_API_SUBJECT_TO_CHANGE
@@ -96,8 +110,6 @@ connection_free (Connection *conn)
 	g_free (conn);
 }
 
-
-
 static gboolean
 foreach_adapter (Connection *conn, ForeachAdapterFunc func, gpointer user_data)
 {
@@ -150,42 +162,6 @@ foreach_adapter (Connection *conn, Forea
 	return TRUE;
 }
 
-
-/* This assumes that the connection is setup and that the bda has been checked
- * for correctness.
- */
-
-
-
-static void
-send_cancel_connect (Connection  *conn,
-		     const gchar *adapter,
-		     const gchar *bda,
-		     const gchar *profile)
-{
-	DBusMessage *message;
-
-	d(g_printerr ("obex: Send cancel connect.\n"));
-	
-	message = dbus_message_new_method_call ("org.bluez",
-						adapter,
-						"org.bluez.RFCOMM",
-						"CancelConnect");
-	if (!message) {
-		g_error ("Out of memory");
-	}
-
-	if (!dbus_message_append_args (message,
-				       DBUS_TYPE_STRING, &bda,
-				       DBUS_TYPE_STRING, &profile,
-				       DBUS_TYPE_INVALID)) {
-		g_error ("Out of memory");
-	}
-
-	dbus_connection_send (conn->dbus_conn, message, NULL);
-	dbus_message_unref (message);
-}
-
 static gboolean
 check_bda (const gchar *bda)
 {
@@ -215,135 +191,196 @@ check_bda (const gchar *bda)
 	return TRUE;
 }
 
-struct get_dev_t {
-	const gchar    *bda;
-	GnomeVFSResult *result;
-	gboolean        invalid_profile;
-	gboolean        already_connected;
-	gchar          *dev;
-};
+static int
+connect_rfcomm (const char *source_bdaddr, const char *dest_bdaddr, uint8_t channel)
+{
+	struct sockaddr_rc addr;
+	int fd;
 
+	fd = socket(AF_BLUETOOTH, SOCK_STREAM, BTPROTO_RFCOMM);
+	if (fd < 0)
+		return -1;
 
-/* Note: This needs to be refactored for the next version, we need our own
- * return value here, which can include invalid profile and already connected as
- * results. We can also move the bda checking to the caller, it only needs
- * checked once.
- */
-static gchar *
-get_dev (Connection       *conn,
-	 const gchar      *adapter,
-	 struct get_dev_t *data,
-	 const char       *profile)
+	memset(&addr, 0, sizeof(addr));
+	addr.rc_family  = AF_BLUETOOTH;
+
+	str2ba(source_bdaddr, &addr.rc_bdaddr);
+	addr.rc_channel = 0;
+
+	if (bind(fd, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
+		d(g_printerr ("connect_rfcomm can't bind: %s", g_strerror (errno)));
+		return -1;
+	}
+
+	/* We don't set the file descriptor non-blocking otherwise we'd have
+	 * to have a callback to check on the progress of the operation, I don't
+	 * fancy doing that... */
+
+	addr.rc_family  = AF_BLUETOOTH;
+	str2ba(dest_bdaddr, &addr.rc_bdaddr);
+	addr.rc_channel = channel;
+
+	if (connect(fd, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
+		d(g_printerr ("connect_rfcomm can't connect: %s", g_strerror (errno)));
+		close (fd);
+		return -1;
+	}
+
+	return fd;
+}
+
+static char *
+get_adapter_bdaddr (Connection *conn,
+		    const char *adapter)
 {
 	DBusMessage *message = NULL;
 	DBusMessage *reply = NULL;
 	DBusError    dbus_error;
-	gboolean     ret;
-	gchar       *str;
-	gchar       *dev = NULL;
-
-	*data->result = GNOME_VFS_ERROR_INTERNAL;
-	data->invalid_profile = FALSE;
-	data->already_connected = FALSE;
-	
+	char        *bdaddr, *str;
+
 	message = dbus_message_new_method_call ("org.bluez",
 						adapter,
-						"org.bluez.RFCOMM",
-						"Connect");
-	if (!message) {
-		*data->result = GNOME_VFS_ERROR_NO_MEMORY;
-		goto end;
-	}
-
-	if (!dbus_message_append_args (message,
-				       DBUS_TYPE_STRING, &data->bda,
-				       DBUS_TYPE_STRING, &profile,
-				       DBUS_TYPE_INVALID)) {
-		*data->result = GNOME_VFS_ERROR_NO_MEMORY;
-		goto end;
-	}
+						"org.bluez.Adapter",
+						"GetAddress");
 
-	d(g_printerr ("obex: Send connect.\n"));
+	if (!message)
+		return NULL;
 
 	dbus_error_init (&dbus_error);
 	reply = dbus_connection_send_with_reply_and_block (conn->dbus_conn,
 							   message, -1,
 							   &dbus_error);
 
-	/*
-	  org.bluez.Error.DoesNotExist <- no remote device, or bad profile
-	  org.bluez.Error.ConnectionAttemptFailed <- already connected?
-	  org.bluez.Error.Canceled <- canceled
-	 */
+	dbus_message_unref (message);
 
 	if (dbus_error_is_set (&dbus_error)) {
-		d(g_printerr ("obex: %s: %s\n", dbus_error.name,
-			      dbus_error.message));
-		if (strcmp (dbus_error.name,
-				 "org.bluez.Error.DoesNotExist") == 0) {
-			*data->result = GNOME_VFS_ERROR_SERVICE_NOT_AVAILABLE;
-			data->invalid_profile = TRUE;
-		}
-		else if (strcmp (dbus_error.name,
-				 "org.bluez.Error.ConnectionAttemptFailed") == 0) {
-			*data->result = GNOME_VFS_ERROR_SERVICE_NOT_AVAILABLE;
-			data->already_connected = TRUE;
-		}
-		else if (strcmp (dbus_error.name,
-				 "org.bluez.Error.Canceled") == 0) {
-			*data->result = GNOME_VFS_ERROR_INTERRUPTED;
-		}
-		else if (strcmp (dbus_error.name,
-				 DBUS_ERROR_NAME_HAS_NO_OWNER) == 0 ||
-			 strcmp (dbus_error.name,
-				 DBUS_ERROR_SERVICE_UNKNOWN) == 0) {
-			*data->result = GNOME_VFS_ERROR_SERVICE_NOT_AVAILABLE;
-		}
-		else if (strcmp (dbus_error.name, DBUS_ERROR_NO_REPLY) == 0) {
-			/* We get this when hcid times out. Cancel the
-			 * connection so that hcid knows that this end will
-			 * not be interested in the connection if we time out.
-			 */
-			send_cancel_connect (conn, adapter,
-					     data->bda, profile);
-			
-			*data->result = GNOME_VFS_ERROR_SERVICE_NOT_AVAILABLE;
-		} else {
-			*data->result = GNOME_VFS_ERROR_INTERNAL;
-		}
-
+		if (reply)
+			dbus_message_unref (reply);
+		d(g_printerr ("Couldn't get the bdaddr for source '%s': %s\n", adapter, dbus_error.name));
 		dbus_error_free (&dbus_error);
-		goto end;
+		return NULL;
 	}
-	
+
 	if (!reply) {
-		*data->result = GNOME_VFS_ERROR_SERVICE_NOT_AVAILABLE;
-		goto end;
+		d(g_printerr ("Couldn't get the bdaddr for source '%s'\n", adapter));
+		return NULL;
+	}
+
+	if (!dbus_message_get_args (reply, NULL,
+				    DBUS_TYPE_STRING, &str,
+				    DBUS_TYPE_INVALID)) {
+		dbus_message_unref (reply);
+		return NULL;
+	}
+
+	bdaddr = g_strdup (str);
+	dbus_message_unref (reply);
+
+	return bdaddr;
+}
+
+/* Stolen from bluez-utils/cups/sdp.c */
+static int
+sdp_search_obexftp (sdp_session_t *sdp,
+		    uint8_t       *channel)
+{
+	sdp_list_t *srch, *attrs, *rsp;
+	uuid_t svclass;
+	uint16_t attr;
+	int err;
+
+	if (!sdp)
+		return -1;
+
+	sdp_uuid16_create (&svclass, OBEX_FILETRANS_SVCLASS_ID);
+	srch = sdp_list_append (NULL, &svclass);
+
+	attr = SDP_ATTR_PROTO_DESC_LIST;
+	attrs = sdp_list_append (NULL, &attr);
+
+	err = sdp_service_search_attr_req (sdp, srch, SDP_ATTR_REQ_INDIVIDUAL, attrs, &rsp);
+	if (err)
+		return -1;
+
+	for (; rsp; rsp = rsp->next) {
+		sdp_record_t *rec = (sdp_record_t *) rsp->data;
+		sdp_list_t *protos;
+
+		if (!sdp_get_access_protos (rec, &protos)) {
+			uint8_t ch = sdp_get_proto_port (protos, RFCOMM_UUID);
+			if (ch > 0) {
+				*channel = ch;
+				return 0;
+			}
+		}
 	}
 
-	ret = dbus_message_get_args (reply, NULL,
-				     DBUS_TYPE_STRING, &str,
-				     DBUS_TYPE_INVALID);
+	return -1;
+}
+
+struct get_dev_t {
+	const gchar    *bda;
+	GnomeVFSResult *result;
+	gboolean        invalid_profile;
+	gboolean        already_connected;
+	int             fd;
+};
 
-	if (!ret) {
+/* Note: This needs to be refactored for the next version, we need our own
+ * return value here, which can include invalid profile and already connected as
+ * results. We can also move the bda checking to the caller, it only needs
+ * checked once.
+ */
+static int
+get_dev (Connection       *conn,
+	 const gchar      *adapter,
+	 struct get_dev_t *data,
+	 const char       *profile)
+{
+	sdp_session_t *sdp;
+	uint8_t        channel;
+	int            fd = -1;
+	bdaddr_t       source_bdaddr, dest_bdaddr;
+	const char    *source_bdaddr_str;
+
+	source_bdaddr_str = get_adapter_bdaddr (conn, adapter);
+	if (source_bdaddr_str == NULL) {
+		d(g_printerr("get_dev: Can't get bdaddr for adapter '%s'", adapter));
+		*data->result = GNOME_VFS_ERROR_INTERNAL;
+		return -1;
+	}
+
+	str2ba (source_bdaddr_str, &source_bdaddr);
+	str2ba (data->bda, &dest_bdaddr);
+	sdp = sdp_connect (&source_bdaddr, &dest_bdaddr, SDP_RETRY_IF_BUSY);
+	if (!sdp) {
+		d(g_printerr("get_dev: Can't open connection to SDP daemon"));
 		*data->result = GNOME_VFS_ERROR_SERVICE_NOT_AVAILABLE;
-		goto end;
+		return -1;
 	}
-	
-	dev = g_strdup (str);
+	if (sdp_search_obexftp (sdp, &channel) < 0) {
+		d(g_printerr("get_dev: can't get channel for '%s' on '%s'",
+			     profile, data->bda));
+		*data->result = GNOME_VFS_ERROR_SERVICE_NOT_AVAILABLE;
+		sdp_close(sdp);
+		return -1;
+	}
+	sdp_close(sdp);
+
+	d(g_printerr ("obex: Send connect to '%s' channel %d.\n", data->bda, channel));
+
+	fd = connect_rfcomm (source_bdaddr_str, data->bda, channel);
+
+	d(g_printerr ("obex: Sent connect to '%s' channel %d (res = %d).\n", data->bda, channel, fd));
+
 	*data->result = GNOME_VFS_OK;
- end:
-	if (reply)
-		dbus_message_unref (reply);
-	if (message)
-		dbus_message_unref (message);
 
-	return dev;
+	return fd;
 }
 
 #define NOKIA_FTP_UUID "00005005-0000-1000-8000-0002ee000001"
 
-gboolean
+static gboolean
 adapter_get_dev(Connection *conn,
 		const gchar *adapter,
 		gpointer user_data)
@@ -361,17 +398,17 @@ adapter_get_dev(Connection *conn,
 	 * why).
 	 */
 	profile = NOKIA_FTP_UUID;
-	data->dev = get_dev (conn, adapter, data, profile);
-	if (!data->dev && data->invalid_profile) {
+	data->fd = get_dev (conn, adapter, data, profile);
+	if (data->fd < 0 && data->invalid_profile) {
 		profile = "FTP";
-		data->dev = get_dev (conn, adapter, data, profile);
+		data->fd = get_dev (conn, adapter, data, profile);
 	}
 
 	/* only continue iteration if dev is still NULL */
-	return data->dev == NULL;
+	return data->fd < 0;
 }
 
-gchar *
+int
 om_dbus_get_dev (const gchar *bda, GnomeVFSResult *result)
 {
 	Connection      *conn;
@@ -379,26 +416,26 @@ om_dbus_get_dev (const gchar *bda, Gnome
 
 	if (!check_bda (bda)) {
 		*result = GNOME_VFS_ERROR_INVALID_URI;
-		return NULL;
+		return -1;
 	}
 
 	conn = get_system_bus_connection ();
 	if (!conn) {
 		*result = GNOME_VFS_ERROR_SERVICE_NOT_AVAILABLE;
-		return NULL;
+		return -1;
 	}
 
 	data.bda = bda;
 	data.result = result;
 	data.invalid_profile = FALSE;
 	data.already_connected = FALSE;
-	data.dev = NULL;
+	data.fd = -1;
 
 	foreach_adapter(conn, adapter_get_dev, (gpointer)&data);
 	
 	connection_free (conn);
 	
-	return data.dev;
+	return data.fd;
 }
 
 static gboolean
@@ -406,49 +443,17 @@ send_disconnect (Connection *conn,
 		 const gchar *adapter,
 		 gpointer user_data)
 {
-	const gchar *dev = (const gchar *)user_data;
-	DBusMessage *message;
-	DBusMessage *reply;
-	DBusError    dbus_error;
-	gboolean error_occurred;
+	int fd = GPOINTER_TO_INT (user_data);
 
-	d(g_printerr ("obex: Send disconnect.\n"));
-	
-	message = dbus_message_new_method_call ("org.bluez",
-						adapter,
-						"org.bluez.RFCOMM",
-						"Disconnect");
-	if (!message) {
-		g_error ("Out of memory");
-		return FALSE;
+	if (fd >= 0) {
+		close (fd);
+		return TRUE;
 	}
-	
-	if (!dbus_message_append_args (message,
-				       DBUS_TYPE_STRING, &dev,
-				       DBUS_TYPE_INVALID)) {
-		g_error ("Out of memory");
-		return FALSE;
-	}
-
-	dbus_error_init (&dbus_error);
-	reply = dbus_connection_send_with_reply_and_block (conn->dbus_conn,
-							   message, -1,
-							   &dbus_error);
-	if ((error_occurred = dbus_error_is_set (&dbus_error))) {
-		dbus_error_free (&dbus_error);
-	}
-	dbus_message_unref (message);
-
-	if (reply) {
-		dbus_message_unref (reply);
-	}
-
-	/* if an error occurred, continue to the next adapter */
-	return error_occurred;
+	return FALSE;
 }
 
 void
-om_dbus_disconnect_dev (const gchar *dev)
+om_dbus_disconnect_dev (int fd)
 {
 	Connection *conn;
 
@@ -456,8 +461,8 @@ om_dbus_disconnect_dev (const gchar *dev
 	if (!conn) {
 		return;
 	}
-	
-	foreach_adapter (conn, send_disconnect, (gpointer)dev);
+
+	foreach_adapter (conn, send_disconnect, GINT_TO_POINTER (fd));
 	connection_free (conn);
 }
 
@@ -698,7 +703,7 @@ list_bondings (Connection *conn,
 	msg = dbus_message_new_method_call ("org.bluez",
 					    adapter, 
 					    "org.bluez.Adapter", 
-					    "ListBondings");
+					    "ListRemoteDevices");
 
 	if (!msg) {
 		return FALSE;
diff -upr gnome-vfs-obexftp-0.2.orig/src/om-dbus.h gnome-vfs-obexftp-0.2/src/om-dbus.h
--- gnome-vfs-obexftp-0.2.orig/src/om-dbus.h	2007-05-26 14:27:17.000000000 +0100
+++ gnome-vfs-obexftp-0.2/src/om-dbus.h	2007-05-29 18:28:20.000000000 +0100
@@ -24,8 +24,8 @@
 #include <glib.h>
 #include <libgnomevfs/gnome-vfs.h>
 
-gchar *om_dbus_get_dev          (const gchar *bda, GnomeVFSResult *result);
-void   om_dbus_disconnect_dev   (const gchar *dev);
+int    om_dbus_get_dev          (const gchar *bda, GnomeVFSResult *result);
+void   om_dbus_disconnect_dev   (int fd);
 gchar *om_dbus_get_display_name (const gchar *bda, GnomeVFSResult *result);
 
 GList *om_dbus_get_dev_list   (void);
diff -upr gnome-vfs-obexftp-0.2.orig/src/ovu-cap-parser.c gnome-vfs-obexftp-0.2/src/ovu-cap-parser.c
--- gnome-vfs-obexftp-0.2.orig/src/ovu-cap-parser.c	2007-05-26 14:27:16.000000000 +0100
+++ gnome-vfs-obexftp-0.2/src/ovu-cap-parser.c	2007-05-30 13:40:21.000000000 +0100
@@ -162,7 +162,8 @@ cap_parser_start_node_cb (void        *u
 		}
 
 		version = cap_parser_get_attribute_value ("version", attr);
-		if (strcmp (version, "1.0") != 0) {
+		/* Assume an empty version is fine */
+		if (strcmp (version, "1.0") != 0 && version[0] != '\0') {
 			g_warning ("Version expected is '1.0', not '%s'\n", version);
 		}
 


--- NEW FILE gnome-vfs2-obexftp.spec ---
Summary:	ObexFTP over Bluetooth support for GNOME
Name:		gnome-vfs2-obexftp
Version:	0.2
Release:	6%{?dist}
License:	GPL
Group:		Applications/Communications
URL:		http://www.gnome.org/
Source0:	http://ftp.gnome.org/pub/GNOME/sources/gnome-vfs-obexftp/%{version}/gnome-vfs-obexftp-%{version}.tar.bz2
Source1:	README.licence
Source2:	TODO

BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires:	gawk
BuildRequires:  perl(XML::Parser)
BuildRequires:	gnome-vfs2-devel >= 2.15.3
BuildRequires:	dbus-glib-devel >= 0.70
BuildRequires:  openobex-devel
BuildRequires:	expat-devel
BuildRequires:	bluez-libs-devel

# For the autoreconf
BuildRequires:	automake libtool

# From upstream osso-gwobex bug:
# https://bugs.maemo.org/show_bug.cgi?id=1137
Patch0:		osso-gwobex-check-read-retval.patch
Patch1:		osso-gwobex-check-write-retval.patch
Patch2:		osso-gwobex-check-read-retval-2.patch

Patch3:		gnome-vfs2-obexftp-use-rfcomm-sockets.patch

%description
gnome-vfs2-obexftp allows you to browse filesystems on mobile phones, or other
computers over Bluetooth, using ObexFTP. It is useful to see pictures taken
with your camera phone, or manage ringtones and themes.

%prep
%setup -q -n gnome-vfs-obexftp-%{version}
pushd osso-gwobex
%patch0 -p4 -b .read-retval
%patch1 -p4 -b .write-retval
%patch2 -p4 -b .read-retval-2
popd
%patch3 -p1 -b .rfcomm-sockets

cp m4/jhflags.m4 acinclude.m4
autoreconf

cp -a %{SOURCE1} %{SOURCE2} .

%build
%configure --enable-nautilus-workaround --disable-dependency-tracking

make %{?_smp_mflags}

%install
rm -rf $RPM_BUILD_ROOT/
make install DESTDIR=$RPM_BUILD_ROOT

# remove unpackaged file
rm -f $RPM_BUILD_ROOT%{_libdir}/gnome-vfs-2.0/modules/*.la

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(-, root, root)
%doc AUTHORS ChangeLog README README.unsupported README.licence TODO
%config %{_sysconfdir}/gnome-vfs-2.0/modules/obex-module.conf
%{_libdir}/gnome-vfs-2.0/modules/*.so

%changelog
* Wed May 30 2007 - Bastien Nocera <bnocera redhat com> - 0.2-6
- Fix description, this package isn't split from gnome-vfs2
- Add the dist to the release
- Use the "perl correct" build requires for intltool's dependencies
- Add missing BRs for the autoreconf
- Add TODO file

* Wed May 30 2007 - Bastien Nocera <bnocera redhat com> - 0.2-5
- Use rfcomm sockets instead of the RFCOMM and/or Serial services
  (faster, cleaner, more robust), rmeove bluez-utils requirement
- Assume an empty version in the obex FTP listing is still fine
- Remove obsolete obex://rfcommX/path/to/file URI support
- List all known devices in obex:/// not just bonded ones

* Sun May 27 2007 - Bastien Nocera <bnocera redhat com> - 0.2-4
- And some other patches for the read retval fix, and a write retval fix

* Sat May 26 2007 - Bastien Nocera <bnocera redhat com> - 0.2-3
- Apply an upstream patch to osso-gwobex, to avoid the build warnings
- Add a licence file to clarify why the package is GPL
- Use the new bluez-libs serial service, instead of the old RFCOMM interface

* Mon Mar 12 2007 - Bastien Nocera <bnocera redhat com> - 0.2-2
- Fix some cosmetic issues, thanks to Ville Skyttä <ville skytta iki fi>

* Mon Mar 05 2007 - Bastien Nocera <bnocera redhat com> - 0.2-1
- First version based on the Mandriva package


osso-gwobex-check-read-retval-2.patch:

--- NEW FILE osso-gwobex-check-read-retval-2.patch ---
--- projects/connectivity/osso-gwobex/trunk/src/obex-priv.c	2007/05/27 00:47:37	11876
+++ projects/connectivity/osso-gwobex/trunk/src/obex-priv.c	2007/05/27 00:52:26	11877
@@ -386,7 +386,7 @@
             while (written < actual) {
                 int ret;
 
-                ret = write(xfer->stream_fd, buf, actual - written);
+                ret = write(xfer->stream_fd, buf + written, actual - written);
                 if (ret < 0 && errno == EINTR)
                     continue;
 

osso-gwobex-check-read-retval.patch:

--- NEW FILE osso-gwobex-check-read-retval.patch ---
--- projects/connectivity/osso-gwobex/trunk/src/obex-priv.c	2006/09/18 10:42:37	6418
+++ projects/connectivity/osso-gwobex/trunk/src/obex-priv.c	2007/04/18 13:09:13	11126
@@ -380,8 +380,21 @@
 
             xfer->do_cb = TRUE;
         }
-        else if (xfer->stream_fd >= 0)
-            (void) write(xfer->stream_fd, buf, actual);
+        else if (xfer->stream_fd >= 0) {
+            int written = 0;
+
+            while (written < actual) {
+                int ret;
+
+                ret = write(xfer->stream_fd, buf, actual);
+                if (ret < 0 && errno != EINTR) {
+                    debug("Could not write: %s (%d)", g_strerror(errno), errno);
+                    break;
+                }
+
+                written += ret;
+            }
+        }
         else {
             xfer->buf = g_realloc(xfer->buf, xfer->counter);
             memcpy(&xfer->buf[xfer->buf_size], buf, actual);

osso-gwobex-check-write-retval.patch:

--- NEW FILE osso-gwobex-check-write-retval.patch ---
--- projects/connectivity/osso-gwobex/trunk/src/obex-priv.c	2007/04/18 13:09:13	11126
+++ projects/connectivity/osso-gwobex/trunk/src/obex-priv.c	2007/05/27 00:47:37	11876
@@ -386,8 +386,11 @@
             while (written < actual) {
                 int ret;
 
-                ret = write(xfer->stream_fd, buf, actual);
-                if (ret < 0 && errno != EINTR) {
+                ret = write(xfer->stream_fd, buf, actual - written);
+                if (ret < 0 && errno == EINTR)
+                    continue;
+
+                if (ret < 0) {
                     debug("Could not write: %s (%d)", g_strerror(errno), errno);
                     break;
                 }


Index: .cvsignore
===================================================================
RCS file: /cvs/pkgs/rpms/gnome-vfs2-obexftp/F-7/.cvsignore,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- .cvsignore	31 May 2007 13:52:24 -0000	1.1
+++ .cvsignore	31 May 2007 14:18:02 -0000	1.2
@@ -0,0 +1 @@
+gnome-vfs-obexftp-0.2.tar.bz2


Index: sources
===================================================================
RCS file: /cvs/pkgs/rpms/gnome-vfs2-obexftp/F-7/sources,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- sources	31 May 2007 13:52:24 -0000	1.1
+++ sources	31 May 2007 14:18:02 -0000	1.2
@@ -0,0 +1 @@
+f0fc8855925031cab95c1e5d204c136a  gnome-vfs-obexftp-0.2.tar.bz2


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]