Fix initialization of comm_status

The function rig_init() doesn't touch the hardware, it's rig_open()
that initiates the connection and in fact the first use of comm_status
in rig_open() is when it gets the value RIG_COMM_STATUS_CONNECTING and
rig_close() sets it to RIG_COMM_STATUS_DISCONNECTED.
pull/1828/head
Daniele Forsi IU5HKX 2025-08-03 13:18:09 +02:00
rodzic 989623ec51
commit fbe9803777
2 zmienionych plików z 4 dodań i 1 usunięć

Wyświetl plik

@ -47,10 +47,12 @@ class TestClass:
assert rig is not None
assert rig.state.comm_state == 0
assert rig.state.comm_status == Hamlib.RIG_COMM_STATUS_DISCONNECTED
assert rig.set_conf("rig_pathname", rig_file) is None
assert rig.set_conf("serial_speed", str(serial_speed)) is None
assert rig.open() is None
assert rig.state.comm_state == 1
assert rig.state.comm_status == Hamlib.RIG_COMM_STATUS_OK
info = rig.get_info()
assert isinstance(info, str)
@ -116,6 +118,7 @@ class TestClass:
assert rig.close() is None
assert rig.state.comm_state == 0
assert rig.state.comm_status == Hamlib.RIG_COMM_STATUS_DISCONNECTED
info = rig.get_info()
assert info is None

Wyświetl plik

@ -669,7 +669,7 @@ RIG *HAMLIB_API rig_init(rig_model_t rig_model)
rs->async_data_enabled = 0;
// rs->depth = 1;
rs->comm_state = 0;
rs->comm_status = RIG_COMM_STATUS_CONNECTING;
rs->comm_status = RIG_COMM_STATUS_DISCONNECTED;
rs->tuner_control_pathname = DEFAULT_TUNER_CONTROL_PATHNAME;
strncpy(rs->client_version, "Hamlib", sizeof(rs->client_version));