[chronojump] On Linux only USB-serial ports are shown



commit e634e61722b3fc973081275f7dd4f847ffc27521
Author: Xavier de Blas <xaviblas gmail com>
Date:   Fri Jan 4 15:27:31 2013 +0100

    On Linux only USB-serial ports are shown

 src/gui/chronopic.cs |   16 +++++++++++-----
 src/util.cs          |    5 ++++-
 2 files changed, 15 insertions(+), 6 deletions(-)
---
diff --git a/src/gui/chronopic.cs b/src/gui/chronopic.cs
index cdea466..4104ccd 100644
--- a/src/gui/chronopic.cs
+++ b/src/gui/chronopic.cs
@@ -336,10 +336,11 @@ Log.WriteLine("bbb");
 
 	private void createComboLinux() {
 		string [] usbSerial = Directory.GetFiles("/dev/", "ttyUSB*");
-		string [] serial = Directory.GetFiles("/dev/", "ttyS*");
-		string [] all = Util.AddArrayString(usbSerial, serial);
+		//string [] serial = Directory.GetFiles("/dev/", "ttyS*");
+		//string [] all = Util.AddArrayString(usbSerial, serial);
 		string [] def = Util.StringToStringArray(Constants.ChronopicDefaultPortLinux);
-		string [] allWithDef = Util.AddArrayString(def, all);
+		//string [] allWithDef = Util.AddArrayString(def, all);
+		string [] allWithDef = Util.AddArrayString(def, usbSerial);
 
 		UtilGtk.ComboUpdate(combo_linux1, allWithDef, Constants.ChronopicDefaultPortLinux);
 		UtilGtk.ComboUpdate(combo_linux2, allWithDef, Constants.ChronopicDefaultPortLinux);
@@ -407,8 +408,13 @@ Log.WriteLine("bbb");
 				Catalog.GetString("Ports above COM4 may not work.") + "\n" + 
 				Catalog.GetString("If you want a safer port, press help button and press 'Force Chronopic to port COM1 - COM4'.");
 
-		textview_ports_found.Buffer = UtilGtk.TextViewPrint(
-				Util.StringArrayToString(SerialPort.GetPortNames(),"\n"));
+		if(Util.IsWindows())
+			textview_ports_found.Buffer = UtilGtk.TextViewPrint(
+					Util.StringArrayToString(SerialPort.GetPortNames(),"\n"));
+		else
+			textview_ports_found.Buffer = UtilGtk.TextViewPrint(
+					Util.DetectPortsLinux(false));
+		
 		textview_ports_found_explanation.Buffer = UtilGtk.TextViewPrint(
 				Catalog.GetString("These are USB devices like Chronopic but also pendrives, USB printers...") + "\n" + 
 				Catalog.GetString("If you just plugged Chronopic cable and expected port is not listed, close and open again this window.") +
diff --git a/src/util.cs b/src/util.cs
index b35622b..ad0bea6 100644
--- a/src/util.cs
+++ b/src/util.cs
@@ -1458,7 +1458,9 @@ public class Util
 			foreach(string myPort in usbSerial)
 				detected += midStr + myPort;
 			detected += endStr;
-		} else {
+		} 
+		/*
+		   else {
 			detected += Constants.NotFoundUSBSerialPortsString + "\n";
 			string [] serial = Directory.GetFiles("/dev/", "ttyS*");
 			detected += Constants.FoundSerialPortsString + " " + serial.Length + "\n" + startStr;
@@ -1466,6 +1468,7 @@ public class Util
 				detected += midStr + myPort;
 			detected += endStr;
 		}
+		*/
 		return detected;
 	}
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]