[erlang-questions] Erlang Reading/Writing /dev/modem?

Richard Andrews <>
Tue Apr 28 02:02:47 CEST 2009


When CONNECT is delivered, the modem changes to data mode (DCD modem line is typically asserted to indicate data mode). Usually in data mode the way back to command mode is to send "+++" or toggle the DTR modem line. Which one is required can depend on the modem setup (eg. AT&D). If your modem uses DTR and has AT&D=2 then this might cause the dropouts on CONECT. Try AT&D=0. You probably need to use the serial port ioctl()s to manipulate the control lines through a port program.

IMO you would do well to create a port program that allows erlang to move data *and* change and monitor control lines. You are likely to hit hard-to-debug problems if you do not have the ability to control and monitor these additional out-of-band control lines.


--
  Rich



________________________________
From: Keith Irwin <>
To: Erlang/OTP discussions <>
Sent: Tuesday, 28 April, 2009 8:09:04 AM
Subject: [erlang-questions] Erlang Reading/Writing /dev/modem?

Folks--

I'm interested in using Erlang to read from a modem device /dev/cu.usbmodem so that I can then send whatever I read to another Erlang service running on an Internet port.

I have a point-of-sale terminal plugged into a phone-simulator, which in turn is plugged into an Apple USB Modem.

When I initiate a function on the POS, it dials up.

I send an "ATA" (and any other necessary init strings) to /dev/cu.usbmodem, and the modem answers. I get a "CONNECT 1200" string, which tells me that the connection is fine and established. 

Then the POS machine "hangs up" and tries again.

Can I assume I can just read bytes from /dev/cu.usbmodem (as if it were a file), and then do something with those bytes? Is the reason the POS is hanging up is because nothing is sitting there reading from /dev/cu.usbmodem except "cat"?

I have to admit, I really don't know what "usually" happens after modems negotiate with one another.

I think Erlang is an excellent choice for working with this because of the pattern matching, if nothing else.

Keith


      Yahoo!7 recommends that you update your browser to the new Internet Explorer 8.Get it now.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20090427/babc1517/attachment.html>


More information about the erlang-questions mailing list