Return-Path: MIME-Version: 1.0 In-Reply-To: References: <3A3A3A19-AE6E-493A-AA1F-3C0A8451B775@holtmann.org> Date: Wed, 16 Sep 2015 11:16:20 +0600 Message-ID: Subject: Re: mgmt-api callback not firing properly From: Nazmul Alam To: Marcel Holtmann Cc: linux-bluetooth@vger.kernel.org Content-Type: text/plain; charset=UTF-8 Sender: linux-bluetooth-owner@vger.kernel.org List-ID: Hello Marcel, I think you are right. Invoking the commands in a sequential way does the job. Thanks for your heads up. >>> are you utilizing src/shared/mgmt.c for your code. That one has proper handling for queuing the commands. It however means that the next command is only send when the previous one completed? Which command do you have problems with. There are a few special ones that require mgmt_reply to be used. >> >> Yes I am using src/shared/mgmt.c for my code. The problem occurs when >> I try to issue the MGMT_OP_START_DISCOVERY & >> MGMT_OP_ADD_ADVERTISING/MGMT_OP_REMOVE_ADVERTISING simultaneously, >> sometimes the callback doesn't fire for the later call. >> >> According to one of your reply to a thread, I changed the guarding >> code of the kernel driver and simultaneous scanning / advertising is >> working. But sometimes the callback is not firing (randomly). >> >> I am using the mainloop_run() in a pthread. Is this can be a issue? > > our code is not thread safe. So that might be a problem. Since I have not heard from issues with missing callbacks in bluetoothd and that is running exactly the same code. > > Regards > > Marcel >