From: Bastien Nocera <hadess@hadess.net>
To: BlueZ development <bluez-devel@lists.sourceforge.net>
Subject: Re: [Bluez-devel] [PATCH] client.c cleanup
Date: Fri, 01 Feb 2008 10:46:06 +0000 [thread overview]
Message-ID: <1201862766.2389.302.camel@cookie.hadess.net> (raw)
In-Reply-To: <1201801687.2389.286.camel@cookie.hadess.net>
[-- Attachment #1: Type: text/plain, Size: 319 bytes --]
On Thu, 2008-01-31 at 17:48 +0000, Bastien Nocera wrote:
<snip>
> About the hcid bug, should GetInfo fail when the bdaddr for the device
> isn't available, or should it just give out empty information?
Patch to allow GetAddress to fail, and don't add the information that's
not available to the GetInfo dict.
Cheers
[-- Attachment #2: bluez-utils-hcid-allow-getaddr-failure.patch --]
[-- Type: text/x-patch, Size: 2387 bytes --]
Index: adapter.c
===================================================================
RCS file: /cvsroot/bluez/utils/hcid/adapter.c,v
retrieving revision 1.13
diff -u -p -r1.13 adapter.c
--- adapter.c 28 Jan 2008 10:38:40 -0000 1.13
+++ adapter.c 1 Feb 2008 10:44:20 -0000
@@ -302,16 +302,18 @@ static DBusHandlerResult adapter_get_inf
DBUS_TYPE_STRING_AS_STRING DBUS_TYPE_VARIANT_AS_STRING
DBUS_DICT_ENTRY_END_CHAR_AS_STRING, &dict);
- dbus_message_iter_append_dict_entry(&dict, "address",
- DBUS_TYPE_STRING, &property);
-
- memset(str, 0, sizeof(str));
- property = str;
- str2ba(adapter->address, &ba);
-
- if (!read_local_name(&ba, str))
- dbus_message_iter_append_dict_entry(&dict, "name",
- DBUS_TYPE_STRING, &property);
+ if (check_address (property) == 0) {
+ dbus_message_iter_append_dict_entry(&dict, "address",
+ DBUS_TYPE_STRING, &property);
+
+ memset(str, 0, sizeof(str));
+ property = str;
+ str2ba(adapter->address, &ba);
+
+ if (!read_local_name(&ba, str))
+ dbus_message_iter_append_dict_entry(&dict, "name",
+ DBUS_TYPE_STRING, &property);
+ }
get_device_version(adapter->dev_id, str, sizeof(str));
dbus_message_iter_append_dict_entry(&dict, "version",
@@ -337,7 +339,7 @@ static DBusHandlerResult adapter_get_inf
dbus_message_iter_append_dict_entry(&dict, "discoverable_timeout",
DBUS_TYPE_UINT32, &adapter->discov_timeout);
- if (!read_local_class(&ba, cls)) {
+ if (check_address (property) == 0 && !read_local_class(&ba, cls)) {
uint32_t class;
memcpy(&class, cls, 3);
@@ -368,6 +370,9 @@ static DBusHandlerResult adapter_get_add
if (!dbus_message_has_signature(msg, DBUS_TYPE_INVALID_AS_STRING))
return error_invalid_arguments(conn, msg, NULL);
+ if (check_address (paddr) < 0)
+ return error_not_ready(conn, msg);
+
reply = dbus_message_new_method_return(msg);
if (!reply)
return DBUS_HANDLER_RESULT_NEED_MEMORY;
Index: dbus-api.txt
===================================================================
RCS file: /cvsroot/bluez/utils/hcid/dbus-api.txt,v
retrieving revision 1.135
diff -u -p -r1.135 dbus-api.txt
--- dbus-api.txt 28 Jan 2008 10:38:40 -0000 1.135
+++ dbus-api.txt 1 Feb 2008 10:44:20 -0000
@@ -335,7 +335,7 @@ Methods dict GetInfo()
Example: "00:11:22:33:44:55"
- Possible errors: none
+ Possible errors: org.bluez.Error.NotReady
string GetVersion()
[-- Attachment #3: Type: text/plain, Size: 228 bytes --]
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
[-- Attachment #4: Type: text/plain, Size: 164 bytes --]
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel
next prev parent reply other threads:[~2008-02-01 10:46 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-25 2:22 [Bluez-devel] [PATCH] client.c cleanup Bastien Nocera
2008-01-29 17:01 ` Marcel Holtmann
2008-01-29 17:24 ` Bastien Nocera
2008-01-29 17:35 ` Marcel Holtmann
2008-01-29 18:08 ` Bastien Nocera
2008-01-29 18:14 ` Marcel Holtmann
2008-01-30 17:31 ` Bastien Nocera
2008-01-31 14:57 ` Bastien Nocera
2008-01-31 17:48 ` Bastien Nocera
2008-02-01 10:46 ` Bastien Nocera [this message]
2008-02-01 12:11 ` Bastien Nocera
2008-02-01 12:23 ` Marcel Holtmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1201862766.2389.302.camel@cookie.hadess.net \
--to=hadess@hadess.net \
--cc=bluez-devel@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox