Marco van de Voort wrote:
5- Is it OK to designate serial ports by COMx fow Windows and /dev/ttySx 
for Linux?
    

No, since e.g a serial port on some other device might have a different
state. And strictly, this is even possible for Windows. Always keep naming
configurable and overridable. Those series are extremely common, but not
that 
  
While not exactly the same situation, for one of my Windows apps in Delphi, I had to support real serial ports, virtual serial ports, and PC/SC card readers.  I found it easier to present a string list of all devices and allow the user to select from the string list the port/device needed.  Something similar can probably be done here, where the Windows ports can be read from the registry (a tricky process when virtual ports are involved such as com redirection over tcp/ip) and *nix can read the /dev/ttyS* entries.  Then port selection is simply passing in the string selected from the string list.  Completely Delphi incompatible, but probably the only way to get truly cross platform.  You can't just assume a 1 is COM1 on Windows and /dev/ttyS1 on *nix.  Windows can name ports "Virtual COM1" instead of "COM1" and then your attempt at passing '1' to build 'COM1' won't work.  Likewise, on Linux, you might have /dev/modem for a serial port (in theory anyway, not sure if you'd access that as just a serial port).  Of course, this just makes building the list the hard part.

Jeff.
--
I haven't smoked for 1 year, 7 months and 3 weeks, saving $2,716.59 and not smoking 18,110.61 cigarettes.


_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to