All of lore.kernel.org
 help / color / mirror / Atom feed
* [Bluez-devel] Input service and multiple adapters
@ 2007-03-25 18:35 Daniel Gollub
  2007-03-26  7:06 ` Stefan Seyfried
  2007-03-27 16:42 ` Daniel Gollub
  0 siblings, 2 replies; 3+ messages in thread
From: Daniel Gollub @ 2007-03-25 18:35 UTC (permalink / raw)
  To: bluez-devel

Hi folks,

i started playing around with the Input DBUS API and found an obscurity whe=
n =

multiple bluetooth adapters are used. Actually this is a really rare use =

case...

If i use Adapter A and call CreateDevice() and Connect() to an input device=
 .. =

everything works as expected. If Adapter A got unplugged/broken and got =

replaced by Adapter B and call CreateDevice() for the same input device. Th=
e =

result will be org.bluez.input.AlreadyExists

Again.. this is a really rare use case, but is it intended to only have one =

input device configuration for the system? What about having input device =

configuration for each Adapter?

(ugly) Example:

Interface=B7      org.bluez.input.Manager
Object path=B7    /org/bluez/input/{Adapter MAC Address ...}

This makes also the integration in the GUI a bit easier. So we can display =

which input device is configured per adapter. And suppress the output of =

bluetooth input devices if the responsible adapter is unplugged/off.

Or am i completely wrong and missed something...
... if not i fear the same problem for the Audio DBUS API as well.

best regards,
Daniel

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=3Djoin.php&p=3Dsourceforge&CID=3DDE=
VDEV
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

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

* Re: [Bluez-devel] Input service and multiple adapters
  2007-03-25 18:35 [Bluez-devel] Input service and multiple adapters Daniel Gollub
@ 2007-03-26  7:06 ` Stefan Seyfried
  2007-03-27 16:42 ` Daniel Gollub
  1 sibling, 0 replies; 3+ messages in thread
From: Stefan Seyfried @ 2007-03-26  7:06 UTC (permalink / raw)
  To: BlueZ development

On Sun, Mar 25, 2007 at 08:35:05PM +0200, Daniel Gollub wrote:
> Hi folks,
> 
> i started playing around with the Input DBUS API and found an obscurity when 
> multiple bluetooth adapters are used. Actually this is a really rare use 
> case...
> 
> If i use Adapter A and call CreateDevice() and Connect() to an input device .. 
> everything works as expected. If Adapter A got unplugged/broken and got 
> replaced by Adapter B and call CreateDevice() for the same input device. The 
> result will be org.bluez.input.AlreadyExists
> 
> Again.. this is a really rare use case, but is it intended to only have one 

No, it is pretty common.
I have one USB cable at home, with a hub and everything (including BT dongles)
connected to it and one USB cable at work, again with a BT dongle.  And then i
have a BT dongle in my pocket for on-the-road usage.
-- 
Stefan Seyfried

"Any ideas, John?"
"Well, surrounding them's out." 

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

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

* Re: [Bluez-devel] Input service and multiple adapters
  2007-03-25 18:35 [Bluez-devel] Input service and multiple adapters Daniel Gollub
  2007-03-26  7:06 ` Stefan Seyfried
@ 2007-03-27 16:42 ` Daniel Gollub
  1 sibling, 0 replies; 3+ messages in thread
From: Daniel Gollub @ 2007-03-27 16:42 UTC (permalink / raw)
  To: bluez-devel

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

Hi Marcel,

as discussed in #bluez we should store the address of the adapter.
I renamed GetAddress() to GetPeerAddress() and added a new function 
GetLocalAddress(). Simple patch attachted ... i hope everyone is happy with 
this one...

best regards,
Daniel




[-- Attachment #2: bluez-utils-input_service-localaddress.diff --]
[-- Type: text/x-diff, Size: 2265 bytes --]

Index: input/device.c
===================================================================
RCS file: /cvsroot/bluez/utils/input/device.c,v
retrieving revision 1.37
diff -u -p -r1.37 device.c
--- input/device.c	22 Mar 2007 14:53:22 -0000	1.37
+++ input/device.c	27 Mar 2007 16:40:09 -0000
@@ -889,7 +889,28 @@ static DBusHandlerResult device_is_conne
 	return send_message_and_unref(conn, reply);
 }
 
-static DBusHandlerResult device_get_address(DBusConnection *conn,
+static DBusHandlerResult device_get_local_address(DBusConnection *conn,
+						DBusMessage *msg, void *data)
+{
+	struct device *idev = data;
+	DBusMessage *reply;
+	char addr[18];
+	const char *paddr = addr;
+
+	ba2str(&idev->src, addr);
+
+	reply = dbus_message_new_method_return(msg);
+	if (!reply)
+		return DBUS_HANDLER_RESULT_NEED_MEMORY;
+
+	dbus_message_append_args(reply,
+			DBUS_TYPE_STRING, &paddr,
+			DBUS_TYPE_INVALID);
+
+	return send_message_and_unref(conn, reply);
+}
+
+static DBusHandlerResult device_get_peer_address(DBusConnection *conn,
 						DBusMessage *msg, void *data)
 {
 	struct device *idev = data;
@@ -983,8 +1004,11 @@ static DBusHandlerResult device_message(
 	if (strcmp(member, "IsConnected") == 0)
 		return device_is_connected(conn, msg, data);
 
-	if (strcmp(member, "GetAddress") == 0)
-		return device_get_address(conn, msg, data);
+	if (strcmp(member, "GetLocalAddress") == 0)
+		return device_get_local_address(conn, msg, data);
+
+	if (strcmp(member, "GetPeerAddress") == 0)
+		return device_get_peer_address(conn, msg, data);
 
 	if (strcmp(member, "GetName") == 0)
 		return device_get_name(conn, msg, data);
Index: input/input-api.txt
===================================================================
RCS file: /cvsroot/bluez/utils/input/input-api.txt,v
retrieving revision 1.8
diff -u -p -r1.8 input-api.txt
--- input/input-api.txt	22 Mar 2007 14:55:35 -0000	1.8
+++ input/input-api.txt	27 Mar 2007 16:40:09 -0000
@@ -48,7 +48,13 @@ Service		org.bluez.input
 Interface	org.bluez.input.Device
 Object path	/org/bluez/input/{keyboard*|mouse*|...}
 
-Methods		string GetAddress()
+Methods		string GetLocalAddress()
+
+			Returns the adapter address.
+
+			Example: "00:11:22:33:44:55"
+
+		string GetPeerAddress()
 
 			Returns the device address.
 

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

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

[-- 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] 3+ messages in thread

end of thread, other threads:[~2007-03-27 16:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-25 18:35 [Bluez-devel] Input service and multiple adapters Daniel Gollub
2007-03-26  7:06 ` Stefan Seyfried
2007-03-27 16:42 ` Daniel Gollub

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.