On Thu, 15 May 2008, Maksim Yevmenkin wrote:
> > How hard would it be to have a '-t auto' and have it print out the
> > pty it just allocated? It would make it much easier for scripts to
> > work if that was possible.
> >
> >  (Maybe just call openpty()?)
>
> not hard at all. however, how would rfcomm_sppd(1) print tty name if,
> say, it was asked to run in background? perhaps it would be better to
> teach rfcomm_sppd(1) to work with nmdm(4)?

I don't think nmdm would make a difference in this respect.

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)

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

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..

 > sudo ./rfcomm_sppd -t -a GPS
rfcomm_sppd[43683]: Starting on /dev/ttyp5

 > sudo cu -l /dev/ttyp5
~.

<press ctrl-c in rfcomm_sppd terminal>
^Crfcomm_sppd[43683]: Signal 2 received. Total 1 signals received

 > sudo cu -l /dev/ttyp5
rfcomm_sppd[43683]: Completed on /dev/ttyp5

I can't reproduce it very often though - I have had it happen quite a 
bit in the past though.

PS please CC me as I am not on the list.

-- 
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

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to