NetBSD-Users archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: Help on serial ports
Michael Smith <michael.smith%netapps.com.au@localhost> wrote:
> On Mon, 21 Jun 2010 22:16:25 +0200
> volker%volker-wolfram.de@localhost (Volker Wolfram) wrote:
>
> > No I try to communicate with 2 USB-RS232 Adapters and a nullmodem cable. I
> > try
> > to send data from one /dev/ttyU0 to /dev/ttyU1 and catch the data on the
> > last
> > device. But all fails. I tried many steps but all fails. Except one
> > following
> > setup: one minicom client comunicates via /dev/ttyU0 and another client do
> > it
> > on /dev/ttyU1. So I think my serial line adapters and the nullmodem cable
> > work
> > well. But what should I do with my scripts? Can anyone help me?
>
> Exactly how are you communicating with the port? I wrote an SMS daemon in C.
> It talks to the modem via a serial port. I had to do a *lot* of low level
> hacking to get that port talking to me. I would be happy to post the code if
> it is going to help.
> --
> Michael Smith
> +61 416 062 898
> http://glitch.tl
Hello,
here is my code for sending a character:
#!/usr/pkg/bin/tclsh
set serialHandle [ open "/dev/ttyU0" r+ ]
fconfigure $serialHandle -translation binary -mode "9600,n,8,1"
fconfigure $serialHandle -encoding binary
fconfigure $serialHandle -blocking 0 -buffering none -handshake none
fileevent $serialHandle writable [ puts $serialHandle "m" ]
close $serialHandle
and here the code for the receiver:
#!/usr/pkg/bin/tclsh
set serialHandle [ open "/dev/ttyU1" r+ ]
fconfigure $serialHandle -translation binary -mode "9600,n,8,1"
fconfigure $serialHandle -encoding binary
fconfigure $serialHandle -blocking 0 -buffering none -handshake none
fileevent $serialHandle readable [ puts stdout [ read $serialHandle ] ]
close $serialHandle
Please help me.
Regards,
Volker Wolfram
Home |
Main Index |
Thread Index |
Old Index