From owner-freebsd-bluetooth@FreeBSD.ORG Fri Dec 19 09:44:35 2008 Return-Path: Delivered-To: freebsd-bluetooth@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3F26E1065675 for ; Fri, 19 Dec 2008 09:44:35 +0000 (UTC) (envelope-from olli@lurza.secnetix.de) Received: from lurza.secnetix.de (unknown [IPv6:2a01:170:102f::2]) by mx1.freebsd.org (Postfix) with ESMTP id B06E68FC08 for ; Fri, 19 Dec 2008 09:44:34 +0000 (UTC) (envelope-from olli@lurza.secnetix.de) Received: from lurza.secnetix.de (localhost [127.0.0.1]) by lurza.secnetix.de (8.14.3/8.14.3) with ESMTP id mBJ9iWUv086370; Fri, 19 Dec 2008 10:44:33 +0100 (CET) (envelope-from oliver.fromme@secnetix.de) Received: (from olli@localhost) by lurza.secnetix.de (8.14.3/8.14.3/Submit) id mBJ9iWKp086368; Fri, 19 Dec 2008 10:44:32 +0100 (CET) (envelope-from olli) From: Oliver Fromme Message-Id: <200812190944.mBJ9iWKp086368@lurza.secnetix.de> To: maksim.yevmenkin@gmail.com (Maksim Yevmenkin) Date: Fri, 19 Dec 2008 10:44:32 +0100 (CET) In-Reply-To: X-Mailer: ELM [version 2.5 PL8] MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.1.2 (lurza.secnetix.de [127.0.0.1]); Fri, 19 Dec 2008 10:44:33 +0100 (CET) Cc: freebsd-bluetooth@freebsd.org Subject: Re: Bluetooth socket timeout, device pairing X-BeenThere: freebsd-bluetooth@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Using Bluetooth in FreeBSD environments List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Dec 2008 09:44:35 -0000 Hello Max, Maksim Yevmenkin wrote: > Oliver, > > > My Bluetooth Python module basically works now. > > However, I've got one small problem with pairing ... > > > > I have entered an 8-character PIN code in hcsecd.conf. > > When I try to open a connection for the first time, > > the device (i.e. my Mindstorms NXT brick) asks me to > > enter the PIN code. However, entering the code on > > the brick takes some time ... I have to scroll > > through the alphabet and digits which is rather slow. > > I can enter at most 4 characters of the PIN code > > before the socket() call returns with ECONN > > ("Connection refused"). > > > > For now I'm using a short 4-character PIN code, but > > I would really like to use a longer one. Where is > > the timeout defined for that? > > its so called "LMP (link manager protocol) response timeout". its > defined in link manager, i.e. part of the device's firmware. v1.1 spec > seems to be implying that LMP response timeout should be set to 30 > sec. > > > Python's socket module has no timeout by default. > > I've also searched the net.bluetooth sysctls and > > increased all of the timeout values (half a dozen), > > but none of them seemed to have an effect on this > > particular problem. So I think this value must be > > hardcoded somewhere. Where do I have to look? > > i'm afraid that you can not change LMP response timeout. there isn't > any defined command that would do that. i'm not sure why do you care > much about pin length. pin is only used once to generate link key and > as soon as link key is generated both devices should use it instead of > pin. Thankyou very much for the explanation. It was my impression that the length of the PIN code has to do with the security (i.e. the longer, the better). It seems I was wrong. Is it correct that it would even be secure enough to use the public default factory PIN code of the device ("1234")? In that case I could skip the whole business of entering a PIN code ... Best regards Oliver -- Oliver Fromme, secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing b. M. Handelsregister: Registergericht Muenchen, HRA 74606, Geschäftsfuehrung: secnetix Verwaltungsgesellsch. mbH, Handelsregister: Registergericht Mün- chen, HRB 125758, Geschäftsführer: Maik Bachmann, Olaf Erb, Ralf Gebhart FreeBSD-Dienstleistungen, -Produkte und mehr: http://www.secnetix.de/bsd "I have stopped reading Stephen King novels. Now I just read C code instead." -- Richard A. O'Keefe