[futurebasic] Re: [FB] re: Serial port USB serial adapters does not work underOS9

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : March 2003 : Group Archive : Group : All Groups

From: Robert Purves <rpurves@...>
Date: Sat, 29 Mar 2003 13:14:17 +1200
On Saturday, March 29, 2003, at 03:10  AM, Walter Lenk wrote:

>> I am checking OS9.2.2 with basic (minimum) extension + Keyspan USA-28X
>>  (driver 1.9; directly connected to my PowerBook G4)
>>  How do you think about this?
>
> Should work fine. Just don't forget to override FN TermGetStatus:
>
> OVERRIDE LOCAL FN TermGetStatus(WhichPort)
> END FN = 0        ' Effectively pass a 'No Problem' back


Or, better, use this override to get error-codes that may help to solve 
the problem.


clear local
dim as Ptr      pb
dim as short    termStatus, ioErr
dim pBlock;256
override local fn TermGetStatus( serPort )
'~'1

fn FBInitSerialPorts
termStatus = 0
if ( system( _sysVers ) >= 1000 ) then shutdown "Not for OS X"

long if fn FBGetFilePBlock( serPort )

stop "Port in use by us"
termStatus = 2 // in use by us

xelse

pb            = @pBlock
pb.FBPBName$  = gFBSerialName$(-serPort)
pb.ioRefNum%  = 0
pb.ioNamePtr& = @gFBSerialOutName$(-serPort)
pb.ioPermssn` = _fsWrPerm
ioErr = fn PBOpenSync( pb ) // try open for output
long if ioErr
stop "Error " + str$( ioErr ) + " opening output"
termStatus = 2 // open already
xelse
ioErr = fn PBCloseSync( pb ) // close output
if ioErr then stop "Error " + str$( ioErr ) + " closing output"
pb.ioNamePtr& = @gFBSerialInName$(-serPort)
pb.ioRefNum%  = 0
pb.ioPermssn` = _fsRdPerm
ioErr = fn PBOpenSync( pb ) // try open for input
long if ioErr
stop "Error " + str$( ioErr ) + " opening input"
termStatus = 2 // open already
xelse
ioErr = fn PBCloseSync( pb ) // close input
if ioErr then stop "Error " + str$( ioErr ) + " closing input"
end if
end if

end if

end fn = termStatus


Robert P.