// reads
//
-#if NET_2_0
-
using System;
using System.Collections.Generic;
using System.ComponentModel;
return read_timeout;
}
set {
- if (value <= 0 && value != InfiniteTimeout)
+ if (value < 0 && value != InfiniteTimeout)
throw new ArgumentOutOfRangeException ("value");
if (is_open)
return write_timeout;
}
set {
- if (value <= 0 && value != InfiniteTimeout)
+ if (value < 0 && value != InfiniteTimeout)
throw new ArgumentOutOfRangeException ("value");
if (is_open)
// Are we on Unix?
if (p == 4 || p == 128 || p == 6) {
string[] ttys = Directory.GetFiles("/dev/", "tty*");
+ bool linux_style = false;
+
+ //
+ // Probe for Linux-styled devices: /dev/ttyS* or /dev/ttyUSB*
+ //
+ foreach (string dev in ttys) {
+ if (dev.StartsWith("/dev/ttyS") || dev.StartsWith("/dev/ttyUSB")){
+ linux_style = true;
+ break;
+ }
+ }
+
foreach (string dev in ttys) {
- if (dev.StartsWith("/dev/ttyS") || dev.StartsWith("/dev/ttyUSB"))
- serial_ports.Add(dev);
+ if (linux_style){
+ if (dev.StartsWith("/dev/ttyS") || dev.StartsWith("/dev/ttyUSB"))
+ serial_ports.Add (dev);
+ } else {
+ if (dev != "/dev/tty" && dev.StartsWith ("/dev/tty") && !dev.StartsWith ("/dev/ttyC"))
+ serial_ports.Add (dev);
+ }
}
} else {
using (RegistryKey subkey = Registry.LocalMachine.OpenSubKey("HARDWARE\\DEVICEMAP\\SERIALCOMM"))
}
-#endif