mirror of
https://git.code.sf.net/p/fldigi/flrig
synced 2026-08-13 17:28:24 -04:00
BigSur serial ports
* Modify port discovery for Big Sur naming convention
This commit is contained in:
parent
290c27e622
commit
ea2e4e8f11
1 changed files with 10 additions and 10 deletions
|
|
@ -292,25 +292,25 @@ out:
|
||||||
|
|
||||||
void init_port_combos()
|
void init_port_combos()
|
||||||
{
|
{
|
||||||
clear_combos();
|
std::string pname;
|
||||||
|
|
||||||
struct stat st;
|
|
||||||
|
|
||||||
const char* tty_fmt[] = {
|
const char* tty_fmt[] = {
|
||||||
"/dev/cu.*",
|
"/dev/cu.*",
|
||||||
"/dev/tty.*"
|
"/dev/tty.*"
|
||||||
};
|
};
|
||||||
|
struct stat st;
|
||||||
glob_t gbuf;
|
glob_t gbuf;
|
||||||
|
bool is_serial;
|
||||||
|
|
||||||
|
clear_combos();
|
||||||
for (size_t i = 0; i < sizeof(tty_fmt)/sizeof(*tty_fmt); i++) {
|
for (size_t i = 0; i < sizeof(tty_fmt)/sizeof(*tty_fmt); i++) {
|
||||||
glob(tty_fmt[i], 0, NULL, &gbuf);
|
glob(tty_fmt[i], 0, NULL, &gbuf);
|
||||||
for (size_t j = 0; j < gbuf.gl_pathc; j++) {
|
for (size_t j = 0; j < gbuf.gl_pathc; j++) {
|
||||||
if ( !(stat(gbuf.gl_pathv[j], &st) == 0 && S_ISCHR(st.st_mode)) ||
|
pname = gbuf.gl_pathv[j];
|
||||||
strstr(gbuf.gl_pathv[j], "modem") )
|
is_serial = (stat(gbuf.gl_pathv[j], &st) == 0 && S_ISCHR(st.st_mode));
|
||||||
continue;
|
if ( is_serial || pname.find("modem") != std::string::npos ) {
|
||||||
LOG_WARN("Found serial port %s", gbuf.gl_pathv[j]);
|
LOG_WARN ("Found serial port %s", gbuf.gl_pathv[j]);
|
||||||
add_combos(gbuf.gl_pathv[j]);
|
add_combos (gbuf.gl_pathv[j]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
globfree(&gbuf);
|
globfree(&gbuf);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue