From owner-freebsd-bluetooth@FreeBSD.ORG Wed Apr 22 18:28:30 2015 Return-Path: Delivered-To: freebsd-bluetooth@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8E5A5535 for ; Wed, 22 Apr 2015 18:28:30 +0000 (UTC) Received: from mail-ob0-x22e.google.com (mail-ob0-x22e.google.com [IPv6:2607:f8b0:4003:c01::22e]) (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 53259131C for ; Wed, 22 Apr 2015 18:28:30 +0000 (UTC) Received: by obcux3 with SMTP id ux3so72576215obc.2 for ; Wed, 22 Apr 2015 11:28:29 -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=yAaxlAZHTb2rh6dujodl6lzdPxy/otPahd5eO+e26AY=; b=lznon0nJJyluSefjFHIDTkGmNVrzbtIE+1eZat7ZGyGMDkNPi2AaN+la8PWjqZ/hPm YB6jHDe0Xu0kCgS084MZgERVFoBb10yxKNOyKbur0AVhQmyoOlkehkh8mh2NCLlp9DfP JnZlo4+oLe/BGjkwxJN+Am+2Vn9FjBx9xT4dPCndvsr7T3KZrtsD5Xb4mT8EYcSVybnn og5hnA1Bb+REizTcvsSmkCWmpn5bTSQk02H57TwugH0DLLUd6DRN/cFpdLwbZyOo+2Aa 7r/QBNXz8K2291g7obztuwH2iB2DjverilgyMzVKQdRCLshsHtkMMxDac7HGPL28Y82c g9/Q== MIME-Version: 1.0 X-Received: by 10.182.115.167 with SMTP id jp7mr24983860obb.21.1429727309592; Wed, 22 Apr 2015 11:28:29 -0700 (PDT) Received: by 10.202.177.85 with HTTP; Wed, 22 Apr 2015 11:28:29 -0700 (PDT) In-Reply-To: References: Date: Wed, 22 Apr 2015 11:28:29 -0700 Message-ID: Subject: Re: question about bthidd client.c From: Waitman Gobble To: Maksim Yevmenkin 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:28:30 -0000 On Wed, Apr 22, 2015 at 11:26 AM, Maksim Yevmenkin wrote: > On Wed, Apr 22, 2015 at 11:17 AM, Maksim Yevmenkin > wrote: >>>>> 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(). > > the simplest solution to this problem is to add a configuration > parameter that specifies vkbd unit number for each entry. this way, > the same device (i.e. keyboard) will always use the same vkbd. no more > endless cloning. > > thanks, > max Max, OK that sounds like the way to go. Thanks, -- Waitman Gobble Los Altos California USA 510-830-7975