phonemgr r289 - in trunk: . libgsm



Author: hadess
Date: Mon May 12 17:19:55 2008
New Revision: 289
URL: http://svn.gnome.org/viewvc/phonemgr?rev=289&view=rev

Log:
2008-05-12  Bastien Nocera  <hadess hadess net>

	* libgsm/phonemgr-utils.c (phonemgr_utils_address_is),
	(phonemgr_utils_write_config): Use the irda connection type when
	connecting to a phone via IrDA, so that the driver knows the
	connection init is different

	* libgsm/phonemgr-listener.c (phonemgr_listener_connect):
	Sleep for a second after disconnecting from IrDA devices because
	they suck



Modified:
   trunk/ChangeLog
   trunk/libgsm/phonemgr-listener.c
   trunk/libgsm/phonemgr-utils.c

Modified: trunk/libgsm/phonemgr-listener.c
==============================================================================
--- trunk/libgsm/phonemgr-listener.c	(original)
+++ trunk/libgsm/phonemgr-listener.c	Mon May 12 17:19:55 2008
@@ -396,6 +396,7 @@
 gboolean
 phonemgr_listener_connect (PhonemgrListener *l, char *device, GError **error)
 {
+	PhonemgrConnectionType type;
 	int channel;
 
 	g_return_val_if_fail (PHONEMGR_IS_LISTENER (l), FALSE);
@@ -406,7 +407,8 @@
 
 	channel = -1;
 
-	if (phonemgr_utils_address_is (device) == PHONEMGR_CONNECTION_BLUETOOTH) {
+	type = phonemgr_utils_address_is (device);
+	if (type == PHONEMGR_CONNECTION_BLUETOOTH) {
 		channel = phonemgr_utils_get_serial_channel (device);
 		if (channel < 0) {
 			//FIXME
@@ -449,6 +451,8 @@
 	    && strcmp (l->driver, PHONEMGR_DEFAULT_USB_DRIVER) != 0) {
 		phonemgr_utils_disconnect (l->phone_state);
 		phonemgr_utils_free (l->phone_state);
+		if (type == PHONEMGR_CONNECTION_IRDA)
+			g_usleep (G_USEC_PER_SEC);
 		l->phone_state = phonemgr_utils_connect (device, l->driver, channel, l->debug, error);
 		if (l->phone_state == NULL) {
 			//FIXME

Modified: trunk/libgsm/phonemgr-utils.c
==============================================================================
--- trunk/libgsm/phonemgr-utils.c	(original)
+++ trunk/libgsm/phonemgr-utils.c	Mon May 12 17:19:55 2008
@@ -110,8 +110,10 @@
 	struct stat buf;
 
 	if (g_stat (addr, &buf) == 0 && S_ISCHR (buf.st_mode)) {
-		//FIXME this could also be IrDA
-		return PHONEMGR_CONNECTION_SERIAL;
+		if (strstr (addr, "ircomm") == NULL)
+			return PHONEMGR_CONNECTION_SERIAL;
+		else
+			return PHONEMGR_CONNECTION_IRDA;
 	} else if (bachk (addr) == 0) {
 		return PHONEMGR_CONNECTION_BLUETOOTH;
 	} else {
@@ -283,6 +285,11 @@
 					"port = %s\n"
 					"model = %s\n"
 					"connection = dku2libusb\n", addr, driver);
+	} else if (type == PHONEMGR_CONNECTION_IRDA) {
+		return g_strdup_printf ("[global]\n"
+					"port = %s\n"
+					"model = %s\n"
+					"connection = irda\n", addr, driver);
 	} else {
 		return g_strdup_printf ("[global]\n"
 			"port = %s\n"



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