does not, please submit a bug.
Enumeration is currently only implemented on Windows, Mac OS X and Linux. On
-other systems enumeration will return no results, but ports can still be opened
-by name and then used.
+other systems enumeration is not supported, but ports can still be opened by
+name and then used.
If you know how to enumerate available ports on another OS, please submit a bug
with this information, or better still a patch implementing it.
enum sp_return sp_list_ports(struct sp_port ***list_ptr)
{
struct sp_port **list;
- int ret = SP_OK;
+ int ret = SP_ERR_SUPP;
TRACE("%p", list_ptr);
char *name;
int name_len;
+ ret = SP_OK;
+
DEBUG("Opening registry key");
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("HARDWARE\\DEVICEMAP\\SERIALCOMM"),
0, KEY_QUERY_VALUE, &key) != ERROR_SUCCESS) {
CFTypeRef cf_path;
Boolean result;
+ ret = SP_OK;
+
DEBUG("Getting IOKit master port");
if (IOMasterPort(MACH_PORT_NULL, &master) != KERN_SUCCESS) {
SET_FAIL(ret, "IOMasterPort() failed");
int fd, ioctl_result;
struct serial_struct serial_info;
+ ret = SP_OK;
+
DEBUG("Enumerating tty devices");
ud = udev_new();
ud_enumerate = udev_enumerate_new(ud);
udev_unref(ud);
#endif
- if (ret == SP_OK) {
+ switch (ret) {
+ case SP_OK:
*list_ptr = list;
RETURN_OK();
- } else {
+ case SP_ERR_SUPP:
+ DEBUG_ERROR(SP_ERR_SUPP, "Enumeration not supported on this platform.");
+ default:
if (list)
sp_free_port_list(list);
*list_ptr = NULL;