From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Subject: Re: Disabling passive scanning for LE connections From: Marcel Holtmann In-Reply-To: Date: Fri, 20 May 2016 09:14:04 +0200 Cc: linux-bluetooth@vger.kernel.org Message-Id: References: To: mike mike Sender: linux-bluetooth-owner@vger.kernel.org List-ID: Hi Mike, >> All LE connections are now triggered through a preceding passive scan >> and waiting for a connectable advertising report. This means we've got >> the best possible guarantee that the device is within range and should >> be able to request the controller to perform continuous scanning. This >> way we minimize the risk that we miss out on any advertising packets. > > My code manages 100's of BLE devices with long advertising periods. > I need to connect to devices (sometime multiples devices at the same > time) as quickly as possible. My current implementation usually catches > and connects to the first advertising event (average connect time is < 7 > seconds) > > I have my own code using the HCI interface for doing this. This code > has worked well for a while, but since the passive LE scanning was > added as part of the kernel connection processes (kernel 4.4.4?) I > have a problems with the process: > > - occasionally conflicting with my access to the whitelist > - occasionally deleting all entries in my whitelist. > > Is it possible to disable passive scanning, or will I need a kludge to > catch and work around these events? use HCI User Channel to gain exclusive HCI access. Otherwise the kernel owns the HCI control and not you. You would be injecting commands from user space with no guarantee that the kernel will overwrite it. Regards Marcel