Return-Path: From: Ronny L Nilsson To: bluez-devel@lists.sourceforge.net Subject: Re: [Bluez-devel] bccmd reading clock References: <20050627223919.793D83BC@arbetsmyra.dyndns.org> <1119973364.15397.77.camel@pegasus> In-Reply-To: <1119973364.15397.77.camel@pegasus> MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="------------Boundary-00=_EF7UEGWOZY5OALP4Y549" Message-Id: <20050629082735.CC3AC84E@arbetsmyra.dyndns.org> Sender: bluez-devel-admin@lists.sourceforge.net Errors-To: bluez-devel-admin@lists.sourceforge.net Reply-To: bluez-devel@lists.sourceforge.net List-Unsubscribe: , List-Id: BlueZ development List-Post: List-Help: List-Subscribe: , List-Archive: Date: Wed, 29 Jun 2005 10:26:02 +0200 --------------Boundary-00=_EF7UEGWOZY5OALP4Y549 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit Subject: > > I was in the need for an enhancement of the bccmd tool and thus > > made a small change. The supplied patch adds a command for reading > > the the BT-clock of local device. In the process I also made some > > minor changes to utils/tools/csr.c to reuse existing code. Besided > > reading 16-bit variables it can now also read 32- and 8-bits alike. > > don't do type conversion like this. Use varid_complex for it if you > wanna support uint32 and unit8 without copying code. As you command.... :) Perhaps like this then? Added parsing read of uart speed setting too. I'm a bit uncertain however of where to put corresponding uart config write. Both BCCMD and PSKEY seems adequate. /Ronny --------------Boundary-00=_EF7UEGWOZY5OALP4Y549 Content-Type: text/x-diff; charset="iso-8859-1"; name="bccmd.patch" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="bccmd.patch" SW5kZXg6IHV0aWxzL3Rvb2xzL2JjY21kLmMKPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PQpSQ1MgZmlsZTogL2N2c3Jvb3Qv Ymx1ZXovdXRpbHMvdG9vbHMvYmNjbWQuYyx2CnJldHJpZXZpbmcgcmV2aXNpb24gMS4xCmRpZmYg LXUgLXAgLXIxLjEgYmNjbWQuYwotLS0gdXRpbHMvdG9vbHMvYmNjbWQuYwkxNiBNYXkgMjAwNSAx MTo1MToyNyAtMDAwMAkxLjEKKysrIHV0aWxzL3Rvb2xzL2JjY21kLmMJMjkgSnVuIDIwMDUgMDg6 MTY6MjcgLTAwMDAKQEAgLTc5LDEzICs3OSwxMTAgQEAgc3RhdGljIGludCBjbWRfa2V5bGVuKGlu dCBkZCwgaW50IGFyZ2MsIAogCXJldHVybiAwOwogfQogCisKKworc3RhdGljIGludCBjbWRfY2xv Y2soaW50IGRkLCBpbnQgYXJnYywgY2hhciAqYXJndltdKQoreworCXVpbnQzMl90IGNsaz0wOwor CWludCBlcnI7CisKKwllcnIgPSBjc3JfcmVhZF92YXJpZF91aW50MzIoZGQsIDB4MjE0MywgQ1NS X1ZBUklEX0JUX0NMT0NLLCAmY2xrKTsKKwlpZiAoZXJyIDwgMCkgeworCQllcnJubyA9IC1lcnI7 CisJCXJldHVybiAtMTsKKwl9CisKKwlwcmludGYoIkRldmljZSBsb2NhbCBCVC1jbG9jazogMHgl eFxuIiwgY2xrKTsKKworCXJldHVybiAwOworfQorCisKKworCitzdGF0aWMgaW50IGNtZF91YXJ0 X3JlYWQoaW50IGRkLCBpbnQgYXJnYywgY2hhciAqYXJndltdKQoreworCXVpbnQxNl90IGJhdWQ7 CisJaW50IGVycjsKKworCWVyciA9IGNzcl9yZWFkX3ZhcmlkX3VpbnQxNihkZCwgMHgyMTQ1LCBD U1JfVkFSSURfQ09ORklHX1VBUlQsICZiYXVkKTsKKwlpZiAoZXJyIDwgMCkgeworCQllcnJubyA9 IC1lcnI7CisJCXJldHVybiAtMTsKKwl9CisKKwlwcmludGYoIkRldmljZSBVQVJUIHNwZWVkOiAi KTsKKwlzd2l0Y2goYmF1ZCAmIENTUl9VQVJUX0JBVURfTUFTSykgeworCQljYXNlIENTUl9VQVJU X0JBVURfOUs2OgorCQkJcHJpbnRmKCI5NjAwIik7CisJCQlicmVhazsKKwkJY2FzZSBDU1JfV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goaW50IGRkLCB1aW50MTZf dCBzZXFudW0sIHVpbnQxNl90IHBza2V5LCB1aW50OF90ICp2YWx1ZSwgdWludDE2X3QgbGVuZ3Ro KTsKIGludCBjc3JfcmVhZF9wc2tleV91aW50MTYoaW50IGRkLCB1aW50MTZfdCBzZXFudW0sIHVp bnQxNl90IHBza2V5LCB1aW50MTZfdCAqdmFsdWUpOwogaW50IGNzcl93cml0ZV9wc2tleV91aW50 MTYoaW50IGRkLCB1aW50MTZfdCBzZXFudW0sIHVpbnQxNl90IHBza2V5LCB1aW50MTZfdCB2YWx1 ZSk7Cg== --------------Boundary-00=_EF7UEGWOZY5OALP4Y549-- ------------------------------------------------------- SF.Net email is sponsored by: Discover Easy Linux Migration Strategies from IBM. Find simple to follow Roadmaps, straightforward articles, informative Webcasts and more! Get everything you need to get up to speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click _______________________________________________ Bluez-devel mailing list Bluez-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bluez-devel