Date: Mon, 21 Apr 2008 11:51:55 -0700 From: "Maksim Yevmenkin" <maksim.yevmenkin@gmail.com> To: "Luigi Rizzo" <rizzo@iet.unipi.it> Cc: freebsd-bluetooth@freebsd.org Subject: Re: any reason to require -t dev in rfcomm_sppd -S ? Message-ID: <bb4a86c70804211151l76230f1ek32a9c51b644a983e@mail.gmail.com> In-Reply-To: <20080417180601.GA76189@onelab2.iet.unipi.it> References: <20080417115631.GA72315@onelab2.iet.unipi.it> <bb4a86c70804171039l2f85b360k3ae30e068fee5b83@mail.gmail.com> <20080417180601.GA76189@onelab2.iet.unipi.it>
next in thread | previous in thread | raw e-mail | index | archive | help
------=_Part_6824_15998800.1208803915996 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline On Thu, Apr 17, 2008 at 11:06 AM, Luigi Rizzo <rizzo@iet.unipi.it> wrote: > > On Thu, Apr 17, 2008 at 10:39:16AM -0700, Maksim Yevmenkin wrote: > > On Thu, Apr 17, 2008 at 4:56 AM, Luigi Rizzo <rizzo@iet.unipi.it> wrote: > > > hi, is there any compelling reason to require > > > the '-t device' option in rfcomm_sppd when used in server mode ? > > > > technically, no. just need to be careful who is going to setup tty > > properly, for example make it 'raw' as rfcomm_sppd(1) does with pty. > > rfcomm_sppd(1) already can be used inside ppp(8), i.e. one can do > > something like > > > > set device '!/usr/bin/rfcomm_sppd -a mobile -c sp' > > > > in /etc/ppp.conf and it will work just fine. rfcomm_sppd(1) does not > > do anything to tty when running using stdin/stdout in client mode. the > > assumption here is that whatever calls rfcomm_sppd(1) will setup > > tty/fd properly. > > > > > I tried to disable the one-line that checks it in the code, and > > > things seem to work - and this makes the program very convenient > > > to use in a pipeline, e.g. to receive data from a remote bluetooth > > > device. > > > > right. can you please provide usage example? i certainly would not > > object to making the change you are requesting. > > sure - i need to listen to a portable ElectroCardioGram (ECG) device > which talks to the external world through bluetooth. The device > must have some kind of modem inside - its console port says it is > issuing commands such as > > AT+ZV SPPConnect XXX > ... > > where XXX is the (manually configured) address of the bluetooth > dongle on the PC. On the FreeBSD side, running > "rfcom_sppd -a YYY" (without the -S option, YYY is the ECG address) > sometimes connects, but most of the times doesnt. > > With a patched rfcomm_sppp i can just do > > rfcomm_sppd -S -a YYY | my_data_logger > > rather than having to manually select an available tty/pty pair > > Don't know how many devices behave in this way, but a > search for "AT+ZV SPPConnect" gives several matches with > documentation for embedded hardware. ok, please try the attached patch and see if it works for you. i basically removed the check for tty name in server mode, bind to "wildcard" channel instead of generating one based on pid (if channel was not specified) and fixed a possible problem with service registration in server mode (i.e. always register serial port service). thanks, max > > cheers > luigi > ------=_Part_6824_15998800.1208803915996 Content-Type: text/plain; name=rfcomm_sppd.patch.txt Content-Transfer-Encoding: base64 X-Attachment-Id: f_ffbemj4y0 Content-Disposition: attachment; filename=rfcomm_sppd.patch.txt SW5kZXg6IHJmY29tbV9zcHBkLjEKPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PQpSQ1MgZmlsZTogL3Vzci9sb2NhbC9jdnMv dXNyLmJpbi9ibHVldG9vdGgvcmZjb21tX3NwcGQvcmZjb21tX3NwcGQuMSx2CnJldHJpZXZpbmcg cmV2aXNpb24gMS4xMApkaWZmIC11IC1yMS4xMCByZmNvbW1fc3BwZC4xCi0tLSByZmNvbW1fc3Bw ZC4xCTIxIEFwciAyMDA4IDE4OjEzOjIzIC0wMDAwCTEuMTAKKysrIHJmY29tbV9zcHBkLjEJMjEg QXByIDIwMDggMTg6Mzc6MDkgLTAwMDAKQEAgLTI1LDcgKzI1LDcgQEAKIC5cIiAkSWQ6IHJmY29t bV9zcHBkLjEsdiAxLjEwIDIwMDgvMDQvMjEgMTg6MTM6MjMgbWF4IEV4cCAkCiAuXCIgJEZyZWVC U0Q6IHNyYy91c3IuYmluL2JsdWV0b290aC9yZmNvbW1fc3BwZC9yZmNvbW1fc3BwZC4xLHYgMS4x MCAyMDA3LzAxLzI1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o= ------=_Part_6824_15998800.1208803915996--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bb4a86c70804211151l76230f1ek32a9c51b644a983e>