* [Bluez-devel] Addition for hcid passkey dbus request
@ 2006-07-31 13:18 Daniel Gollub
2006-07-31 13:26 ` Johan Hedberg
0 siblings, 1 reply; 9+ messages in thread
From: Daniel Gollub @ 2006-07-31 13:18 UTC (permalink / raw)
To: bluez-devel
[-- Attachment #1: Type: text/plain, Size: 564 bytes --]
Hi list,
i am started working for the bluez dbus integration for kdebluetooth. The
kdebluetooth pin dialog for pairing has a pin generation feature for outgoing
pairing requests. This requires that hcid also provides connection
information about the pairing. A hcid patch is attached, which sends a
enhanced passkey request with the connection direction. This requires changes
on all application which handle as passkey agents. Is there a better solution
expect dropping the pin generation feature?
Looking forward for some feedback.
best regards,
Daniel
[-- Attachment #2: bluez-hcid-dbus-pairing-ci.diff --]
[-- Type: text/x-diff, Size: 3789 bytes --]
diff -rup bluez-utils/hcid/dbus.c bluez-utils.patched/hcid/dbus.c
--- bluez-utils/hcid/dbus.c 2006-07-31 12:47:40.000000000 +0200
+++ bluez-utils.patched/hcid/dbus.c 2006-07-31 15:14:47.000000000 +0200
@@ -631,7 +631,7 @@ void hcid_dbus_request_pin(int dev, bdad
snprintf(path, sizeof(path), "%s/hci%d", BASE_PATH, hci_devid(addr));
- handle_passkey_request(connection, dev, path, sba, &ci->bdaddr);
+ handle_passkey_request(connection, dev, path, sba, &ci->bdaddr, ci->out);
}
void hcid_dbus_bonding_process_complete(bdaddr_t *local, bdaddr_t *peer, const uint8_t status)
diff -rup bluez-utils/hcid/dbus.h bluez-utils.patched/hcid/dbus.h
--- bluez-utils/hcid/dbus.h 2006-07-31 12:47:40.000000000 +0200
+++ bluez-utils.patched/hcid/dbus.h 2006-07-31 15:14:47.000000000 +0200
@@ -178,7 +178,7 @@ DBusHandlerResult simple_introspect(DBus
service_handler_func_t find_service_handler(struct service_data *services, DBusMessage *msg);
-int handle_passkey_request(DBusConnection *conn, int dev, const char *path, bdaddr_t *sba, bdaddr_t *dba);
+int handle_passkey_request(DBusConnection *conn, int dev, const char *path, bdaddr_t *sba, bdaddr_t *dba, uint8_t dirout);
static inline DBusHandlerResult send_reply_and_unref(DBusConnection *conn, DBusMessage *reply)
{
diff -rup bluez-utils/hcid/dbus-security.c bluez-utils.patched/hcid/dbus-security.c
--- bluez-utils/hcid/dbus-security.c 2006-07-31 12:47:40.000000000 +0200
+++ bluez-utils.patched/hcid/dbus-security.c 2006-07-31 15:14:47.000000000 +0200
@@ -398,10 +398,11 @@ done:
}
static int call_passkey_agent(DBusConnection *conn, struct passkey_agent *agent,
- int dev, const char *path, bdaddr_t *sba, bdaddr_t *dba)
+ int dev, const char *path, bdaddr_t *sba, bdaddr_t *dba, uint8_t dirout)
{
DBusMessage *message = NULL;
DBusPendingCall *pending = NULL;
+ dbus_bool_t dbusdirout = dirout;
struct pin_request *req;
char bda[18];
char *ptr = bda;
@@ -413,6 +414,7 @@ static int call_passkey_agent(DBusConnec
goto failed;
}
+
debug("Calling PasskeyAgent.Request: name=%s, path=%s",
agent->name, agent->path);
@@ -433,6 +435,7 @@ static int call_passkey_agent(DBusConnec
dbus_message_append_args(message,
DBUS_TYPE_STRING, &path,
DBUS_TYPE_STRING, &ptr,
+ DBUS_TYPE_BOOLEAN, &dbusdirout,
DBUS_TYPE_INVALID);
if (dbus_connection_send_with_reply(conn, message,
@@ -468,7 +471,7 @@ DBusHandlerResult handle_security_method
return error_unknown_method(conn, msg);
}
-int handle_passkey_request(DBusConnection *conn, int dev, const char *path, bdaddr_t *sba, bdaddr_t *dba)
+int handle_passkey_request(DBusConnection *conn, int dev, const char *path, bdaddr_t *sba, bdaddr_t *dba, uint8_t dirout)
{
struct passkey_agent *agent = default_agent;
struct hci_dbus_data *adapter = NULL;
@@ -494,5 +497,5 @@ int handle_passkey_request(DBusConnectio
}
done:
- return call_passkey_agent(conn, agent, dev, path, sba, dba);
+ return call_passkey_agent(conn, agent, dev, path, sba, dba, dirout);
}
diff -rup bluez-utils/hcid/passkey-agent.c bluez-utils.patched/hcid/passkey-agent.c
--- bluez-utils/hcid/passkey-agent.c 2006-07-31 12:47:40.000000000 +0200
+++ bluez-utils.patched/hcid/passkey-agent.c 2006-07-31 15:15:02.000000000 +0200
@@ -76,12 +76,13 @@ static DBusHandlerResult request_message
{
DBusMessage *reply;
const char *path, *address;
+ dbus_bool_t ciout;
if (!passkey)
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
if (!dbus_message_get_args(msg, NULL, DBUS_TYPE_STRING, &path,
- DBUS_TYPE_STRING, &address, DBUS_TYPE_INVALID)) {
+ DBUS_TYPE_STRING, &address, DBUS_TYPE_BOOLEAN, &ciout, DBUS_TYPE_INVALID)) {
fprintf(stderr, "Invalid arguments for passkey Request method");
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
}
[-- Attachment #3: Type: text/plain, Size: 348 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] 9+ messages in thread* Re: [Bluez-devel] Addition for hcid passkey dbus request
2006-07-31 13:18 [Bluez-devel] Addition for hcid passkey dbus request Daniel Gollub
@ 2006-07-31 13:26 ` Johan Hedberg
2006-07-31 18:11 ` Marcel Holtmann
0 siblings, 1 reply; 9+ messages in thread
From: Johan Hedberg @ 2006-07-31 13:26 UTC (permalink / raw)
To: BlueZ development
Hi Daniel,
On Mon, Jul 31, 2006, Daniel Gollub wrote:
> i am started working for the bluez dbus integration for kdebluetooth. The
> kdebluetooth pin dialog for pairing has a pin generation feature for outgoing
> pairing requests. This requires that hcid also provides connection
> information about the pairing. A hcid patch is attached, which sends a
> enhanced passkey request with the connection direction. This requires changes
> on all application which handle as passkey agents. Is there a better solution
> expect dropping the pin generation feature?
I think a better solution could be to add a new method to hcid for
querying the connection direction (it would take the local adapter path
and remote address as parameters). This way the current passkey agent
interface would not have to be changed.
Johan
-------------------------------------------------------------------------
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] 9+ messages in thread
* Re: [Bluez-devel] Addition for hcid passkey dbus request
2006-07-31 13:26 ` Johan Hedberg
@ 2006-07-31 18:11 ` Marcel Holtmann
2006-07-31 16:50 ` Daniel Gollub
0 siblings, 1 reply; 9+ messages in thread
From: Marcel Holtmann @ 2006-07-31 18:11 UTC (permalink / raw)
To: BlueZ development
Hi Johan,
> > i am started working for the bluez dbus integration for kdebluetooth. The
> > kdebluetooth pin dialog for pairing has a pin generation feature for outgoing
> > pairing requests. This requires that hcid also provides connection
> > information about the pairing. A hcid patch is attached, which sends a
> > enhanced passkey request with the connection direction. This requires changes
> > on all application which handle as passkey agents. Is there a better solution
> > expect dropping the pin generation feature?
>
> I think a better solution could be to add a new method to hcid for
> querying the connection direction (it would take the local adapter path
> and remote address as parameters). This way the current passkey agent
> interface would not have to be changed.
someone has to convince me, why the direction information is needed at
all. If I remember correctly, then we dropped it on purpose. I simply
don't see any useful need for it. Except maybe displaying the "incoming"
or "outgoing" and this doesn't really have to do anything with the
pairing process.
Regards
Marcel
-------------------------------------------------------------------------
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] 9+ messages in thread
* Re: [Bluez-devel] Addition for hcid passkey dbus request
2006-07-31 18:11 ` Marcel Holtmann
@ 2006-07-31 16:50 ` Daniel Gollub
2006-07-31 19:17 ` Marcel Holtmann
0 siblings, 1 reply; 9+ messages in thread
From: Daniel Gollub @ 2006-07-31 16:50 UTC (permalink / raw)
To: bluez-devel
On Monday 31 July 2006 20:11, Marcel Holtmann wrote:
> someone has to convince me, why the direction information is needed at
> all. If I remember correctly, then we dropped it on purpose. I simply
> don't see any useful need for it. Except maybe displaying the "incoming"
> or "outgoing" and this doesn't really have to do anything with the
> pairing process.
The pin dialog has to know if the user have to reply a pin from an incoming
pairing request from another device (only provide a plain input field). Or if
the pin dialog can suggest a randomly generated pin which have to be replied
by the other device.
Example:
Outgoing Connection
The user on the computer triggers a pairing request (outgoing connection). The
pin get randomly generated and displayed in the pairing dialog and have to
replied by the cellphone.
Incoming Connection
The user triggers a pairing from the cellphone with the computer (incoming
connection). A pin dialog appears on the computer with an input filed to
reply the same pin.
-------------------------------------------------------------------------
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] 9+ messages in thread
* Re: [Bluez-devel] Addition for hcid passkey dbus request
2006-07-31 16:50 ` Daniel Gollub
@ 2006-07-31 19:17 ` Marcel Holtmann
2006-07-31 18:07 ` Daniel Gollub
0 siblings, 1 reply; 9+ messages in thread
From: Marcel Holtmann @ 2006-07-31 19:17 UTC (permalink / raw)
To: BlueZ development
Hi Daniel,
> > someone has to convince me, why the direction information is needed at
> > all. If I remember correctly, then we dropped it on purpose. I simply
> > don't see any useful need for it. Except maybe displaying the "incoming"
> > or "outgoing" and this doesn't really have to do anything with the
> > pairing process.
>
> The pin dialog has to know if the user have to reply a pin from an incoming
> pairing request from another device (only provide a plain input field). Or if
> the pin dialog can suggest a randomly generated pin which have to be replied
> by the other device.
>
> Example:
>
> Outgoing Connection
> The user on the computer triggers a pairing request (outgoing connection). The
> pin get randomly generated and displayed in the pairing dialog and have to
> replied by the cellphone.
>
> Incoming Connection
> The user triggers a pairing from the cellphone with the computer (incoming
> connection). A pin dialog appears on the computer with an input filed to
> reply the same pin.
you can't bind incoming or outgoing connections with the assumption that
this implies the initiator of the authentication request. It is not
working this way. Both are two independent procedures (except for
security mode 3, which is not really supported by BlueZ anymore).
So if you wanna have a random key generated on one side, then you need
to be the initiator of the pairing request. This can be achieved with
calling CreateBonding() and in this case you can register a device
specific passkey agent to create your random number.
The default passkey agent is really meant to be default. It will do the
same task for every pairing request. If you need a specific, like random
number or fixed PIN then use a per device passkey agent.
Regards
Marcel
-------------------------------------------------------------------------
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] 9+ messages in thread
* Re: [Bluez-devel] Addition for hcid passkey dbus request
2006-07-31 19:17 ` Marcel Holtmann
@ 2006-07-31 18:07 ` Daniel Gollub
2006-07-31 18:11 ` Stefan Seyfried
2006-07-31 22:21 ` Marcel Holtmann
0 siblings, 2 replies; 9+ messages in thread
From: Daniel Gollub @ 2006-07-31 18:07 UTC (permalink / raw)
To: bluez-devel
On Monday 31 July 2006 21:17, Marcel Holtmann wrote:
> you can't bind incoming or outgoing connections with the assumption that
> this implies the initiator of the authentication request. It is not
> working this way. Both are two independent procedures (except for
> security mode 3, which is not really supported by BlueZ anymore).
i wasn't aware of this. thanks!
>
> So if you wanna have a random key generated on one side, then you need
> to be the initiator of the pairing request. This can be achieved with
> calling CreateBonding() and in this case you can register a device
> specific passkey agent to create your random number.
>
> The default passkey agent is really meant to be default. It will do the
> same task for every pairing request. If you need a specific, like random
> number or fixed PIN then use a per device passkey agent.
Thanks for the hint!
I planned to register kbluetoothd as default passkey agent and listen for all
passkey request. Have to recjet this and think about a new solution. I am
confused now, how to achieve that the pin dialog now can detect if it is the
initiator side. When another application triggers the pairing without calling
CreateBonding().
-------------------------------------------------------------------------
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] 9+ messages in thread
* Re: [Bluez-devel] Addition for hcid passkey dbus request
2006-07-31 18:07 ` Daniel Gollub
@ 2006-07-31 18:11 ` Stefan Seyfried
2006-07-31 22:15 ` Marcel Holtmann
2006-07-31 22:21 ` Marcel Holtmann
1 sibling, 1 reply; 9+ messages in thread
From: Stefan Seyfried @ 2006-07-31 18:11 UTC (permalink / raw)
To: BlueZ development
Hi Daniel,
On Mon, Jul 31, 2006 at 08:07:22PM +0200, Daniel Gollub wrote:
> I planned to register kbluetoothd as default passkey agent and listen for=
all =
> passkey request. Have to recjet this and think about a new solution. I am =
I believe that you still can do this.
> confused now, how to achieve that the pin dialog now can detect if it is =
the =
> initiator side. When another application triggers the pairing without cal=
ling =
> CreateBonding().
Well, improve kbluetoothd in a way, that it is just way more convenient
to pair devices by using it than with any other application :-)
Once you know that you initiated the pairing, you can pre-fill the pin
field with a generated value.
Basically, i think we do not want many applications doing the pairing
stuff, there should be one application (per desktop environment...), that
handles this stuff well in a centralized place. For KDE, this could be
kbluetoothd (or maybe a control-center plugin, which could then communicate
with kbluetoothd). This probably give the best user experience.
-- =
Stefan Seyfried | "Please, just tell people
QA / R&D Team Mobile Devices | to use KDE."
SUSE LINUX Products GmbH, N=FCrnberg | -- Linus Torvalds
-------------------------------------------------------------------------
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] 9+ messages in thread
* Re: [Bluez-devel] Addition for hcid passkey dbus request
2006-07-31 18:11 ` Stefan Seyfried
@ 2006-07-31 22:15 ` Marcel Holtmann
0 siblings, 0 replies; 9+ messages in thread
From: Marcel Holtmann @ 2006-07-31 22:15 UTC (permalink / raw)
To: BlueZ development
Hi Stefan,
> > I planned to register kbluetoothd as default passkey agent and listen for all
> > passkey request. Have to recjet this and think about a new solution. I am
>
> I believe that you still can do this.
>
> > confused now, how to achieve that the pin dialog now can detect if it is the
> > initiator side. When another application triggers the pairing without calling
> > CreateBonding().
>
> Well, improve kbluetoothd in a way, that it is just way more convenient
> to pair devices by using it than with any other application :-)
> Once you know that you initiated the pairing, you can pre-fill the pin
> field with a generated value.
>
> Basically, i think we do not want many applications doing the pairing
> stuff, there should be one application (per desktop environment...), that
> handles this stuff well in a centralized place. For KDE, this could be
> kbluetoothd (or maybe a control-center plugin, which could then communicate
> with kbluetoothd). This probably give the best user experience.
don't try to over-engineer this. We thought about all this stuff
already. You can make kbluetoothd the default passkey agent and then you
can register a device specific passkey agent. This stuff is stacked and
hcid will first look for a device specific agent before calling the
default agent.
So you need a default passkey agent that will be always available (take
care of D-Bus disconnects btw.) and it has to handle unexpected pairing
requests. In the case you connect to a phone and you want to pair (in
somekind of connection wizard), then you register a device specific
passkey agent and call CreateBonding(). It is that simple.
If something is actually not working as expect or documented in
dbus-api.txt then this might be simply a bug. The current D-Bus API for
BlueZ should be enough to handle all basic tasks. We thought really
careful about all methods and signals that are needed. However we might
have missed something, but you need a good argument to convince me that
something additional is needed.
Regards
Marcel
-------------------------------------------------------------------------
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] 9+ messages in thread
* Re: [Bluez-devel] Addition for hcid passkey dbus request
2006-07-31 18:07 ` Daniel Gollub
2006-07-31 18:11 ` Stefan Seyfried
@ 2006-07-31 22:21 ` Marcel Holtmann
1 sibling, 0 replies; 9+ messages in thread
From: Marcel Holtmann @ 2006-07-31 22:21 UTC (permalink / raw)
To: BlueZ development
Hi Daniel,
> > So if you wanna have a random key generated on one side, then you need
> > to be the initiator of the pairing request. This can be achieved with
> > calling CreateBonding() and in this case you can register a device
> > specific passkey agent to create your random number.
> >
> > The default passkey agent is really meant to be default. It will do the
> > same task for every pairing request. If you need a specific, like random
> > number or fixed PIN then use a per device passkey agent.
>
> Thanks for the hint!
>
> I planned to register kbluetoothd as default passkey agent and listen for all
> passkey request. Have to recjet this and think about a new solution. I am
> confused now, how to achieve that the pin dialog now can detect if it is the
> initiator side. When another application triggers the pairing without calling
> CreateBonding().
see my other email for how this is supposed to work. And you should play
with the example passkey-agent from bluez-utils source. This one can be
a default or a device specific passkey-agent. Then you will understand
how this is working.
Regards
Marcel
-------------------------------------------------------------------------
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] 9+ messages in thread
end of thread, other threads:[~2006-07-31 22:21 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-07-31 13:18 [Bluez-devel] Addition for hcid passkey dbus request Daniel Gollub
2006-07-31 13:26 ` Johan Hedberg
2006-07-31 18:11 ` Marcel Holtmann
2006-07-31 16:50 ` Daniel Gollub
2006-07-31 19:17 ` Marcel Holtmann
2006-07-31 18:07 ` Daniel Gollub
2006-07-31 18:11 ` Stefan Seyfried
2006-07-31 22:15 ` Marcel Holtmann
2006-07-31 22:21 ` Marcel Holtmann
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.