From owner-freebsd-bluetooth@FreeBSD.ORG Mon May 19 23:16:14 2008 Return-Path: Delivered-To: freebsd-bluetooth@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 10E0B106567F for ; Mon, 19 May 2008 23:16:14 +0000 (UTC) (envelope-from doconnor@gsoft.com.au) Received: from cain.gsoft.com.au (cain.gsoft.com.au [203.31.81.10]) by mx1.freebsd.org (Postfix) with ESMTP id 4E18E8FC20 for ; Mon, 19 May 2008 23:16:13 +0000 (UTC) (envelope-from doconnor@gsoft.com.au) Received: from inchoate.gsoft.com.au (ppp121-45-148-169.lns11.adl6.internode.on.net [121.45.148.169]) (authenticated bits=0) by cain.gsoft.com.au (8.13.8/8.13.8) with ESMTP id m4JNG5F6032043 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Tue, 20 May 2008 08:46:07 +0930 (CST) (envelope-from doconnor@gsoft.com.au) From: "Daniel O'Connor" To: "Maksim Yevmenkin" Date: Tue, 20 May 2008 08:45:50 +0930 User-Agent: KMail/1.9.7 References: <200805141647.m4EGlUP1021019@repoman.freebsd.org> <200805181952.00112.doconnor@gsoft.com.au> In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart1737171.bu05tt8xdj"; protocol="application/pgp-signature"; micalg=pgp-sha1 Content-Transfer-Encoding: 7bit Message-Id: <200805200845.57007.doconnor@gsoft.com.au> X-Spam-Score: -2.212 () BAYES_00,RDNS_DYNAMIC X-Scanned-By: MIMEDefang 2.63 on 203.31.81.10 Cc: "freebsd-bluetooth@freebsd.org" Subject: Re: cvs commit: src/usr.bin/bluetooth/rfcomm_sppd rfcomm_sppd.1 rfcomm_sppd.c X-BeenThere: freebsd-bluetooth@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Using Bluetooth in FreeBSD environments List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 May 2008 23:16:14 -0000 --nextPart1737171.bu05tt8xdj Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On Tue, 20 May 2008, Maksim Yevmenkin wrote: > > I am thinking of an operating mode where a script or daemon runs > > when a device associates and sets up channels the user has > > configured. So the script runs rfcomm_sppd and groks the output to > > find what PTY has been allocated and creates a symlink to a human > > understandable name (eg /dev/gps0 or whatever) > > right, that is what i initially wanted to do. the idea was to have > complicated configuration file which describes what what > rfcomm_sppd(1) should do when a device with a given bd_addr connects Shouldn't be that complex ;) > on a certain rfcomm channel. then i realized that serial port service > is not really good candidate for multiplexing. it all boils down to > the fact that only one client can use virtual serial port at a time. Why would you be multiplexing it? It's a virtual serial port, pty sounds=20 like a pretty good match. ie I think I am misunderstanding what you are=20 trying to say. > i chose pty(4) over nmdm(4) initially to be able to > > a) call openpty() > b) fork() > c) redirect child's stdin/out to pty > d) exec() something in child. > > that is similar to how rfcomm_pppd(8) wrapper works (without doing > pty part). as i thought about it a bit more, i convinced myself that > it probably would be much easier to run multiple instances of > rfcomm_sppd(1) on different channels. each instance would then do > something different. i still need to write the part where > rfcomm_sppd(1) executes something external when client connects. OK. > > I have attached a patch which uses openpty() and seems to work fine > > (tested quickly against my BT GPS unit & phone). If the patch > > doesn't make it you can get it from > > http://www.gsoft.com.au/~doconnor/rfcomm_sppd-pty.diff > > i do not see how slave pty name is being passed back to > rfcomm_sppd(1) invoker in _server_ mode. are you suggesting to parse > syslog messages? or are you suggesting to have other process that is Mmm good point :( I was thinking that in server mode it opened the PTY then waited for a=20 connection but that isn't the case.. I guess it could be (although it mangles up the code) > actively looking for "known" bluetooth devices in range (i.e. perform > discovery or ping) and, when found, proactively start rfcomm_sppd(1) > in _client_ mode to connect to found devices? I was thinking basically of only using client mode - I haven't used=20 server mode so it didn't really enter my thoughts :) As you say I was thinking that you poll for known devices (that the user=20 has entered into a config file) and run rfcomm_sppd in client mode to=20 connect to them. I am not sure how/why server mode is actually used - I only have=20 experience with devices that are basically using BT as an RS232=20 replacement. > > On a related note I find I have to 'kill -9' rfcomm_sppd sometimes > > if I have connected to the PTY and then disconnected, eg.. > > hmm... interesting... i will take a look. just need to find my old > bluetooth gps unit. Thanks.. Could be my dodgy GPS unit of course :) ($35 off ebay) =2D-=20 Daniel O'Connor software and network engineer for Genesis Software - http://www.gsoft.com.au "The nice thing about standards is that there are so many of them to choose from." -- Andrew Tanenbaum GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C --nextPart1737171.bu05tt8xdj Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.8 (FreeBSD) iD8DBQBIMgos5ZPcIHs/zowRApKpAJwPUv8CGlfr8CNqZTyxOnpkJUCE6QCdHlph uaxJE6h3pOgLxWbkx2BQtqw= =GbjA -----END PGP SIGNATURE----- --nextPart1737171.bu05tt8xdj--