And modem shall talk unto telephone......

John Hinsley jhinsley at telinco.co.uk
Sat Aug 4 00:58:17 UTC 2001


Thanks Ned, that makes perfect sense to me. I have to knuckle down to
some coursework for the next 10 days (I can always find something more
interesting to do!) but I'm *reasonably* confident that I can now do
something with this. 

It occured to me (as I'm sure it occured to everyone else ;-)) that I
know absolutely nothing about port programming. Any reading
recommendations would be very welcome.

Many thanks

Cheers

John

Ned Konz wrote:
> 
> On Friday 03 August 2001 03:00 am, you wrote:
> > I'm trying to get my modem to talk to the telephone (more precisely, to
> > dial a phone number).
> >
> > I'm guessing I need to use primitiveSerialPortOpen: to open the port.
> > Then I can chuck some Hayes commands (or Diamond's version of Hayes
> > commands) at it.
> 
> Why call primitive anything? There's a SerialPort class that works just
> fine... Note that you need to set the data rate and so on _before_ you open
> the port.
> 
> > But the rest is all gobbledegook.
> >
> > And, come to think of it, I don't usually do all that when I use the
> > modem. Am I right in thinking that I can simply issue commands directly
> > to SerialPort?
> 
> Yes. Well... the problem is that I had to work around a broken, Mac-ish API
> that didn't account for the fact that people could have randomly named serial
> ports on Unix systems (it makes more sense to use numbers for serial ports in
> Mac and Windoze land where there is some kind of a reasonable mapping between
> numbers and serial port names).
> 
> What I did when I wrote sqUnixSerial.c is that I made it work for my system
> (patches welcome!). That is, I mapped port number 0 into /dev/ttyS0, etc. (I
> have a Linux system).
> 
> If you want it to work out of the box, just make sure you have a /dev/ttyS0
> through /dev/ttyS9 that is an alias for your serial port (using mknod or ln)
> and call openPort: with the right number.
> 
> If this bothers you, edit sqUnixSerial.c to change the base name of the
> serial port. Or hexedit the plugin.
> 
> This works on my system (where /dev/ttyS1 is the modem):
> 
> p _ SerialPort new
> baudRate: 9600; "these are all defaults and don't need to be called"
> dataBits: 8;
> inputFlowControlType: 0;
> outputFlowControlType: 0;
> parityType: 0;
> stopBitsType: 1.
> 
> p openPort: 1.
> 
> p nextPutAll: 'ATDT611#', String cr.    "dial"
> 
> p nextPutAll: String cr.        "hang up"
> 
> p closePort.
> 
> --
> Ned Konz
> currently: Stanwood, WA
> email:     ned at bike-nomad.com
> homepage:  http://bike-nomad.com

-- 
******************************************************************************
Marx: "Why do Anarchists only drink herbal tea?"
Proudhon: "Because all proper tea is theft."
******************************************************************************




More information about the Squeak-dev mailing list