diff --git a/dserial-cli/src/dbus-serial-client.vala b/dserial-cli/src/dbus-serial-client.vala index cf9c2685bff005d0f7eb8e3acbd68f7a13be3bdc..b7001c6fc6406268d5945737adeba12442ba583b 100644 --- a/dserial-cli/src/dbus-serial-client.vala +++ b/dserial-cli/src/dbus-serial-client.vala @@ -54,6 +54,7 @@ private interface Methods : GLib.Object { * Return object name for file name *=====================================*/ public static string? object_name(string file_name) { + autodetect(); try { Controller c = Bus.get_proxy_sync(BusType.SESSION,"info.skorepa.DSerial1","/controller"); var path = c.get_path(file_name); @@ -68,6 +69,7 @@ public static string? object_name(string file_name) { * List all available ports *=====================================*/ public static string[] get_ports() { + autodetect(); try { Properties c = Bus.get_proxy_sync(BusType.SESSION,"info.skorepa.DSerial1","/controller"); return c.get("info.skorepa.DSerial1.controller", "PortList").get_strv(); @@ -156,13 +158,14 @@ public class SerialClient { * Constructor *=====================================*/ public SerialClient(string port_object) { + autodetect(); stdout.flush(); properties = new PropertiesAccessor(GLib.BusType.SESSION, "info.skorepa.DSerial1.port", port_object); try { stdout.flush(); methods = GLib.Bus.get_proxy_sync (GLib.BusType.SESSION, "info.skorepa.DSerial1", port_object); } catch (IOError e) {} - + methods.data_recieved.connect((t, msg) => { this.data_recieved(msg); }); @@ -180,7 +183,7 @@ public class SerialClient { public void reload_properties() { properties.reload(); } - + /*===================================== * Flow Control *=====================================*/ @@ -204,7 +207,7 @@ public class SerialClient { else if(value == FlowControl.software) properties.set_val("FlowControl", 3); } } - + /*===================================== * Port name *=====================================*/ @@ -231,7 +234,7 @@ public class SerialClient { get {return (int32)properties.get_val("Baudrate");} set {properties.set_val("Baudrate",value);} } - + /*===================================== * Data bits *=====================================*/ @@ -292,7 +295,7 @@ public class SerialClient { if(value == Parity.mark) properties.set_val("Parity",5); } } - + /*===================================== * Type *=====================================*/ @@ -303,7 +306,7 @@ public class SerialClient { return ((EnumClass)typeof (Parity).class_ref()).get_value(this).value_nick; } } - + public PortType porttype { get { uint8 v = properties.get_val("Type").get_byte();