From: "Claudio Takahasi" <cktakahasi@gmail.com>
To: "BlueZ development" <bluez-devel@lists.sourceforge.net>
Subject: Re: [Bluez-devel] [PATCH]Adapter D-Bus path on raw mode
Date: Wed, 1 Aug 2007 10:56:40 -0300 [thread overview]
Message-ID: <e1effdeb0708010656r2f0125f5qd84a2a97691859d3@mail.gmail.com> (raw)
In-Reply-To: <e1effdeb0707310734w7004e158te4b82dfea931bb40@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 428 bytes --]
On 7/31/07, Claudio Takahasi <cktakahasi@gmail.com> wrote:
> Hi Marcel,
>
> here is the patch to avoid register the D-Bus adapter path when the
> RAW flag is active.
>
> ListAdapters and FindAdapter were fixed too.
>
> Claudio
> --
> ---------------------------------------------------------
> Claudio Takahasi
> Instituto Nokia de Tecnologia - INdT
>
Hi Marcel,
here is a new version based on your suggestions.
BR,
Claudio.
[-- Attachment #2: raw03.patch --]
[-- Type: text/x-diff, Size: 2351 bytes --]
Index: hcid/dbus-manager.c
===================================================================
RCS file: /cvsroot/bluez/utils/hcid/dbus-manager.c,v
retrieving revision 1.68
diff -u -r1.68 dbus-manager.c
--- hcid/dbus-manager.c 4 May 2007 15:32:27 -0000 1.68
+++ hcid/dbus-manager.c 1 Aug 2007 13:52:53 -0000
@@ -103,6 +103,7 @@
{
DBusMessage *reply;
char path[MAX_PATH_LENGTH], *path_ptr = path;
+ struct hci_dev_info di;
const char *pattern;
int dev_id;
@@ -115,6 +116,12 @@
if (dev_id < 0)
return error_no_such_adapter(conn, msg);
+ if (hci_devinfo(dev_id, &di) < 0)
+ return error_no_such_adapter(conn, msg);
+
+ if (hci_test_bit(HCI_RAW, &di.flags))
+ return error_no_such_adapter(conn, msg);
+
reply = dbus_message_new_method_return(msg);
if (!reply)
return DBUS_HANDLER_RESULT_NEED_MEMORY;
@@ -177,6 +184,9 @@
if (hci_devinfo(dr->dev_id, &di) < 0)
continue;
+ if (hci_test_bit(HCI_RAW, &di.flags))
+ continue;
+
snprintf(path, sizeof(path), "%s/%s", BASE_PATH, di.name);
dbus_message_iter_append_basic(&array_iter,
Index: hcid/main.c
===================================================================
RCS file: /cvsroot/bluez/utils/hcid/main.c,v
retrieving revision 1.98
diff -u -r1.98 main.c
--- hcid/main.c 31 Jul 2007 12:27:23 -0000 1.98
+++ hcid/main.c 1 Aug 2007 13:52:53 -0000
@@ -523,14 +523,14 @@
if (ioctl(dd, HCIDEVUP, dev_id) < 0 && errno != EALREADY) {
error("Can't init device hci%d: %s (%d)",
dev_id, strerror(errno), errno);
- exit(1);
+ goto fail;
}
if (hci_devinfo(dev_id, &di) < 0)
- exit(1);
+ goto fail;
if (hci_test_bit(HCI_RAW, &di.flags))
- exit(0);
+ goto done;
if (hcid.offmode == HCID_OFFMODE_DEVDOWN) {
char mode[16];
@@ -538,20 +538,29 @@
if (read_device_mode(&di.bdaddr, mode, sizeof(mode)) == 0 &&
strcmp(mode, "off") == 0) {
ioctl(dd, HCIDEVDOWN, dev_id);
- exit(0);
+ goto done;
}
}
-
+done:
hci_close_dev(dd);
-
exit(0);
+fail:
+ hci_close_dev(dd);
+ exit(1);
}
static void device_devreg_setup(int dev_id)
{
+ struct hci_dev_info di;
+
if (hcid.auto_init)
init_device(dev_id);
- hcid_dbus_register_device(dev_id);
+
+ if (hci_devinfo(dev_id, &di) < 0)
+ return;
+
+ if (!hci_test_bit(HCI_RAW, &di.flags))
+ hcid_dbus_register_device(dev_id);
}
static void device_devup_setup(int dev_id)
[-- Attachment #3: Type: text/plain, Size: 315 bytes --]
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
[-- 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
prev parent reply other threads:[~2007-08-01 13:56 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-31 14:34 [Bluez-devel] [PATCH]Adapter D-Bus path on raw mode Claudio Takahasi
2007-08-01 13:56 ` Claudio Takahasi [this message]
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=e1effdeb0708010656r2f0125f5qd84a2a97691859d3@mail.gmail.com \
--to=cktakahasi@gmail.com \
--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