mirror of
https://github.com/tio/tio.git
synced 2026-05-01 23:07:58 +02:00
Fix listing of serial devices in MSYS2/Cygwin
We generally try to list serial devices by ID but in the MSYS2/Cygwin environment serial devices are not available by ID and so we simply list the basic serial device paths instead.
This commit is contained in:
parent
3c8d7fa786
commit
68fc159654
1 changed files with 9 additions and 5 deletions
14
src/tty.c
14
src/tty.c
|
|
@ -54,8 +54,13 @@
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
#define PATH_SERIAL_DEVICES "/dev/"
|
#define PATH_SERIAL_DEVICES "/dev/"
|
||||||
|
#define PREFIX_TTY_DEVICES "tty."
|
||||||
|
#elifdef __CYGWIN__
|
||||||
|
#define PATH_SERIAL_DEVICES "/dev/serial/by-id/"
|
||||||
|
#define PREFIX_TTY_DEVICES "ttyS"
|
||||||
#else
|
#else
|
||||||
#define PATH_SERIAL_DEVICES "/dev/serial/by-id/"
|
#define PATH_SERIAL_DEVICES "/dev/serial/by-id/"
|
||||||
|
#define PREFIX_TTY_DEVICES ""
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef CMSPAR
|
#ifndef CMSPAR
|
||||||
|
|
@ -1343,11 +1348,10 @@ void list_serial_devices(void)
|
||||||
{
|
{
|
||||||
if ((strcmp(dir->d_name, ".")) && (strcmp(dir->d_name, "..")))
|
if ((strcmp(dir->d_name, ".")) && (strcmp(dir->d_name, "..")))
|
||||||
{
|
{
|
||||||
#ifdef __APPLE__
|
if (!strncmp(dir->d_name, PREFIX_TTY_DEVICES, sizeof(PREFIX_TTY_DEVICES) - 1))
|
||||||
#define TTY_DEVICES_PREFIX "tty."
|
{
|
||||||
if (!strncmp(dir->d_name, TTY_DEVICES_PREFIX, sizeof(TTY_DEVICES_PREFIX) - 1))
|
printf("%s%s\n", PATH_SERIAL_DEVICES, dir->d_name);
|
||||||
#endif
|
}
|
||||||
printf("%s%s\n", PATH_SERIAL_DEVICES, dir->d_name);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
closedir(d);
|
closedir(d);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue