Xref: utzoo comp.sys.amiga:49837 comp.sys.amiga.tech:9983 Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!zaphod.mps.ohio-state.edu!brutus.cs.uiuc.edu!apple!sun-barr!newstop!sun!stpeter!cmcmanis From: cmcmanis@stpeter.Sun.COM (Chuck McManis) Newsgroups: comp.sys.amiga,comp.sys.amiga.tech Subject: Re: Come on PEOPLE... Message-ID: <131777@sun.Eng.Sun.COM> Date: 13 Feb 90 23:44:52 GMT References: <1990Feb12.223912.7167@ug.cs.dal.ca> Sender: news@sun.Eng.Sun.COM Reply-To: cmcmanis@sun.UUCP (Chuck McManis) Organization: Sun Microsystems, Mountain View Lines: 70 In article <1990Feb12.223912.7167@ug.cs.dal.ca> (tom) writes: > I have recieved many replies(like almost 10...) from my posting asking > for help on > using the SERIAL port(modem)..they all asked "PLEASE foward me any info > you recieve.." but no replies(at least via email, I believe there was one > reply on the net that I got) telling me how to do anything.. > SOMEBODY must know how to do it or have source on how to open, read to, > write from Serial.. > apparently many people are having the same problem as I am, hence all > the requests to me, so your words wouldn't fall on deaf ears.. This seems a good testamonial to my case on the problems with the Amiga "serial" architecture. Anyway, the answer isn't simple. It goes something like this : Somewhere in your main routine you need to open the serial.device, to do this you have to allocated an extended IORequest structure, and created a reply port. There are descriptions on how to do this in the RKM but basically the flow is something like : ... struct IOExtSer Myserialstruct; port = CreatePort(0, 0); if (!port) abort("Can't create port!"); Myserialstruct.IOSer.io_Message.ReplyPort = port; error = OpenDevice("serial.device", 0, &Myserialstruct, 0); if (error) abort("Can't open serial.device!"); ... char read_a_character() { char a; Myserialstruct.IOSer.io_Command = READ; Myserialstruct.IOSer.io_Length = 1; Myserialstruct.IOSer.io_Data = &a; DoIO(&Myserialstruct); if (Myserialstruct.IOSer.io_Error != 0) return (0); else return (a); } Etc etc for the write and set parameters calls. If you want to just check to see if a character is available and return if there isn't one, then you will need to look up doing asynchronous I/O using SendIO/WaitIo. Read and understand the following sections of the available manuals and then ask more specific questions if you want to get answers : RKM Libraries and Devices : Chapter on serial.device Chapter on Exec/IO RKM AutoDocs and Includes : devices/serial.h serial.device Sorry about not going into great detail, but you have to meet us at least halfway. --Chuck McManis uucp: {anywhere}!sun!cmcmanis BIX: cmcmanis ARPAnet: cmcmanis@Eng.Sun.COM These opinions are my own and no one elses, but you knew that didn't you. "If it didn't have bones in it, it wouldn't be crunchy now would it?!"