From owner-freebsd-bluetooth@FreeBSD.ORG Wed Apr 22 18:17:11 2015 Return-Path: Delivered-To: freebsd-bluetooth@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E2C9E411 for ; Wed, 22 Apr 2015 18:17:11 +0000 (UTC) Received: from mail-ie0-x231.google.com (mail-ie0-x231.google.com [IPv6:2607:f8b0:4001:c03::231]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id ACB3B1208 for ; Wed, 22 Apr 2015 18:17:11 +0000 (UTC) Received: by iecrt8 with SMTP id rt8so43894031iec.0 for ; Wed, 22 Apr 2015 11:17:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=/fYueXMlLL+c8gPdd9V6OoD/FzlCuMPDsxgViN5/6fo=; b=jZb3S9qreW21pIrOh4oLT9nXg3d2wEYUF+bfDvPcW0ukrVcXrg3k8Rcwg/RL9UvhnG ipupjhlZuV0CpzUWtmsLs74zrTKFCRRvzZLuBTFv/n3p3FCfEjZP9lOXpDiEVId+uw6L o/8F5eXqSBCuOtA6ewC0EjTjN69zzLArK+ki3q0cfSe6bOfyUoRJPNDzz+GDZoZQn8oi d8TkcdnknSjmVujGKmd+ZNpbgNINzlr1NvO7gL6KCUm8MrtPHrjTSvoX+o3cK4/KUg0v qLJzbS/zYbq0x3yxg7vI4mp1SuvqjvX9dIM0O8Oqyk4EOfOE5I1YiKMjKq5wXSC4y4pj pH2Q== MIME-Version: 1.0 X-Received: by 10.50.66.230 with SMTP id i6mr6525665igt.22.1429726630911; Wed, 22 Apr 2015 11:17:10 -0700 (PDT) Received: by 10.36.66.17 with HTTP; Wed, 22 Apr 2015 11:17:10 -0700 (PDT) In-Reply-To: References: Date: Wed, 22 Apr 2015 11:17:10 -0700 Message-ID: Subject: Re: question about bthidd client.c From: Maksim Yevmenkin To: Waitman Gobble Cc: "freebsd-bluetooth@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: freebsd-bluetooth@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Using Bluetooth in FreeBSD environments List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Apr 2015 18:17:12 -0000 >>> I notice that if bthidd is running, and bluetooth is not active, or >>> the configured host is out of range, the client_rescan() function >>> generates new vkbd devices every 20 seconds or so. I believe this will >>> eventually lock up the machine. >>> >> >> may be... usually devices will reconnect, i.e. reconnect_initiate >> would be 1. however, this is a known problem. for whatever reason >> "cloned" devices are not completely going away when closed. similar >> problem exists with other "cloned" devices. its not bthidd or >> bluetooth code specific. > > Thanks for the reply. Is there a better way to decide if a device is > 'connectable'? It looks like a chicken-and-egg kind of problem, since device tells host who is supposed to initiate reconnect (in sdp attribute). normally, devices will initiate reconnect. host should not be required to constantly "poll". there is no easy way to know if device is "connectable". inquiry may tell you if device is in range but only if device is in "discoverable" mode. most devices will only go into discoverable mode during pairing. > the connect routine uses the established vkbd device. I am thinking > that attempting to connect to the device on psm 1 is a way to verify > that the host is connectable in the first place, before creating a new > vkbd. Or, maybe the new vkbd can be destroyed on failure... but maybe > this would cause other problems. there should not be any problem. cloned device is created on open() and should be destroyed on close(). thanks max