Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp2633119rdb; Fri, 8 Dec 2023 14:13:50 -0800 (PST) X-Google-Smtp-Source: AGHT+IG149azFZkUOXDZ82YY5ebOWISEg3hP+6kVtbwsDqpACQVJjn6FM92H4ltpokIZ/MhciESW X-Received: by 2002:a05:620a:4d13:b0:77f:1827:a9b6 with SMTP id wa19-20020a05620a4d1300b0077f1827a9b6mr739350qkn.138.1702073630440; Fri, 08 Dec 2023 14:13:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702073630; cv=none; d=google.com; s=arc-20160816; b=XIp935FVsoaYrWE9hzKztfguHBREGc53eDmI7I6fCpsYlKNvOHeZ+xB8S5oh6ZNVhp TWPyKcOUAL4kNb7gIhd82kED9fAXANGN/+aOi33ByGD4lPurTSUWpB5Ku5vMKxF9A2sj 7DsQ329G3BJB+zyfFQCJVjRCPu/gCqLy18wq3MxVRHKtE84VVW45RU8nPZdoYx8Ebaj6 moKKD3L81N0zSdjSZsfstfCsxJzgT13DvPZ9kLOW735cwbum3JccaB9T58zZGwEa+kaK qxSRO0f5ZCF2Vr1qK3cMepXn+aboA+n/OnB3yRCv4uN8BI1dpaVJT4SLIuQQ9+/eUvUf mMWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=RlxG7vjWqKyoHCmskEV8jhRRkavkqsM6KoNtZ7Hn0ss=; fh=zxe4sXXZmaXDDo3uCkZ1G2fPzGDMz5KFh2F0TTwrWFE=; b=ecnNofoOHhZRrrZpHqMSG+glCb3G9crLQ9XPUfk8HkkX+1FJxR63ACI+hZQ3ynjsi1 TjtdMK5zRMc4QRcXXnv/31KQYYIyqwVsoLIQhnNI9vSrp8t/6UJnTz/anmSlRMOJAffJ 4/MWnQ30NB2bHpYe7zBqiOAj8cRlzii1U9DDayf+D1wWjkSd3IrfaFcOD7eSFedozrz/ GIOhg1oi2WXKv0mAfJGkt3B/RBHO51sayxpzO1NrhIHoHwHFVP/ncty4DqSjdg+OoCh1 rGq2jJhjyv/V8NkcD+shwH72WLp+aVAy1CaC6R+QQCoseB3qYaX5+5wGNYS5p4dqjiUF guGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@kemnade.info header.s=20220719 header.b=QsYAKXgx; spf=pass (google.com: domain of linux-bluetooth+bounces-495-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-495-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id c5-20020a05620a268500b0077f13249d4bsi3232669qkp.654.2023.12.08.14.13.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Dec 2023 14:13:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-bluetooth+bounces-495-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=fail header.i=@kemnade.info header.s=20220719 header.b=QsYAKXgx; spf=pass (google.com: domain of linux-bluetooth+bounces-495-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-495-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 351C81C20B78 for ; Fri, 8 Dec 2023 22:13:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 27E4759B62; Fri, 8 Dec 2023 22:13:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=kemnade.info header.i=@kemnade.info header.b="QsYAKXgx" X-Original-To: linux-bluetooth@vger.kernel.org Received: from mail.andi.de1.cc (mail.andi.de1.cc [IPv6:2a02:c205:3004:2154::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 95893118; Fri, 8 Dec 2023 14:13:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=kemnade.info; s=20220719; h=Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-ID:Subject:Cc:To:From:Date:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=RlxG7vjWqKyoHCmskEV8jhRRkavkqsM6KoNtZ7Hn0ss=; b=QsYAKXgxEwdVvic0OVQS2q1njD KbrlmARUgUPeNq/fvlFmbLHMefvx8bjUUbb0/76kGmGb/Ar0fFT3VrPBNoMXSXCdIGgPYGf1EHla8 UJZM7Z2OKSCJJ7SdQP9qJ/8WpI350/ddOdwer1AaZ2eIyhwDV1b2iTrFvBvdzBTmYkA5NPzZySZwX +6wF3rS6ZNxBi7538KUuxvMXwgtiZWQIU4Tx/7AsXtGFbd73+y6Y76mi0it7jargk86CbnRIE6jMM IRGiP40J7DYEBlBtloTTedq8modobMGa15xzjEpvw9VYbZqFBkgEhXQ7TLOgqdRXwJYyxMHEbsYbF +E6oPSYg==; Received: from p200301077700c3001a3da2fffebfd33a.dip0.t-ipconnect.de ([2003:107:7700:c300:1a3d:a2ff:febf:d33a] helo=aktux) by mail.andi.de1.cc with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rBj6G-007BDR-9G; Fri, 08 Dec 2023 23:13:36 +0100 Date: Fri, 8 Dec 2023 23:13:32 +0100 From: Andreas Kemnade To: Johan Hovold Cc: Tony Lindgren , marcel@holtmann.org, johan.hedberg@gmail.com, luiz.dentz@gmail.com, arnd@arndb.de, gregkh@linuxfoundation.org, linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org, tomi.valkeinen@ideasonboard.com, =?UTF-8?B?UMOpdGVy?= Ujfalusi , robh@kernel.org Subject: Re: [RFC PATCH 0/3] bluetooth/gnss: GNSS support for TiWi chips Message-ID: <20231208231332.20f0b647@aktux> In-Reply-To: References: <20231126191840.110564-1-andreas@kemnade.info> <20231127135424.GO5169@atomide.com> <20231127215108.6e985819@aktux> X-Mailer: Claws Mail 4.1.1 (GTK 3.24.38; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Fri, 8 Dec 2023 17:25:27 +0100 Johan Hovold wrote: > On Mon, Nov 27, 2023 at 09:51:08PM +0100, Andreas Kemnade wrote: > > On Mon, 27 Nov 2023 15:54:24 +0200 > > Tony Lindgren wrote: > > > > > - Output at /dev/gnssX: > > > > AI2 vs. NMEA > > > > The chip can be configured into sending AI2-encapsulated NMEA, > > > > or proving data in a binary format. > > > > Some research has to be done yet for the details. > > > > A pile of logs is waiting for further analysis... > > Can you say something more about what the protocol looks like? Is there > some common framing that can/should be stripped by the driver in both > modes? > The frames (which can be fragmented into multiple gnss_recv_frame() calls) consist of: - some kind of start marker - one or more tlv structures (start marker is escaped here) - checksum - end marker In case of NMEA reporting we have with this patchset at /dev/gnssX or at /dev/tigps found in the bt200 vendor kernel e.g. 1000 d3 1800 82050000 244750474c4c2c2c2c2c2c2c562c4e2a36340d0a 9f05 1003 which is: 1000 = start marker, d3 = NMEA report 1800 = length (LE) 82050000 = ms from turning on GPS (LE). 244750474c4c2c2c2c2c2c2c562c4e2a36340d0a = NMEA sentence 9f05 = checksum 1003 = end marker. That is one report among others depending on what is enabled. So it is not like the situtation with Sirf where you send some magic to turn it into binary mode and some other magic turning it into NMEA mode and have no other stuff on the line. > > > > > > > > Arguments for/against NMEA: > > > > + Userspace is prepared to handle it > > > > + Power management can be easily done by the kernel > > > > - Less functionality can be used. > > > > > > I'd go with NMEA format as the default setting :) > > > > > yes, that would also be my preference. > > > > > > Arguments for/against AI2: > > > > + Full functionality can be accessed from userspace (incl. A-GPS, > > > > maybe raw satellite data) > > > > - Userspace has to behave to have proper power management > > > > - No freely (not even as in beer) tool available to fully use AI2, > > > > so there will be only a real advantage after long "French Cafe" > > > > sessions. > > > > > > Seems AI2 could be optionally enabled as needed with some writes > > > to /dev/gnss0 to change the mode? > > > > Hmm, we have > > /sys/class/gnss/gnss0/type to get the mode, maybe we add some file > > to change the mode? Or having it hidden behing a module parameter > > and implement something better accessible if any need arrives? > > The 'type' attribute is intended to reveal the GNSS receiver type > (class) as a hint to user space to avoid having to detect it at runtime > using heuristics. > > It does not reflect which mode is currently active for receivers that > provide both a vendor specific protocol and NMEA (e.g. u-blox > receivers). > > User space can currently switch modes at will by writing to /dev/gnss0 > as Tony mentioned. > Well, switching mode would in this case also mean configuring something in the driver to do something different as it would mean sending commands to enable NMEA reports and strip away the AI2 encapsulation in the driver. You usually do not configure drivers through write() but through some out-of-band means like ioctl(), sysfs, kernel compile options, module parameters. > It may or may not make sense to make sure a particular mode is set > during probe, for example, if there's no real use for the proprietary > protocol and everyone would just switch away from it immediately. > I would probably not do anything at probe time but turning on GPS and enable NMEA reports at open() time. With a lot of effort you can probably do interesting things with the proprietary mode. But given the fact that apparently nobody has done publicly so in the past years, I would not expect that anything arises suddenly. So in practice only NMEA would IMHO be useful and having raw AI2 might be something behind a module option or compile option to avoid introducing some new API before a real need is seen. Also as not everybody is using gpsd anymore, implementing any support for AI2 in userspace would not be at a single place. Regards, Andreas