Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiguel de Icaza <miguel@gnome.org>2006-08-14 05:18:03 +0400
committerMiguel de Icaza <miguel@gnome.org>2006-08-14 05:18:03 +0400
commit0c94e2fc976fc7ec50c5cb14053c88b2237d533a (patch)
tree3718c8b940b4eb87750e39a7680a0f758c79fa36 /mcs/class/System/System.IO.Ports/SerialPort.cs
parenta83d4bdfa719755309d4d745dc9d3b5f2ad630c0 (diff)
2006-08-13 Miguel de Icaza <miguel@novell.com>
* SerialPort.cs: Also handle ttyUSB for Chris. svn path=/trunk/mcs/; revision=63692
Diffstat (limited to 'mcs/class/System/System.IO.Ports/SerialPort.cs')
-rw-r--r--mcs/class/System/System.IO.Ports/SerialPort.cs16
1 files changed, 13 insertions, 3 deletions
diff --git a/mcs/class/System/System.IO.Ports/SerialPort.cs b/mcs/class/System/System.IO.Ports/SerialPort.cs
index f75a9ba618f..1a13c329be1 100644
--- a/mcs/class/System/System.IO.Ports/SerialPort.cs
+++ b/mcs/class/System/System.IO.Ports/SerialPort.cs
@@ -455,9 +455,19 @@ namespace System.IO.Ports
public static string [] GetPortNames ()
{
int p = (int) Environment.OSVersion.Platform;
- if (p == 4 || p == 128) // Are we on Unix?
- return Directory.GetFiles ("/dev/", "ttyS*");
-
+
+ // Are we on Unix?
+ if (p == 4 || p == 128){
+ string [] ttys = Directory.GetFiles ("/dev/", "tty*");
+ List<string> serial_ports = new List<string> ();
+
+ foreach (string dev in ttys){
+ if (dev.StartsWith ("ttyS") || dev.StartsWith ("ttyUSB"))
+ serial_ports.Add (dev);
+
+ }
+ return serial_ports.ToArray ();
+ }
throw new NotImplementedException ("Detection of ports is not implemented for this platform yet.");
}