Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 13 May 2008 09:48:06 -0700
From:      "Maksim Yevmenkin" <maksim.yevmenkin@gmail.com>
To:        "Helge Oldach" <freebsd-bluetooth@oldach.net>
Cc:        freebsd-bluetooth@freebsd.org, rizzo@iet.unipi.it
Subject:   Re: any reason to require -t dev in rfcomm_sppd -S ?
Message-ID:  <bb4a86c70805130948x54fa4ea8tbc170196ff4eeaec@mail.gmail.com>
In-Reply-To: <200805131552.m4DFqQOW031043@sep.oldach.net>
References:  <bb4a86c70804211151l76230f1ek32a9c51b644a983e@mail.gmail.com> <200805131552.m4DFqQOW031043@sep.oldach.net>

next in thread | previous in thread | raw e-mail | index | archive | help
------=_Part_8614_29769232.1210697286687
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

On Tue, May 13, 2008 at 8:52 AM, Helge Oldach
<freebsd-bluetooth@oldach.net> wrote:
> Maksim Yevmenkin wrote on Mon, 21 Apr 2008 20:51:55 +0200 (CEST):
>> 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).
>
> Your patch applies cleanly, but I just get
>
> # rfcomm_sppd -S
> rfcomm_sppd: Could not get socket name
> #
>
> It seems that getsockbyname fails. What is the reason for that anyway?
>
> BTW, Luigi's pipe application is interesting, but what about true
> two-way communcation? For instance, I would like to have something like
>
> # rfcomm_sppd -S -c sp -a myPalm -x "coldsync -t serial -s -md"
>
> ...meaning: Upon receipt of a SP connection request from myPalm we would
> fork coldsync to synchronize the Palm (just like USB or serial sync, but
> now bluetooth).
>
> This could even go into /etc/ttys, forking a fresh rfcomm_sppd after the
> request terminates.
>
> I'm currently doing this in two separate steps, first starting
> rfcomm_sppd with some arbitrary pty, then coldsync talking to that pty.
> So yes, this definitely works.


well, there is a problem with my previous patch. please try the
attached updated patch.

thanks,
max

------=_Part_8614_29769232.1210697286687
Content-Type: text/plain; name=rfcomm_sppd.patch.txt
Content-Transfer-Encoding: base64
X-Attachment-Id: f_fg6pw4500
Content-Disposition: attachment; filename=rfcomm_sppd.patch.txt

SW5kZXg6IHJmY29tbV9zcHBkLjEKPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PQpSQ1MgZmlsZTogL3Vzci9sb2NhbC9jdnMv
dXNyLmJpbi9ibHVldG9vdGgvcmZjb21tX3NwcGQvcmZjb21tX3NwcGQuMSx2CnJldHJpZXZpbmcg
cmV2aXNpb24gMS4xMApkaWZmIC11IC1yMS4xMCByZmNvbW1fc3BwZC4xCi0tLSByZmNvbW1fc3Bw
ZC4xCTIxIEFwciAyMDA4IDE4OjEzOjIzIC0wMDAwCTEuMTAKKysrIHJmY29tbV9zcHBkLjEJMjEg
QXByIDIwMDggMTg6Mzc6MDkgLTAwMDAKQEAgLTI1LDcgKzI1LDcgQEAKIC5cIiAkSWQ6IHJmY29t
bV9zcHBkLjEsdiAxLjEwIDIwMDgvMDQvMjEgMTg6MTM6MjMgbWF4IEV4cCAkCiAuXCIgJEZyZWVC
U0Q6IHNyYy91c3IuYmluL2JsdWV0b290aC9yZmNvbW1fc3BwZC9yZmNvbW1fc3BwZC4xLHYgMS4x
MCAyMDA3LzAxLzI1IDIwOjU0OjU5IGVtYXggRXhwICQKIC5cIgotLkRkIEphbnVhcnkgMjQsIDIw
MDcKKy5EZCBBcHJpbCAyMSwgMjAwOAogLkR0IFJGQ09NTV9TUFBEIDEKIC5PcwogLlNoIE5BTUUK
QEAgLTY5LDE0ICs2OSwxNSBAQAogdmlhIHRoZQogLlhyIHNkcGQgOAogZGFlbW9uLgotVGhlCitJ
ZgogLkZsIHQKLW9wdGlvbiBtdXN0IGJlIHNwZWNpZmllZDsKK29wdGlvbnMgd2FzIHNwZWNpZmll
ZCwKIHRoZSBzZXJ2ZXIgc2lkZSBvZiB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ZXJyb3Ioc2RwX2Vycm9yKHNzKSksIHNkcF9lcnJv
cihzcykpOwotCQltZW1zZXQoJmxhbiwgMCwgc2l6ZW9mKGxhbikpOwotCQlsYW4uc2VydmVyX2No
YW5uZWwgPSBjaGFubmVsOworCQltZW1zZXQoJnNwLCAwLCBzaXplb2Yoc3ApKTsKKwkJc3Auc2Vy
dmVyX2NoYW5uZWwgPSBjaGFubmVsOwogCi0JCW1lbWNweSgmYnRfYWRkcl9hbnksIE5HX0hDSV9C
REFERFJfQU5ZLCBzaXplb2YoYnRfYWRkcl9hbnkpKTsKLQkJaWYgKHNkcF9yZWdpc3Rlcl9zZXJ2
aWNlKHNzLCBzZXJ2aWNlLCAmYnRfYWRkcl9hbnksCi0JCSAgICAodm9pZCAqKSZsYW4sIHNpemVv
ZihsYW4pLCAmc2RwX2hhbmRsZSkgIT0gMCkgeworCQlpZiAoc2RwX3JlZ2lzdGVyX3NlcnZpY2Uo
c3MsIFNEUF9TRVJWSUNFX0NMQVNTX1NFUklBTF9QT1JULAorCQkJCSZidF9hZGRyX2FueSwgKHZv
aWQgKikmc3AsIHNpemVvZihzcCksCisJCQkJJnNkcF9oYW5kbGUpICE9IDApIHsKIAkJCWVycngo
MSwgIlVuYWJsZSB0byByZWdpc3RlciBMQU4gc2VydmljZSB3aXRoICIKIAkJCSAgICAibG9jYWwg
U0RQIGRhZW1vbi4gJXMgKCVkKSIsCiAJCQkgICAgc3RyZXJyb3Ioc2RwX2Vycm9yKHNzKSksIHNk
cF9lcnJvcihzcykpOwo=
------=_Part_8614_29769232.1210697286687--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bb4a86c70805130948x54fa4ea8tbc170196ff4eeaec>