linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johan Hedberg <johan.hedberg@nokia.com>
To: bluez-devel@lists.sourceforge.net
Subject: Re: [Bluez-devel] Big rename for the D-Bus API
Date: Mon, 27 Feb 2006 11:10:06 +0200	[thread overview]
Message-ID: <20060227091006.GA17360@localhost.localdomain> (raw)
In-Reply-To: <1141026481.823.14.camel@localhost>

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

Hi Marcel,

On Mon, Feb 27, 2006, Marcel Holtmann wrote:
> Did you had a chance to look at the current code inside the CVS? Besides
> two or three missing methods, everything has been implemented.

I haven't really had time to look at the new code, mostly because I have
been working with an obex server implementation lately (you'll get yet
another patch for openobex from me today or tomorrow ;)

However, I took a quick look at the code and made two small fixes to the
first issues that I found (attached). The first patch cleans up
sys.stdout.write() ugliness in dbus-test (however the change is not
tested since my python version doesn't like the
"@dbus.decorators.explicitly_pass_message" stuff).

The second patch fixes the code path where hci_open_dev fails in the
hcid_dbus_setname_complete function (othervice strncpy(name, pname,
sizeof(name) - 1)) will try to access uninitialized memory).

Johan

[-- Attachment #2: dbus-test.patch --]
[-- Type: text/plain, Size: 2568 bytes --]

Index: hcid/dbus-test
===================================================================
RCS file: /cvsroot/bluez/utils/hcid/dbus-test,v
retrieving revision 1.13
diff -u -r1.13 dbus-test
--- hcid/dbus-test	26 Feb 2006 17:15:48 -0000	1.13
+++ hcid/dbus-test	27 Feb 2006 08:53:31 -0000
@@ -103,7 +103,7 @@
     def dbus_dev_setup(self):
         if not self.dev_path:
             try:
-                self.dbus_mrg_setup()
+                self.dbus_mgr_setup()
                 self.dev_path = self.manager.DefaultDevice()
             except dbus.DBusException, e:
                 print 'Failed to get default device: %s' % e
@@ -136,7 +136,7 @@
             print 'Failed to setup signal handler for manager path: %s' % e
             sys.exit(1)
 
-    def dbus_mrg_setup(self):
+    def dbus_mgr_setup(self):
         self.manager_obj = self.bus.get_object('org.bluez', '/org/bluez/Manager')
         self.manager = dbus.Interface(self.manager_obj, 'org.bluez.Manager')
 
@@ -158,28 +158,18 @@
     @dbus.decorators.explicitly_pass_message
     def dev_signal_handler(*args, **keywords):
         dbus_message = keywords["dbus_message"]
-        member = dbus_message.get_member()
-        sys.stdout.write(member) 
-        sys.stdout.write(' - ') 
-        sys.stdout.write(dbus_message.get_path())
-        sys.stdout.write(': ')
+        print '%s - %s: ' % (dbus_message.get_member(), dbus_message.get_path()),
         for arg in args[1:]:
-            sys.stdout.write(arg)
-            sys.stdout.write('   ')
-        sys.stdout.write('\n')
-        sys.stdout.flush()
+            print '%s   ' % arg,
+        print
 
     @dbus.decorators.explicitly_pass_message
     def mgr_signal_handler(*args, **keywords):
         dbus_message = keywords["dbus_message"]
-        member = dbus_message.get_member()
-        sys.stdout.write(member) 
-        sys.stdout.write(': ')
+        print '%s: ' % dbus_messsage.get_member()
         for arg in args[1:]:
-            sys.stdout.write(arg)
-            sys.stdout.write('   ')
-        sys.stdout.write('\n')
-        sys.stdout.flush()
+            print '%s   ' % arg,
+        print
 
     def signal_cb(self, sig, frame):
         print 'Caught signal, exiting'
@@ -346,7 +336,7 @@
             print 'Listening for events...'
         elif self.cmd in mgr_cmds:
             try:
-                self.dbus_mrg_setup()
+                self.dbus_mgr_setup()
             except dbus.DBusException, e:
                 print 'Failed to setup manager interface: %s' % e
                 sys.exit(1)

[-- Attachment #3: dbus-name.patch --]
[-- Type: text/plain, Size: 523 bytes --]

Index: hcid/dbus.c
===================================================================
RCS file: /cvsroot/bluez/utils/hcid/dbus.c,v
retrieving revision 1.78
diff -u -r1.78 dbus.c
--- hcid/dbus.c	26 Feb 2006 16:24:07 -0000	1.78
+++ hcid/dbus.c	27 Feb 2006 08:53:32 -0000
@@ -1078,7 +1078,7 @@
 	dd = hci_open_dev(id);
 	if (dd < 0) {
 		syslog(LOG_ERR, "HCI device open failed: hci%d", id);
-		memset(&rq, 0, sizeof(rq));
+		memset(&rp, 0, sizeof(rp));
 	} else {
 		memset(&rq, 0, sizeof(rq));
 		rq.ogf    = OGF_HOST_CTL;

  reply	other threads:[~2006-02-27  9:10 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-27  6:39 [Bluez-devel] Big rename for the D-Bus API Marcel Holtmann
2006-02-27  7:38 ` Johan Hedberg
2006-02-27  7:48   ` Marcel Holtmann
2006-02-27  9:10     ` Johan Hedberg [this message]
2006-02-27  9:19       ` Marcel Holtmann
2006-02-27  8:57   ` 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=20060227091006.GA17360@localhost.localdomain \
    --to=johan.hedberg@nokia.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;
as well as URLs for NNTP newsgroup(s).