public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
* [Bluez-devel] hcid dbus patches
@ 2006-09-08 11:29 Jose Vasconcellos
  2006-09-15 11:55 ` Marcel Holtmann
  0 siblings, 1 reply; 4+ messages in thread
From: Jose Vasconcellos @ 2006-09-08 11:29 UTC (permalink / raw)
  To: bluez-devel

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

Hello,

Here are a couple of patches that implement the following
commands in dbus-test:
GetRemoteClass
GetRemoteServiceHandles
GetRemoteServiceRecord

This required modifications to dbus-sdp.c. The problem was
that the call to dbus_message_get_args in this file used a NULL
pointer for the error structure. This patch adds a pointer in
the same way that dbus-adapter.c calls dbus_messsage_get_args.
The end result is that both GetRemoteService* calls now seem
to work.

Regards,

Jose Vasconcellos


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

--- dbus-test	2006-08-09 16:10:50.000000000 -0400
+++ ../../../bluez-utils-3.5/hcid/dbus-test	2006-09-08 07:00:56.000000000 -0400
@@ -55,6 +55,8 @@
              "GetEncryptionKeySize",
              "DiscoverDevices",
              "DiscoverDevicesWithoutNameResolving",
+             "GetRemoteServiceHandles",
+             "GetRemoteServiceRecord",
              "CancelDiscovery" ]
 dev_signals = [ "ModeChanged",
                 "NameChanged",
@@ -303,9 +305,9 @@
                    print self.device.GetRemoteCompany(self.cmd_args[0])
                else:
                    print 'Usage: %s -i <dev> GetRemoteCompany address' % self.name
-           elif self.cmd == 'GetRemoteAlias':
+           elif self.cmd == 'GetRemoteClass':
                if len(self.cmd_args) == 1:
-                   print self.device.GetRemoteAlias(self.cmd_args[0])
+                   print self.device.GetRemoteClass(self.cmd_args[0])
                else:
                    print 'Usage: %s -i <dev> GetRemoteAlias address' % self.name
            elif self.cmd == 'GetRemoteMajorClass':
@@ -323,6 +325,11 @@
                    print self.device.GetRemoteServiceClasses(self.cmd_args[0])
                else:
                    print 'Usage: %s -i <dev> GetRemoteServiceClasses address' % self.name
+           elif self.cmd == 'GetRemoteAlias':
+               if len(self.cmd_args) == 1:
+                   print self.device.GetRemoteAlias(self.cmd_args[0])
+               else:
+                   print 'Usage: %s -i <dev> GetRemoteAlias address' % self.name
            elif self.cmd == 'SetRemoteAlias':
                if len(self.cmd_args) == 2:
                    self.device.SetRemoteAlias(self.cmd_args[0], self.cmd_args[1])
@@ -386,6 +393,16 @@
                print self.device.DiscoverDevices()
            elif self.cmd == 'DiscoverDevicesWithoutNameResolving':
                print self.device.DiscoverDevicesWithoutNameResolving()
+           elif self.cmd == 'GetRemoteServiceHandles':
+               if len(self.cmd_args) == 1:
+                   print self.device.GetRemoteServiceHandles(self.cmd_args[0])
+               else:
+                   print 'Usage: %s -i <dev> GetRemoteServiceHandles address service' % self.name
+           elif self.cmd == 'GetRemoteServiceRecord':
+               if len(self.cmd_args) == 2:
+                   print self.device.GetRemoteServiceRecord(self.cmd_args[0],dbus.UInt32(self.cmd_args[1]))
+               else:
+                   print 'Usage: %s -i <dev> GetRemoteServiceRecord address service handle' % self.name
            else:
                 # FIXME: remove at future version
                 print 'Script Error: Method %s not found. Maybe a mispelled word.' % (self.cmd_args)

[-- Attachment #3: dbus-sdp.patch --]
[-- Type: text/x-patch, Size: 6174 bytes --]

--- dbus-sdp.c	2006-09-07 08:17:18.000000000 -0400
+++ ../../../bluez-utils-3.5/hcid/dbus-sdp.c	2006-09-08 07:11:28.000000000 -0400
@@ -444,8 +444,10 @@
 	int sk, err = 0;
 	socklen_t len;
 	const char *dst;
+	DBusError dbuserr;
 
-	dbus_message_get_args(ctxt->rq, NULL,
+	dbus_error_init(&dbuserr);
+	dbus_message_get_args(ctxt->rq, &dbuserr,
 			DBUS_TYPE_STRING, &dst,
 			DBUS_TYPE_INVALID);
 
@@ -481,6 +483,7 @@
 	DBusMessageIter iter, array_iter;
 	const char *dst;
 	int i, scanned;
+	DBusError dbuserr;
 
 	if (!ctxt)
 		return;
@@ -497,7 +500,8 @@
 		return;
 	}
 
-	dbus_message_get_args(ctxt->rq, NULL,
+	dbus_error_init(&dbuserr);
+	dbus_message_get_args(ctxt->rq, &dbuserr,
 			DBUS_TYPE_STRING, &dst,
 			DBUS_TYPE_INVALID);
 
@@ -540,6 +544,7 @@
 	uint8_t *pdata;
 	uint8_t dataType = 0;
 	int scanned, seqlen = 0;
+	DBusError dbuserr;
 
 	if (!ctxt)
 		return;
@@ -556,7 +561,8 @@
 		return;
 	}
 
-	dbus_message_get_args(ctxt->rq, NULL,
+	dbus_error_init(&dbuserr);
+	dbus_message_get_args(ctxt->rq, &dbuserr,
 			DBUS_TYPE_STRING, &dst,
 			DBUS_TYPE_INVALID);
 
@@ -612,6 +618,7 @@
 	const char *dst;
 	uint8_t *pdata;
 	int scanned = 0;
+	DBusError dbuserr;
 #ifdef SERVICE_SEARCH_ATTR_REQ
 	uint8_t dataType = 0;
 	int seqlen = 0;
@@ -638,7 +645,8 @@
 		return;
 	}
 
-	dbus_message_get_args(ctxt->rq, NULL,
+	dbus_error_init(&dbuserr);
+	dbus_message_get_args(ctxt->rq, &dbuserr,
 			DBUS_TYPE_STRING, &dst,
 			DBUS_TYPE_INVALID);
 
@@ -833,6 +841,7 @@
 	uint32_t range = 0x0000ffff;
 	const char *dst;
 	uint32_t handle;
+	DBusError dbuserr;
 	int err = 0;
 
 	if (sdp_set_notify(ctxt->session, remote_svc_rec_completed_cb, ctxt) < 0) {
@@ -841,7 +850,8 @@
 		goto fail;
 	}
 
-	dbus_message_get_args(ctxt->rq, NULL,
+	dbus_error_init(&dbuserr);
+	dbus_message_get_args(ctxt->rq, &dbuserr,
 			DBUS_TYPE_STRING, &dst,
 			DBUS_TYPE_UINT32, &handle,
 			DBUS_TYPE_INVALID);
@@ -866,13 +876,20 @@
 	struct hci_dbus_data *dbus_data = data;
 	const char *dst;
 	uint32_t handle;
+	DBusError dbuserr;
 	int err = 0;
 
-	if (!dbus_message_get_args(msg, NULL,
+	dbus_error_init(&dbuserr);
+	dbus_message_get_args(msg, &dbuserr,
 			DBUS_TYPE_STRING, &dst,
 			DBUS_TYPE_UINT32, &handle,
-			DBUS_TYPE_INVALID))
+				DBUS_TYPE_INVALID);
+
+	if (dbus_error_is_set(&dbuserr)) {
+		error("Can't extract message arguments:%s", dbuserr.message);
+		dbus_error_free(&dbuserr);
 		return error_invalid_arguments(conn, msg);
+	}
 
 	if (find_pending_connect(dst))
 		return error_service_search_in_progress(conn, msg);
@@ -923,12 +940,19 @@
 {
 	struct hci_dbus_data *dbus_data = data;
 	const char *dst;
+	DBusError dbuserr;
 	int err = 0;
 
-	if (!dbus_message_get_args(msg, NULL,
+	dbus_error_init(&dbuserr);
+	dbus_message_get_args(msg, &dbuserr,
 			DBUS_TYPE_STRING, &dst,
-			DBUS_TYPE_INVALID))
+				DBUS_TYPE_INVALID);
+
+	if (dbus_error_is_set(&dbuserr)) {
+		error("Can't extract message arguments:%s", dbuserr.message);
+		dbus_error_free(&dbuserr);
 		return error_invalid_arguments(conn, msg);
+	}
 
 	if (find_pending_connect(dst))
 		return error_service_search_in_progress(conn, msg);
@@ -984,12 +1008,19 @@
 {
 	struct hci_dbus_data *dbus_data = data;
 	const char *dst;
+	DBusError dbuserr;
 	int err = 0;
 
-	if (!dbus_message_get_args(msg, NULL,
+	dbus_error_init(&dbuserr);
+	dbus_message_get_args(msg, &dbuserr,
 			DBUS_TYPE_STRING, &dst,
-			DBUS_TYPE_INVALID))
+			DBUS_TYPE_INVALID);
+
+	if (dbus_error_is_set(&dbuserr)) {
+		error("Can't extract message arguments:%s", dbuserr.message);
+		dbus_error_free(&dbuserr);
 		return error_invalid_arguments(conn, msg);
+	}
 
 	/* in progress is not working properly */
 	if (find_pending_connect(dst))
@@ -1062,15 +1093,22 @@
 	char identifier[MAX_IDENTIFIER_LEN];
 	const char *ptr = identifier;
 	const char *dst, *svc;
+	DBusError dbuserr;
 	int err = 0, nrec = 0;
 	uint32_t class;
 	uuid_t uuid;
 
-	if (!dbus_message_get_args(msg, NULL,
+	dbus_error_init(&dbuserr);
+	dbus_message_get_args(msg, &dbuserr,
 			DBUS_TYPE_STRING, &dst,
 			DBUS_TYPE_STRING, &svc,
-			DBUS_TYPE_INVALID))
+			DBUS_TYPE_INVALID);
+
+	if (dbus_error_is_set(&dbuserr)) {
+		error("Can't extract message arguments:%s", dbuserr.message);
+		dbus_error_free(&dbuserr);
 		return error_invalid_arguments(conn, msg);
+	}
 
 	class = sdp_str2svclass(svc);
 	if (!class) {
@@ -1218,11 +1256,18 @@
 	char *ptr = uuid_str;
 	const char *identifier;
 	uint32_t handle;
+	DBusError dbuserr;
 
-	if (!dbus_message_get_args(msg, NULL,
+	dbus_error_init(&dbuserr);
+	dbus_message_get_args(msg, &dbuserr,
 				DBUS_TYPE_STRING, &identifier,
-				DBUS_TYPE_INVALID))
+				DBUS_TYPE_INVALID);
+
+	if (dbus_error_is_set(&dbuserr)) {
+		error("Can't extract message arguments:%s", dbuserr.message);
+		dbus_error_free(&dbuserr);
 		return error_invalid_arguments(conn, msg);
+	}
 
 	if (str2identifier(identifier, address, &handle) != 0)
 		return error_invalid_arguments(conn, msg);
@@ -1266,11 +1311,18 @@
 	const char *identifier;
 	uuid_t *puuid;
 	uint32_t handle;
+	DBusError dbuserr;
 
-	if (!dbus_message_get_args(msg, NULL,
+	dbus_error_init(&dbuserr);
+	dbus_message_get_args(msg, &dbuserr,
 				DBUS_TYPE_STRING, &identifier,
-				DBUS_TYPE_INVALID))
+				DBUS_TYPE_INVALID);
+
+	if (dbus_error_is_set(&dbuserr)) {
+		error("Can't extract message arguments:%s", dbuserr.message);
+		dbus_error_free(&dbuserr);
 		return error_invalid_arguments(conn, msg);
+	}
 
 	if (str2identifier(identifier, address, &handle) != 0)
 		return error_invalid_arguments(conn, msg);
@@ -1312,11 +1364,13 @@
 	char identifier[MAX_IDENTIFIER_LEN];
 	const char *ptr = identifier;
 	bdaddr_t sba;
+	DBusError dbuserr;
 	int err = 0;
 	uint8_t channel;
 
 	owner = dbus_message_get_sender(msg);
 
+	dbus_error_init(&dbuserr);
 	if (!dbus_message_get_args(msg, NULL,
 			DBUS_TYPE_STRING, &name,
 			DBUS_TYPE_BYTE, &channel,
@@ -1367,11 +1421,13 @@
 	DBusMessage *reply;
 	const char *owner, *identifier;
 	bdaddr_t sba;
+	DBusError dbuserr;
 	int err = 0;
 	uint32_t handle;
 
 	owner = dbus_message_get_sender(msg);
 
+	DBusError dbuserr;
 	if (!dbus_message_get_args(msg, NULL,
 			DBUS_TYPE_STRING, &identifier,
 			DBUS_TYPE_INVALID))

[-- Attachment #4: Type: text/plain, Size: 373 bytes --]

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

[-- Attachment #5: Type: text/plain, Size: 164 bytes --]

_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

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

* Re: [Bluez-devel] hcid dbus patches
  2006-09-08 11:29 [Bluez-devel] hcid dbus patches Jose Vasconcellos
@ 2006-09-15 11:55 ` Marcel Holtmann
  2006-09-15 13:42   ` Jose Vasconcellos
  0 siblings, 1 reply; 4+ messages in thread
From: Marcel Holtmann @ 2006-09-15 11:55 UTC (permalink / raw)
  To: BlueZ development

Hi Jose,

> Here are a couple of patches that implement the following
> commands in dbus-test:
> GetRemoteClass
> GetRemoteServiceHandles
> GetRemoteServiceRecord
> 
> This required modifications to dbus-sdp.c. The problem was
> that the call to dbus_message_get_args in this file used a NULL
> pointer for the error structure. This patch adds a pointer in
> the same way that dbus-adapter.c calls dbus_messsage_get_args.
> The end result is that both GetRemoteService* calls now seem
> to work.

I am not following that argument. If we don't care about the error code,
then why should we fill one it. If this is a problem, then the problem
is in the D-Bus low-level library or the Python bindings.

Regards

Marcel



-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

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

* Re: [Bluez-devel] hcid dbus patches
  2006-09-15 11:55 ` Marcel Holtmann
@ 2006-09-15 13:42   ` Jose Vasconcellos
  2006-09-15 13:46     ` Marcel Holtmann
  0 siblings, 1 reply; 4+ messages in thread
From: Jose Vasconcellos @ 2006-09-15 13:42 UTC (permalink / raw)
  To: BlueZ development

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

Marcel Holtmann wrote:
> Hi Jose,
>
>   
>> Here are a couple of patches that implement the following
>> commands in dbus-test:
>> GetRemoteClass
>> GetRemoteServiceHandles
>> GetRemoteServiceRecord
>>
>> This required modifications to dbus-sdp.c. The problem was
>> that the call to dbus_message_get_args in this file used a NULL
>> pointer for the error structure. This patch adds a pointer in
>> the same way that dbus-adapter.c calls dbus_messsage_get_args.
>> The end result is that both GetRemoteService* calls now seem
>> to work.
>>     
>
> I am not following that argument. If we don't care about the error code,
> then why should we fill one it. If this is a problem, then the problem
> is in the D-Bus low-level library or the Python bindings.
>
> Regards
>
> Marcel
>   
Hi Marcel,

This was my first hack with dbus. I haven't read the docs so
I'm not sure how it all works. I just noticed that the code in
dbus-adapter.c is working so put the same changes on dbus-sdp.c
and it worked.

I don't think the patch to dbus-sdp.c should be put in. Someone
with more dbus expertise should fix it. The patch to dbus-test
is simple and adds the new commands.

Sorry, that I don't have much time to help in this area. My focus
is to try to figure out how to get multiple SCO channels to work.

Jose


[-- Attachment #2: jose.vcf --]
[-- Type: text/x-vcard, Size: 288 bytes --]

begin:vcard
fn:Jose Vasconcellos
n:Vasconcellos;Jose
org:Vas & Mac Enterprises LLC
adr:;;P.O. Box 567;Red Bank;NJ;07701;USA
email;internet:jose@vasmac.com
title:Managing Member and CTO
tel;work:+1 732 978 4680 x102
tel;fax:+1 206 888 6951
url:http://www.vasmac.com
version:2.1
end:vcard


[-- Attachment #3: Type: text/plain, Size: 373 bytes --]

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

[-- 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

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

* Re: [Bluez-devel] hcid dbus patches
  2006-09-15 13:42   ` Jose Vasconcellos
@ 2006-09-15 13:46     ` Marcel Holtmann
  0 siblings, 0 replies; 4+ messages in thread
From: Marcel Holtmann @ 2006-09-15 13:46 UTC (permalink / raw)
  To: BlueZ development

Hi Jose,

> >> Here are a couple of patches that implement the following
> >> commands in dbus-test:
> >> GetRemoteClass
> >> GetRemoteServiceHandles
> >> GetRemoteServiceRecord
> >>
> >> This required modifications to dbus-sdp.c. The problem was
> >> that the call to dbus_message_get_args in this file used a NULL
> >> pointer for the error structure. This patch adds a pointer in
> >> the same way that dbus-adapter.c calls dbus_messsage_get_args.
> >> The end result is that both GetRemoteService* calls now seem
> >> to work.
> >>     
> >
> > I am not following that argument. If we don't care about the error code,
> > then why should we fill one it. If this is a problem, then the problem
> > is in the D-Bus low-level library or the Python bindings.
> 
> This was my first hack with dbus. I haven't read the docs so
> I'm not sure how it all works. I just noticed that the code in
> dbus-adapter.c is working so put the same changes on dbus-sdp.c
> and it worked.
> 
> I don't think the patch to dbus-sdp.c should be put in. Someone
> with more dbus expertise should fix it. The patch to dbus-test
> is simple and adds the new commands.

every patch is welcome, but for this one, I simply don't see the need.
For me it looks like D-Bus is at fault here and maybe updating your
D-Bus installation and the Python bindings might fix this.

Regards

Marcel



-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

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

end of thread, other threads:[~2006-09-15 13:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-09-08 11:29 [Bluez-devel] hcid dbus patches Jose Vasconcellos
2006-09-15 11:55 ` Marcel Holtmann
2006-09-15 13:42   ` Jose Vasconcellos
2006-09-15 13:46     ` Marcel Holtmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox