SerialPort cross-platform question...
John M McIntosh
johnmci at smalltalkconsulting.com
Sun Feb 24 01:32:31 UTC 2002
>
>I've just learned a couple more useful facts. First of all, John
>McIntosh steered me toward a wonderful facility provided quite a
>while ago by John Maloney. At least on the Mac (I'm curious about
>other platforms), you can print,
> MidiPrimTester new getPortList
>to get a listing like the following (this Mac had a Belkin USB unit attached):
>
>MIDI Ports:
> 0: Infrared Port (in/out)
> 1: Internal Modem (in/out)
> 2: Printer Port USB (in/out)
> 3: Belkin Serial Port (in/out)
> 4: QuickTime MIDI (out)
>
>This immediately cleared up some questions I had about how the
>Belkin adapter (USB to 2 serial ports) worked. More importantly, it
>steered John Mc straight to a bug in the Mac serial primitive that
>prevents opening any port numbered higher than 1. He's preparing a
>fix even as I write.
>
>If the portCount and portName primitives used by this facility work
>on all platforms, then there is at least the promise of things being
>pretty civilized.
>
> - Dan
Well this works because there is a facility to get back all the ports
that have registered as serial devices. This code lurks in the serial
plugin, but actually is invoked by the MIDI logic since I'd guess you
originally would have a modem port, and a serial port, so the
question was where does the MIDI port lurk.
Interesting enough in Dan's example there are 5 ports and you
couldn't open the midi port at 5 because some logic checking would
deny access to ports over 4. Also as Dan found out you can't open
ports 2 or higher because a validation check assumes macs only came
with 2 serial ports.
So in 3.2.5 (back porting to 3.0.x if really really needed). I'm
alter the code to allow oh 16 ports and ensuring the validation
actually follows the expectations. Note there is one bug also fixed,
it seems we would close port 0 and port 1 when squeak terminates,
even if we did not use them. This usually does not cause a problem,
but last year I noted an issue once in this area with Squeak hanging
on close when I had a palm pilot docked. So perhaps a bug has been
fixed.
Please note there is no serial support in the mach-o OS-X version of
the VM yet. For that the suggested solution is to fall back to unix
solutions (oh what fun). Besides macs today don't have serial
ports....
--
--
===========================================================================
John M. McIntosh <johnmci at smalltalkconsulting.com> 1-800-477-2659
Corporate Smalltalk Consulting Ltd. http://www.smalltalkconsulting.com
===========================================================================
More information about the Squeak-dev
mailing list
|