Add reasonable default device names for divecomputer import

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>
This commit is contained in:
Dirk Hohndel 2011-12-13 20:34:56 -08:00
parent 001f6d05dc
commit 4b77a5def6
5 changed files with 18 additions and 1 deletions

View 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;

View file

@ -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);
}

View file

@ -46,3 +46,8 @@ void subsurface_close_conf(void)
{
/* this is a no-op */
}
const char *subsurface_USB_name()
{
return("/dev/ttyUSB0");
}

View file

@ -89,3 +89,8 @@ void subsurface_close_conf(void)
CFRelease(xmlData);
CFRelease(propertyList);
}
const char *subsurface_USB_name()
{
return("/dev/tty.SLAB_USBtoUART");
}

View file

@ -78,3 +78,8 @@ void subsurface_close_conf(void)
printf("RegFlushKey failed \n");
RegCloseKey(hkey);
}
const char *subsurface_USB_name()
{
return("COM3");
}