]> git.tdb.fi Git - ext/subsurface.git/commitdiff
Add reasonable default device names for divecomputer import
authorDirk Hohndel <dirk@hohndel.org>
Wed, 14 Dec 2011 04:34:56 +0000 (20:34 -0800)
committerDirk Hohndel <dirk@hohndel.org>
Wed, 14 Dec 2011 04:34:56 +0000 (20:34 -0800)
So far we hard coded /dev/ttyUSB0 - which is a good starting point in
Linux but not so useful on Windows or MacOS. This was now moved into one
of our OS helper functions with (somewhat) reasonable defaults.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
display-gtk.h
gtk-gui.c
linux.c
macos.c
windows.c

index 8ca5a450e35002bcc2fa708c11402a7c7c165a3b..b20495731e50036b2b4b774d953675e8950af9e1 100644 (file)
@@ -32,6 +32,8 @@ extern void subsurface_set_conf(char *name, pref_type_t type, const void *value)
 extern const void *subsurface_get_conf(char *name, pref_type_t type);
 extern void subsurface_close_conf(void);
 
+extern const char *subsurface_USB_name(void);
+
 extern visible_cols_t visible_cols;
 
 extern const char *divelist_font;
index eae080808c457612c290dac870c6a78cca53ad5d..c6b79b69076d374887b1ee44565d2af8897a06b0 100644 (file)
--- a/gtk-gui.c
+++ b/gtk-gui.c
@@ -913,7 +913,7 @@ static GtkEntry *dive_computer_device(GtkWidget *vbox)
 
        entry = gtk_entry_new();
        gtk_container_add(GTK_CONTAINER(frame), entry);
-       gtk_entry_set_text(GTK_ENTRY(entry), "/dev/ttyUSB0");
+       gtk_entry_set_text(GTK_ENTRY(entry), subsurface_USB_name());
 
        return GTK_ENTRY(entry);
 }
diff --git a/linux.c b/linux.c
index 2edcf85a1ebebfab5b4f32a21e87f04561b29e84..e26b3acbde1458a3ca338d6b6da73908775a60e0 100644 (file)
--- a/linux.c
+++ b/linux.c
@@ -46,3 +46,8 @@ void subsurface_close_conf(void)
 {
        /* this is a no-op */
 }
+
+const char *subsurface_USB_name()
+{
+       return("/dev/ttyUSB0");
+}
diff --git a/macos.c b/macos.c
index b48f20d8707562951ecbd7268f34d99b47ee2993..0b64e19a0ee3c9354d56507c2b233a90bd2f0690 100644 (file)
--- a/macos.c
+++ b/macos.c
@@ -89,3 +89,8 @@ void subsurface_close_conf(void)
        CFRelease(xmlData);
        CFRelease(propertyList);
 }
+
+const char *subsurface_USB_name()
+{
+       return("/dev/tty.SLAB_USBtoUART");
+}
index e4c811984a942c70b254d17322381c3c13bd606f..3e40c38ef72ccc56d1f03fe6aded3d948fb37a38 100644 (file)
--- a/windows.c
+++ b/windows.c
@@ -78,3 +78,8 @@ void subsurface_close_conf(void)
                printf("RegFlushKey failed \n");
        RegCloseKey(hkey);
 }
+
+const char *subsurface_USB_name()
+{
+       return("COM3");
+}