Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!umich!yale!cs.utexas.edu!usc!snorkelwacker!ira.uka.de!smurf!urlichs From: urlichs@smurf.ira.uka.de Newsgroups: comp.sys.mac.programmer Subject: Re: For GURU'S Only Message-ID: <1546@smurf.ira.uka.de> Date: 16 Feb 90 10:17:54 GMT References: <4073@ccncsu.ColoState.EDU> <34253@ucbvax.BERKELEY.EDU> <6711@ucdavis.ucdavis.edu> <1533@smurf.ira.uka.de> <6747@ucdavis.ucdavis.edu> Organization: University of Karlsruhe, FRG Lines: 31 In comp.sys.mac.programmer, article <6747@ucdavis.ucdavis.edu>, vmrad@pollux (Bernard Littau) writes: < In article <1533@smurf.ira.uka.de> urlichs@smurf.ira.uka.de (Matthias Urlichs) writes: < >< < >I don't think you need a disk write buffer if you write to the hard disk. < >What I did was to call PBRead(serial port, (16 kByte or end of picture)) < >asynchronously, call WaitNextEvent with a reasonable timeout (based on the < >serial speed, how much you want to read, and how much is already there), and < >call PBWrite to your disk file if that call completes. < >Allocate a nice big serial buffer (maybe 48k)... < < As I read your reply, you are doing: < SerSetBuf( a 48k buffer) < PBRead(serial port, serial port buffer) < PBWrite(to disk, serial port buffer) Replace this with: PBRead (serial port, private 16kB buffer) PBWrite (Disk, same buffer) < < This I am sure will work, once. Maybe more often. It is however very < dangerous. The serial port buffer is a circular buffer. You could put < yourself in the situation of clobbering your data as you do a PBRead < from the serial port buffer to the serial port buffer. [...] < After I say SerSetBuf(), said buffer belongs to the serial driver until the next SerSetBuf. I do not assume anything about what the serial driver does with that buffer. I never understood why anyone would be reading from the serial buffer to the serial buffer, much less assume that I implied this... So, I don't see what could possibly go wrong with the above method. -- Matthias Urlichs