Skip to contentSkip to conversation

Pairing fails with RFCOMM

Bluez-devel Nils Faerber 2 participants 6 messages Feb 6, 2004 – Feb 9, 2004 4 messages not in the archive Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

Hi all!
I think I found a small problem with rfcomm concerning pairing. The problem is that if you try to connect to a "new" device which requires pairing using rfcomm you will be queried for y pin on both sides. But it seems that a connect timeout in rfcomm is way too short for being able to input the pin.
It happened to me while trying to connect to a Siemens S55 mobile. I did a "rfcomm bind" and then opened minicom on the port. After that the mobile requests the pin. But before you can even start to input the pin minicom exits with an error.
If I start another connection first, like with multisync, the whole connection process waits until the pin has been entered on both sides.

CU
nils faerber

Signature · 16 lines
kernel concepts          Tel: +49-271-771091-12
Dreisbachstr. 24         Fax: +49-271-771091-19
D-57250 Netphen          D1 : +49-170-2729106
--



-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel
maintainer
#1 lore raw

Hi Nils,

Quoted 11 lines

I think I found a small problem with rfcomm concerning pairing. The problem is that if you try to connect to a "new" device which requires pairing using rfcomm you will be queried for y pin on both sides. But it seems that a connect timeout in rfcomm is way too short for being able to input the pin.
It happened to me while trying to connect to a Siemens S55 mobile. I did a "rfcomm bind" and then opened minicom on the port. After that the mobile requests the pin. But before you can even start to input the pin minicom exits with an error.
If I start another connection first, like with multisync, the whole connection process waits until the pin has been entered on both sides.

there is a difference between "rfcomm bind ..." and "rfcomm conn ...", because on the "bind" case the connection is established by the TTY part of the RFCOMM layer. In the case of "connect" the socket is creating the connection and MultiSync is using the socket. Please try to reproduce this behaviour with only using the rfcomm program and cat instead of minicom to trigger this behaviour. Please include the binary hcidump.

And the important thing, what kernel are you using?

Regards

Marcel

-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004 Premiere Conference on Open Tools Development and Integration See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
Bluez-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

A message that is not in the archive (sent off-list or not yet received): 1076337219.2892.57.camel@localhost

maintainer
#3 lore raw

Hi Nils,

Quoted 6 lines

It seems that minicom implements a timeout on open()ing the tty. This times out before the authentication took place. When using rfcomm connect first or using cat the connect works.
So this is indeed not a BlueZ/RFCOMM problem, because IMHO there is no real way to fix it (only possible solution would be to always allow open()ing the port, paired or not, connected or not).

this is not really a solution, because it moves the detection of Bluetooth connection errors out of the scope.

Regards

Marcel

-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004 Premiere Conference on Open Tools Development and Integration See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
Bluez-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

A message that is not in the archive (sent off-list or not yet received): 1076339124.1169.67.camel@localhost

maintainer
#5 lore raw

Hi Nils,

Quoted 3 lines

But maybe we should mention this in some FAQ. I guess that more programs than minicom will have some timeout logic like this and that other users might stumble accreoss the same problem sooner or later.

of course. Send me an entry for our FAQ and I'll add it.

Regards

Marcel

-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004 Premiere Conference on Open Tools Development and Integration See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
Bluez-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

A message that is not in the archive (sent off-list or not yet received): 1076340484.1167.79.camel@localhost

maintainer
#7 lore raw

Hi Nils,

Quoted 20 lines

OK, maybe like this:
----->
xx. RFCOMM connection using minicom or other tool fails, why?
Problem: In case you have created the RFCOMM link using the "rfcomm bind" function this can be caused by application timeouts. This is not a problem of BlueZ or the RFCOMM implementation but rather a problem with the different nature of a RFCOMM virtual tty and a physical serial tty device which is normally used by those applications. Some applications implement a timeout protection function while opening the port. If opening the port takes longer than a certain amount of time then the application fails. A serial tty will usually only take several microseconds to open while the RFCOMM virtual tty can take several seconds. Additionally opening requires to create a connection to the remote Bluetooth device, closing the port closes the connection again. Application which open and close the port frequently may thus also fail!
Solution: Try to create the connection before starting you application. This can be done by the "rfcomm connect" function. The Bluetooth connection will then remain until the rfcomm utility is stopped. <-----

Quoted 1 line

A bit lengthy maybe ;)

thank you. I stripped a little bit and put it only ;)

Quoted 1 line

How does BT-HID mouse work?

The best is you follow this HOWTO

	http://www.bueche.ch/comp/mx900/mx900.html

And don't use the bthid from Peter Klausler until you patch it up.

Quoted 2 lines

I have a BT mouse here but the bthid daemon does not connect to it nor can I connect another service like rfcomm to it...

RFCOMM will never work, because HID is only based on L2CAP.

Quoted 1 line

The accompanied keyboard works like a charm!

If the keyboard works, the mouse should work also.

Regards

Marcel

-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004 Premiere Conference on Open Tools Development and Integration See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
Bluez-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

A message that is not in the archive (sent off-list or not yet received): 1076342698.1167.90.camel@localhost

maintainer
#9 lore raw

Hi Nils,

Quoted 7 lines

This has already been solved, sorry for bothering.
My problem was that bthid is not very verbose unless you look into the daemon-log - I did not :(
So I did not see that it already had connected upon first try! All other tries after that failed of course.
BTW: "bthid -l" did not show this connection so there is still some glitch...

I know, there is much more work to do ;)

Quoted 3 lines

BTW: The dongle in use is the EPOX USB dongle from the keyboard-mouse-dongle package. Switching from HID to HCI also worked like a charm - well done!

Thanks. And even the Logitech dongle can be switched. Some Apple iBooks should also work like this.

Quoted 3 lines

Now I only have to figure out how to force the pairing on the keyboard.

Quoted 1 line

From what I know it should work in a way that you can input the pin on

the keyboard. But I can simply connect to it without authentication...

That is one of the problems that must be solved. If you read the HID specification then you will see that the host stack is responsible for doing the authentication. But you can't enable auth per se, because the connection to a mouse must be done (the Apple mouse is the exception) without authentication and encryption. So you must first identify the type of the HID device. This can be done through the class of device value on incoming connection, but we don't make this value accessable from userspace in BlueZ. Or you use the HID descriptor and then issue a HCI_Authenticate command if it is a keyboard.

Regards

Marcel

-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004 Premiere Conference on Open Tools Development and Integration See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
Bluez-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel