linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [Bluez-devel] [DBUS PATCH] msg_func_device: wrong request handling for unknow methods
@ 2006-02-22 17:12 Claudio Takahasi
  2006-02-22 17:44 ` Marcel Holtmann
  0 siblings, 1 reply; 2+ messages in thread
From: Claudio Takahasi @ 2006-02-22 17:12 UTC (permalink / raw)
  To: bluez-devel

[-- Attachment #1: Type: text/plain, Size: 646 bytes --]

Hi Marcel,

Here is a patch to fix the function msg_func_device.

While Eduardo was fixing the dbus-test script he noticed a strange
reply value. The daemon was returning two consecutives error
messages(unknow method and unknow path) for services   not implemented
in the path.

This bug happens due the registered fallback path associated with the
wrong return value. The "/org/bluez/Device/hciX" was returning unknow
method and the root path "/org/bluez/Device" was returning unknow
path.


Regards,
Claudio
--
---------------------------------------------------------
Claudio Takahasi
Instituto Nokia de Tecnologia - INdT

[-- Attachment #2: msg_func_device.patch --]
[-- Type: text/x-patch, Size: 1434 bytes --]

Index: hcid/dbus-device.c
===================================================================
RCS file: /cvsroot/bluez/utils/hcid/dbus-device.c,v
retrieving revision 1.6
diff -u -r1.6 dbus-device.c
--- hcid/dbus-device.c	21 Feb 2006 23:55:19 -0000	1.6
+++ hcid/dbus-device.c	22 Feb 2006 16:48:21 -0000
@@ -917,17 +917,20 @@
 	struct hci_dbus_data *dbus_data = data;
 	const char *method;
 	const char *signature;
+	const char *iface;
 	uint32_t error = BLUEZ_EDBUS_UNKNOWN_METHOD;
-	DBusHandlerResult ret = DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
 
 	method = dbus_message_get_member(msg);
 	signature = dbus_message_get_signature(msg);
+	iface = dbus_message_get_interface(msg);
 
 	syslog(LOG_INFO, "[%s,%d] path:%s, method:%s", __PRETTY_FUNCTION__, __LINE__, dbus_message_get_path(msg), method);
 
+	if (strcmp(DEVICE_INTERFACE, iface))
+		return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+
 	if (dbus_data->path_id == DEVICE_ROOT_ID) {
 		/* Device is down(path unregistered) or the path is wrong */
-		ret = DBUS_HANDLER_RESULT_HANDLED;
 		error = BLUEZ_EDBUS_UNKNOWN_PATH;
 		goto failed;
 	}
@@ -937,8 +940,6 @@
 		if (strcmp(handlers->name, method))
 			continue;
 
-		ret = DBUS_HANDLER_RESULT_HANDLED;
-
 		if (!strcmp(handlers->signature, signature)) {
 			reply = handlers->handler_func(msg, data);
 			error = 0;
@@ -962,5 +963,5 @@
 		dbus_message_unref(reply);
 	}
 
-	return ret;
+	return DBUS_HANDLER_RESULT_HANDLED;
 }






^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Bluez-devel] [DBUS PATCH] msg_func_device: wrong request handling for unknow methods
  2006-02-22 17:12 [Bluez-devel] [DBUS PATCH] msg_func_device: wrong request handling for unknow methods Claudio Takahasi
@ 2006-02-22 17:44 ` Marcel Holtmann
  0 siblings, 0 replies; 2+ messages in thread
From: Marcel Holtmann @ 2006-02-22 17:44 UTC (permalink / raw)
  To: bluez-devel

Hi Claudio,

> Here is a patch to fix the function msg_func_device.
> 
> While Eduardo was fixing the dbus-test script he noticed a strange
> reply value. The daemon was returning two consecutives error
> messages(unknow method and unknow path) for services   not implemented
> in the path.
> 
> This bug happens due the registered fallback path associated with the
> wrong return value. The "/org/bluez/Device/hciX" was returning unknow
> method and the root path "/org/bluez/Device" was returning unknow
> path.

patch has been applied. Thanks.

Regards

Marcel




-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-02-22 17:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-02-22 17:12 [Bluez-devel] [DBUS PATCH] msg_func_device: wrong request handling for unknow methods Claudio Takahasi
2006-02-22 17:44 ` Marcel Holtmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).