mirror of
https://github.com/tio/tio.git
synced 2026-05-01 14:57:59 +02:00
Add new ways to manage serial devices
* Rename --list-devices to --list
* Rename --no-autoconnect to --no-reconnect
* Switch -l and -L options
* -l now lists available serial devices
* -L enables log to file
* Add option --auto-connect <strategy>
* Supported strategies:
* "new" - Waits to connect first new appearing serial device
* "latest" - Connects to latest registered serial device
* "direct" - Connect directly to specified serial device (default)
* Add options to exclude serial devices from auto connect strategy by
pattern
* Supported exclude options:
* --exclude-devices <pattern>
Example: '--exclude-devices "/dev/ttyUSB2,/dev/ttyS?"'
* --exclude-drivers <pattern>
Example: '--exclude-drivers "cdc_acm"'
* --exclude-tids <pattern>
Example: '--exclude-tids "yW07,bCC2"'
* Patterns support '*' and '?'
* Connect to same port/device combination via unique topology ID (TID)
* Topology ID is a 4 digit base62 encoded hash of a device topology
string coming from the Linux kernel. This means that whenever you
plug in the same e.g. USB serial port device to the same USB hub
port connected via the exact same hub topology all the way to your
computer, you will get the same unique TID.
* Useful for stable reconnections when serial device has no serial
device by ID
* For now, only tested on Linux.
* Reworked and improved listing of serial devices to show serial devices:
* By device
* Including TID, uptime, driver, and description.
* Sorted by uptime (newest device listed last)
* By unique topology ID
* By ID
* By path
* Add script interface 'list = tty_search()' for searching for serial
devices.
This commit is contained in:
parent
ae76f8f58d
commit
d19ba1c492
22 changed files with 1468 additions and 150 deletions
|
|
@ -54,7 +54,7 @@ struct config_t
|
|||
char *section_name;
|
||||
char *match;
|
||||
|
||||
char *tty;
|
||||
char *target;
|
||||
char *flow;
|
||||
char *parity;
|
||||
char *log_filename;
|
||||
|
|
@ -63,6 +63,9 @@ struct config_t
|
|||
char *script;
|
||||
char *script_filename;
|
||||
bool script_run;
|
||||
char *exclude_devices;
|
||||
char *exclude_drivers;
|
||||
char *exclude_tids;
|
||||
};
|
||||
|
||||
static struct config_t c;
|
||||
|
|
@ -151,8 +154,8 @@ static int data_handler(void *user, const char *section, const char *name,
|
|||
// Set configuration parameter if found
|
||||
if (!strcmp(name, "device") || !strcmp(name, "tty"))
|
||||
{
|
||||
asprintf(&c.tty, value, c.match);
|
||||
option.tty_device = c.tty;
|
||||
asprintf(&c.target, value, c.match);
|
||||
option.target = c.target;
|
||||
}
|
||||
else if (!strcmp(name, "baudrate"))
|
||||
{
|
||||
|
|
@ -188,9 +191,13 @@ static int data_handler(void *user, const char *section, const char *name,
|
|||
{
|
||||
line_pulse_duration_option_parse(value);
|
||||
}
|
||||
else if (!strcmp(name, "no-autoconnect"))
|
||||
else if (!strcmp(name, "no-reconnect"))
|
||||
{
|
||||
option.no_autoconnect = read_boolean(value, name);
|
||||
option.no_reconnect = read_boolean(value, name);
|
||||
}
|
||||
else if (!strcmp(name, "auto-connect"))
|
||||
{
|
||||
option.auto_connect = auto_connect_option_parse(value);
|
||||
}
|
||||
else if (!strcmp(name, "log"))
|
||||
{
|
||||
|
|
@ -314,6 +321,21 @@ static int data_handler(void *user, const char *section, const char *name,
|
|||
{
|
||||
option.script_run = script_run_option_parse(value);
|
||||
}
|
||||
else if (!strcmp(name, "exclude-devices"))
|
||||
{
|
||||
c.exclude_devices = strdup(value);
|
||||
option.exclude_devices = c.exclude_devices;
|
||||
}
|
||||
else if (!strcmp(name, "exclude-drivers"))
|
||||
{
|
||||
c.exclude_drivers = strdup(value);
|
||||
option.exclude_drivers = c.exclude_drivers;
|
||||
}
|
||||
else if (!strcmp(name, "exclude-tids"))
|
||||
{
|
||||
c.exclude_tids = strdup(value);
|
||||
option.exclude_tids = c.exclude_tids;
|
||||
}
|
||||
else
|
||||
{
|
||||
tio_warning_printf("Unknown option '%s' in configuration file, ignored", name);
|
||||
|
|
@ -460,8 +482,8 @@ void config_file_parse(void)
|
|||
return;
|
||||
}
|
||||
|
||||
// Set user input which may be tty device or sub config
|
||||
c.user = option.tty_device;
|
||||
// Set user input which may be tty device or sub config or tid
|
||||
c.user = option.target;
|
||||
|
||||
if (!c.user)
|
||||
{
|
||||
|
|
@ -504,7 +526,7 @@ void config_file_parse(void)
|
|||
|
||||
void config_exit(void)
|
||||
{
|
||||
free(c.tty);
|
||||
free(c.target);
|
||||
free(c.flow);
|
||||
free(c.parity);
|
||||
free(c.log_filename);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue