Path: utzoo!attcan!uunet!mcvax!ukc!reading!onion!cf-cm!ralph From: ralph@computing-maths.cardiff.ac.uk (Ralph Martin) Newsgroups: comp.sys.mac.programmer Subject: Serial Port, Resources etc Message-ID: <361@cf-cm.UUCP> Date: 9 May 88 08:16:26 GMT Organization: Univ. Coll. Cardiff, Cardiff, WALES, UK. Lines: 62 Posting-Front-End: GNU Emacs 18.47.1 of Mon Nov 23 1987 on v1 (berkeley-unix) I am posting this for a friend, please reply to him not me! ========forwarded posting========= Please reply to Sak Wathanasin uucp: ...!ukc!kernel!sw JANET: sw%kernel.uucp@uk.ac.ukc BITNET: sw%kernel.uucp%ukc.ac.uk@ukacrl.bitnet other: sw%kernel.uucp@ukc.ac.uk phone: (+44) 532 465311 snail: Kernel Technology Ltd, 21 Queen Street, Leeds LS1 2TW I've been trying to get a program to work as a background task under MultiFinder. The problem is that I cannot find out if some other program is already using the serial port. IM Vol 4 chp 22 says "The new Serial Driver verifies that the serial port is correctly configured and free; if not, the result code portNotCf or portInUse is returned." Well, as far as I can tell it does no such thing: with, e.g., kermit already running in an MF partition, I open the serial port in my program, and I get this: Open input SERD returns: 0 Open output SERD returns: 0 innum = -6 outnum = -7 RAMSDOpen returns: 0 Here is a fragment of the LSC code I use: err=OpenDriver("\p.AIn", &innum); /* display err msg here */ err=OpenDriver("\p.AOut", &outnum); /* display err no here */ err=RAMSDOpen(sPortA); /* I need to run with 64K roms */ /* display error no */ You may say "why do you care? - just grab the port anyway". Well, on quitting my program I do a RAMSDClose as prescribed by Apple, and, boy, does kermit (or whatever's using the port) get upset, and I don't blame it either. The same thing happens to my program if you exit the other first, of course. Now, I dug around IM some more, and found that the PRAM contains some info, but this is simply the default startup configuration, and is not affected by an application opening the serial port(s). Does anyone know how to tell if a port is already in use, and if so, how to get the current port configuration (baud rate etc)? More important, how can I stop some other application from stealing the port from me? I can't believe Apple didn't think about resolving requests for a scarce resource (I use the term in the ordinary sense) when they introduced MultiFinder, so how is it done? On another tack: is there a way to use ResEdit to look at resources in ROM? I played around for a bit, but gave up in the end, and wrote a little program to read out what I wanted. Just wondered if there was an easier way.... Also, does anyone know what errors -4100, -4101 from the PAP driver mean? Thanks in advance for any help, Sak