kopia lustrzana https://github.com/Hamlib/Hamlib
Porównaj commity
23 Commity
7ee8c358cd
...
dc38d19449
Autor | SHA1 | Data |
---|---|---|
Mike Black W9MDB | dc38d19449 | |
Mike Black W9MDB | c74b3c10c6 | |
Mike Black W9MDB | a96a97ae3c | |
Mike Black W9MDB | 7831dfc311 | |
Mike Black W9MDB | bb9b1f1783 | |
Mike Black W9MDB | 12404aa8a6 | |
Michael Black | cef2525d0f | |
George Baltz N3GB | 728db84c0c | |
George Baltz N3GB | 07f8023d17 | |
George Baltz N3GB | 55db73894f | |
Mike Black W9MDB | 0fdc78c604 | |
Mike Black W9MDB | 0f74a23b14 | |
Mike Black W9MDB | 7f02c35562 | |
Michael Black | a8f7da8fc4 | |
Mike Black W9MDB | c15f5b0da0 | |
Mike Black W9MDB | c6371a14a1 | |
Mike Black W9MDB | 65d2023b95 | |
Mike Black W9MDB | c68ef118e9 | |
Mike Black W9MDB | 25ee5d65d5 | |
Mike Black W9MDB | eaae02ef00 | |
Mike Black W9MDB | 45db5d32c3 | |
Mike Black W9MDB | 7bda13f0e0 | |
Mike Black W9MDB | b65997a249 |
|
@ -16,7 +16,7 @@ jobs:
|
|||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
# We must fetch at least the immediate parents so that if this is
|
||||
# a pull request then we can checkout the head.
|
||||
|
@ -29,7 +29,7 @@ jobs:
|
|||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v3
|
||||
uses: github/codeql-action/init@v4
|
||||
# Override language selection by uncommenting this and choosing your languages
|
||||
# with:
|
||||
# languages: go, javascript, csharp, python, cpp, java
|
||||
|
@ -37,7 +37,7 @@ jobs:
|
|||
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
||||
# If this step fails, then you should remove it and run the build manually (see below)
|
||||
#- name: Autobuild
|
||||
# uses: github/codeql-action/autobuild@v3
|
||||
# uses: github/codeql-action/autobuild@v4
|
||||
|
||||
# ℹ️ Command-line programs to run using the OS shell.
|
||||
# 📚 https://git.io/JvXDl
|
||||
|
@ -52,4 +52,4 @@ jobs:
|
|||
make
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v3
|
||||
uses: github/codeql-action/analyze@v4
|
||||
|
|
|
@ -12,7 +12,7 @@ jobs:
|
|||
runs-on: fedora:32
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
- name: bootstrap
|
||||
run: |
|
||||
sudo apt install libusb-1.0-0-dev
|
||||
|
|
|
@ -39,11 +39,11 @@ jobs:
|
|||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v2
|
||||
uses: github/codeql-action/init@v3
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
# If you wish to specify custom queries, you can do so here or in a config file.
|
||||
|
@ -54,7 +54,7 @@ jobs:
|
|||
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
||||
# If this step fails, then you should remove it and run the build manually (see below)
|
||||
#- name: Autobuild
|
||||
# uses: github/codeql-action/autobuild@v2
|
||||
# uses: github/codeql-action/autobuild@v3
|
||||
|
||||
# ℹ️ Command-line programs to run using the OS shell.
|
||||
# 📚 https://git.io/JvXDl
|
||||
|
@ -70,4 +70,4 @@ jobs:
|
|||
make
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v2
|
||||
uses: github/codeql-action/analyze@v3
|
||||
|
|
|
@ -0,0 +1,128 @@
|
|||
# Contributor Covenant Code of Conduct
|
||||
|
||||
## Our Pledge
|
||||
|
||||
We as members, contributors, and leaders pledge to make participation in our
|
||||
community a harassment-free experience for everyone, regardless of age, body
|
||||
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
||||
identity and expression, level of experience, education, socio-economic status,
|
||||
nationality, personal appearance, race, religion, or sexual identity
|
||||
and orientation.
|
||||
|
||||
We pledge to act and interact in ways that contribute to an open, welcoming,
|
||||
diverse, inclusive, and healthy community.
|
||||
|
||||
## Our Standards
|
||||
|
||||
Examples of behavior that contributes to a positive environment for our
|
||||
community include:
|
||||
|
||||
* Demonstrating empathy and kindness toward other people
|
||||
* Being respectful of differing opinions, viewpoints, and experiences
|
||||
* Giving and gracefully accepting constructive feedback
|
||||
* Accepting responsibility and apologizing to those affected by our mistakes,
|
||||
and learning from the experience
|
||||
* Focusing on what is best not just for us as individuals, but for the
|
||||
overall community
|
||||
|
||||
Examples of unacceptable behavior include:
|
||||
|
||||
* The use of sexualized language or imagery, and sexual attention or
|
||||
advances of any kind
|
||||
* Trolling, insulting or derogatory comments, and personal or political attacks
|
||||
* Public or private harassment
|
||||
* Publishing others' private information, such as a physical or email
|
||||
address, without their explicit permission
|
||||
* Other conduct which could reasonably be considered inappropriate in a
|
||||
professional setting
|
||||
|
||||
## Enforcement Responsibilities
|
||||
|
||||
Community leaders are responsible for clarifying and enforcing our standards of
|
||||
acceptable behavior and will take appropriate and fair corrective action in
|
||||
response to any behavior that they deem inappropriate, threatening, offensive,
|
||||
or harmful.
|
||||
|
||||
Community leaders have the right and responsibility to remove, edit, or reject
|
||||
comments, commits, code, wiki edits, issues, and other contributions that are
|
||||
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
||||
decisions when appropriate.
|
||||
|
||||
## Scope
|
||||
|
||||
This Code of Conduct applies within all community spaces, and also applies when
|
||||
an individual is officially representing the community in public spaces.
|
||||
Examples of representing our community include using an official e-mail address,
|
||||
posting via an official social media account, or acting as an appointed
|
||||
representative at an online or offline event.
|
||||
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||
reported to the community leaders responsible for enforcement at
|
||||
.
|
||||
All complaints will be reviewed and investigated promptly and fairly.
|
||||
|
||||
All community leaders are obligated to respect the privacy and security of the
|
||||
reporter of any incident.
|
||||
|
||||
## Enforcement Guidelines
|
||||
|
||||
Community leaders will follow these Community Impact Guidelines in determining
|
||||
the consequences for any action they deem in violation of this Code of Conduct:
|
||||
|
||||
### 1. Correction
|
||||
|
||||
**Community Impact**: Use of inappropriate language or other behavior deemed
|
||||
unprofessional or unwelcome in the community.
|
||||
|
||||
**Consequence**: A private, written warning from community leaders, providing
|
||||
clarity around the nature of the violation and an explanation of why the
|
||||
behavior was inappropriate. A public apology may be requested.
|
||||
|
||||
### 2. Warning
|
||||
|
||||
**Community Impact**: A violation through a single incident or series
|
||||
of actions.
|
||||
|
||||
**Consequence**: A warning with consequences for continued behavior. No
|
||||
interaction with the people involved, including unsolicited interaction with
|
||||
those enforcing the Code of Conduct, for a specified period of time. This
|
||||
includes avoiding interactions in community spaces as well as external channels
|
||||
like social media. Violating these terms may lead to a temporary or
|
||||
permanent ban.
|
||||
|
||||
### 3. Temporary Ban
|
||||
|
||||
**Community Impact**: A serious violation of community standards, including
|
||||
sustained inappropriate behavior.
|
||||
|
||||
**Consequence**: A temporary ban from any sort of interaction or public
|
||||
communication with the community for a specified period of time. No public or
|
||||
private interaction with the people involved, including unsolicited interaction
|
||||
with those enforcing the Code of Conduct, is allowed during this period.
|
||||
Violating these terms may lead to a permanent ban.
|
||||
|
||||
### 4. Permanent Ban
|
||||
|
||||
**Community Impact**: Demonstrating a pattern of violation of community
|
||||
standards, including sustained inappropriate behavior, harassment of an
|
||||
individual, or aggression toward or disparagement of classes of individuals.
|
||||
|
||||
**Consequence**: A permanent ban from any sort of public interaction within
|
||||
the community.
|
||||
|
||||
## Attribution
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
||||
version 2.0, available at
|
||||
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
|
||||
|
||||
Community Impact Guidelines were inspired by [Mozilla's code of conduct
|
||||
enforcement ladder](https://github.com/mozilla/diversity).
|
||||
|
||||
[homepage]: https://www.contributor-covenant.org
|
||||
|
||||
For answers to common questions about this code of conduct, see the FAQ at
|
||||
https://www.contributor-covenant.org/faq. Translations are available at
|
||||
https://www.contributor-covenant.org/translations.
|
|
@ -0,0 +1,93 @@
|
|||
# Welcome to Hamlib docs contributing guide <!-- omit in toc -->
|
||||
|
||||
Thank you for investing your time in contributing to our project! Any contribution you make will be reflected on [docs.github.com](https://docs.github.com/en) :sparkles:.
|
||||
|
||||
Read our [Code of Conduct](./CODE_OF_CONDUCT.md) to keep our community approachable and respectable.
|
||||
|
||||
In this guide you will get an overview of the contribution workflow from opening an issue, creating a PR, reviewing, and merging the PR.
|
||||
|
||||
Use the table of contents icon <img src="/contributing/images/table-of-contents.png" width="25" height="25" /> on the top left corner of this document to get to a specific section of this guide quickly.
|
||||
|
||||
## New contributor guide
|
||||
|
||||
To get an overview of the project, read the [README](../README.md) file. Here are some resources to help you get started with open source contributions:
|
||||
|
||||
- [Finding ways to contribute to open source on GitHub](https://docs.github.com/en/get-started/exploring-projects-on-github/finding-ways-to-contribute-to-open-source-on-github)
|
||||
- [Set up Git](https://docs.github.com/en/get-started/getting-started-with-git/set-up-git)
|
||||
- [GitHub flow](https://docs.github.com/en/get-started/using-github/github-flow)
|
||||
- [Collaborating with pull requests](https://docs.github.com/en/github/collaborating-with-pull-requests)
|
||||
|
||||
|
||||
## Getting started
|
||||
|
||||
To navigate our codebase with confidence, see [the introduction to working in the docs repository](/contributing/README.md) :confetti_ball:. For more information on how we write our markdown files, see "[Using Markdown and Liquid in GitHub Docs](https://docs.github.com/en/contributing/writing-for-github-docs/using-markdown-and-liquid-in-github-docs)."
|
||||
|
||||
Check to see what [types of contributions](/contributing/types-of-contributions.md) we accept before making changes. Some of them don't even require writing a single line of code :sparkles:.
|
||||
|
||||
### Issues
|
||||
|
||||
#### Create a new issue
|
||||
|
||||
If you spot a problem with the docs, [search if an issue already exists](https://docs.github.com/en/github/searching-for-information-on-github/searching-on-github/searching-issues-and-pull-requests#search-by-the-title-body-or-comments). If a related issue doesn't exist, you can open a new issue using a relevant [issue form](https://github.com/github/docs/issues/new/choose).
|
||||
|
||||
#### Solve an issue
|
||||
|
||||
Scan through our [existing issues](https://github.com/github/docs/issues) to find one that interests you. You can narrow down the search using `labels` as filters. See "[Label reference](https://docs.github.com/en/contributing/collaborating-on-github-docs/label-reference)" for more information. As a general rule, we don’t assign issues to anyone. If you find an issue to work on, you are welcome to open a PR with a fix.
|
||||
|
||||
### Make Changes
|
||||
|
||||
#### Make changes in the UI
|
||||
|
||||
Click **Make a contribution** at the bottom of any docs page to make small changes such as a typo, sentence fix, or a broken link. This takes you to the `.md` file where you can make your changes and [create a pull request](#pull-request) for a review.
|
||||
|
||||
<img src="/contributing/images/contribution_cta.png" />
|
||||
|
||||
#### Make changes in a codespace
|
||||
|
||||
For more information about using a codespace for working on GitHub documentation, see "[Working in a codespace](https://github.com/github/docs/blob/main/contributing/codespace.md)."
|
||||
|
||||
#### Make changes locally
|
||||
|
||||
1. Fork the repository.
|
||||
- Using GitHub Desktop:
|
||||
- [Getting started with GitHub Desktop](https://docs.github.com/en/desktop/installing-and-configuring-github-desktop/getting-started-with-github-desktop) will guide you through setting up Desktop.
|
||||
- Once Desktop is set up, you can use it to [fork the repo](https://docs.github.com/en/desktop/contributing-and-collaborating-using-github-desktop/cloning-and-forking-repositories-from-github-desktop)!
|
||||
|
||||
- Using the command line:
|
||||
- [Fork the repo](https://docs.github.com/en/github/getting-started-with-github/fork-a-repo#fork-an-example-repository) so that you can make your changes without affecting the original project until you're ready to merge them.
|
||||
|
||||
2. Install or update to **Node.js**, at the version specified in `.node-version`. For more information, see [the development guide](../contributing/development.md).
|
||||
|
||||
3. Create a working branch and start with your changes!
|
||||
|
||||
### Commit your update
|
||||
|
||||
Commit the changes once you are happy with them. Don't forget to use the "[Self review checklist](https://docs.github.com/en/contributing/collaborating-on-github-docs/self-review-checklist)" to speed up the review process :zap:.
|
||||
|
||||
### Pull Request
|
||||
|
||||
When you're finished with the changes, create a pull request, also known as a PR.
|
||||
- Fill the "Ready for review" template so that we can review your PR. This template helps reviewers understand your changes as well as the purpose of your pull request.
|
||||
- Don't forget to [link PR to issue](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue) if you are solving one.
|
||||
- Enable the checkbox to [allow maintainer edits](https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/allowing-changes-to-a-pull-request-branch-created-from-a-fork) so the branch can be updated for a merge.
|
||||
Once you submit your PR, a Docs team member will review your proposal. We may ask questions or request additional information.
|
||||
- We may ask for changes to be made before a PR can be merged, either using [suggested changes](https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/incorporating-feedback-in-your-pull-request) or pull request comments. You can apply suggested changes directly through the UI. You can make any other changes in your fork, then commit them to your branch.
|
||||
- As you update your PR and apply changes, mark each conversation as [resolved](https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/commenting-on-a-pull-request#resolving-conversations).
|
||||
- If you run into any merge issues, checkout this [git tutorial](https://github.com/skills/resolve-merge-conflicts) to help you resolve merge conflicts and other issues.
|
||||
|
||||
### Your PR is merged!
|
||||
|
||||
Congratulations :tada::tada: The Hamlib team thanks you :sparkles:.
|
||||
|
||||
Once your PR is merged, your contributions will be publicly visible on [Hamlib](https://github.com/Hamlib/Hamlib).
|
||||
|
||||
## Windows
|
||||
|
||||
This site can be developed on Windows, however a few potential gotchas need to be kept in mind:
|
||||
|
||||
1. Regular Expressions: Windows uses `\r\n` for line endings, while Unix-based systems use `\n`. Therefore, when working on Regular Expressions, use `\r?\n` instead of `\n` in order to support both environments. The Node.js [`os.EOL`](https://nodejs.org/api/os.html#os_os_eol) property can be used to get an OS-specific end-of-line marker.
|
||||
2. Paths: Windows systems use `\` for the path separator, which would be returned by `path.join` and others. You could use `path.posix`, `path.posix.join` etc and the [slash](https://ghub.io/slash) module, if you need forward slashes - like for constructing URLs - or ensure your code works with either.
|
||||
3. Bash: Not every Windows developer has a terminal that fully supports Bash, so it's generally preferred to write [scripts](/script) in JavaScript instead of Bash.
|
||||
4. Filename too long error: There is a 260 character limit for a filename when Git is compiled with `msys`. While the suggestions below are not guaranteed to work and could cause other issues, a few workarounds include:
|
||||
- Update Git configuration: `git config --system core.longpaths true`
|
||||
- Consider using a different Git client on Windows
|
|
@ -132,7 +132,7 @@ int gr_init(RIG *rig)
|
|||
rig->state.priv = (void*)priv;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE,"%s called\n", __FUNCTION__ );
|
||||
rig->state.rigport.type.rig = RIG_PORT_NONE;
|
||||
RIGORT(rig)->type.rig = RIG_PORT_NONE;
|
||||
|
||||
memset(priv->parms, 0, RIG_SETTING_MAX*sizeof(value_t));
|
||||
|
||||
|
|
|
@ -2490,6 +2490,7 @@ typedef hamlib_port_t port_t;
|
|||
#define AMPPORT(a) (&a->state.ampport)
|
||||
#define ROTPORT(r) (&r->state.rotport)
|
||||
#define ROTPORT2(r) (&r->state.rotport2)
|
||||
#define STATE(r) (&r->state)
|
||||
/* Then when the rigport address is stored as a pointer somewhere else(say,
|
||||
* in the rig structure itself), the definition could be changed to
|
||||
* #define RIGPORT(r) r->somewhereelse
|
||||
|
@ -2504,6 +2505,7 @@ typedef hamlib_port_t port_t;
|
|||
#define HAMLIB_AMPPORT(a) ((hamlib_port_t *)amp_data_pointer(a, RIG_PTRX_AMPPORT))
|
||||
#define HAMLIB_ROTPORT(r) ((hamlib_port_t *)rot_data_pointer(r, RIG_PTRX_ROTPORT))
|
||||
#define HAMLIB_ROTPORT2(r) ((hamlib_port_t *)rot_data_pointer(r, RIG_PTRX_ROTPORT2))
|
||||
#define HAMLIB_STATE(r) ((struct rig_state *)rig_data_pointer(r, RIG_PTRX_STATE))
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
|
@ -2515,6 +2517,7 @@ typedef enum {
|
|||
RIG_PTRX_AMPPORT,
|
||||
RIG_PTRX_ROTPORT,
|
||||
RIG_PTRX_ROTPORT2,
|
||||
RIG_PTRX_STATE,
|
||||
// New entries go directly above this line====================
|
||||
RIG_PTRX_MAXIMUM
|
||||
} rig_ptrx_t;
|
||||
|
@ -2660,7 +2663,7 @@ typedef unsigned int rig_comm_status_t;
|
|||
* that may be updated (ie. customized)
|
||||
*
|
||||
* It is NOT fine to move fields around as it can break share library offset
|
||||
* As of 2021-03-03 vfo_list is the last known item being reference externally
|
||||
* As of 2024-03-03 freq_event_elapsed is the last known item being reference externally
|
||||
* So any additions or changes to this structure must be at the end of the structure
|
||||
*/
|
||||
struct rig_state {
|
||||
|
@ -2846,6 +2849,7 @@ struct rig_state {
|
|||
char device_id[HAMLIB_RIGNAMSIZ];
|
||||
int dual_watch; /*!< Boolean DUAL_WATCH status */
|
||||
int post_ptt_delay; /*!< delay after PTT to allow for relays and such */
|
||||
struct timespec freq_event_elapsed;
|
||||
// New rig_state items go before this line ============================================
|
||||
};
|
||||
|
||||
|
|
|
@ -143,7 +143,7 @@ struct rig_caps flrig_caps =
|
|||
RIG_MODEL(RIG_MODEL_FLRIG),
|
||||
.model_name = "",
|
||||
.mfg_name = "FLRig",
|
||||
.version = "20240222.0",
|
||||
.version = "20240302.0",
|
||||
.copyright = "LGPL",
|
||||
.status = RIG_STATUS_STABLE,
|
||||
.rig_type = RIG_TYPE_TRANSCEIVER,
|
||||
|
@ -234,7 +234,9 @@ static struct s_modeMap modeMap[] =
|
|||
{RIG_MODE_PKTUSB, NULL},
|
||||
{RIG_MODE_PKTLSB, NULL},
|
||||
{RIG_MODE_AM, NULL},
|
||||
{RIG_MODE_PKTAM, NULL},
|
||||
{RIG_MODE_FM, NULL},
|
||||
{RIG_MODE_PKTFM, NULL},
|
||||
{RIG_MODE_FMN, NULL},
|
||||
{RIG_MODE_WFM, NULL},
|
||||
{RIG_MODE_CW, NULL},
|
||||
|
@ -1806,8 +1808,17 @@ static int flrig_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
|
|||
|
||||
/* we might get two values and then we want the 2nd one */
|
||||
if (strchr(value, '|') != NULL) { p = strchr(value, '|') + 1; }
|
||||
|
||||
*width = atoi(p);
|
||||
if (strcmp(p, "FIXED"))
|
||||
{
|
||||
switch(*mode)
|
||||
{
|
||||
case RIG_MODE_PKTAM:
|
||||
case RIG_MODE_AM:
|
||||
case RIG_MODE_PKTFM:
|
||||
case RIG_MODE_FM: *width = 10000;break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (vfo == RIG_VFO_A)
|
||||
|
|
|
@ -631,10 +631,11 @@ static int netrigctl_open(RIG *rig)
|
|||
do
|
||||
{
|
||||
char setting[32], value[1024];
|
||||
hamlib_port_t *pttp = PTTPORT(rig);
|
||||
hamlib_port_t *pttp = PTTPORT(rig);
|
||||
ret = read_string(rp, (unsigned char *) buf, BUF_MAX, "\n", 1, 0, 1);
|
||||
strtok(buf, "\r\n"); // chop the EOL
|
||||
|
||||
rig_debug(RIG_DEBUG_ERR, "## %s\n", buf);
|
||||
if (ret <= 0)
|
||||
{
|
||||
RETURNFUNC((ret < 0) ? ret : -RIG_EPROTO);
|
||||
|
@ -646,7 +647,7 @@ static int netrigctl_open(RIG *rig)
|
|||
{
|
||||
if (strcmp(setting, "vfo_ops") == 0)
|
||||
{
|
||||
rig->caps->vfo_ops = strtoll(value, NULL, 0);
|
||||
rig->caps->vfo_ops = rig->state.vfo_ops = strtoll(value, NULL, 0);
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: %s set to %d\n", __func__, setting,
|
||||
rig->caps->vfo_ops);
|
||||
}
|
||||
|
@ -664,7 +665,7 @@ static int netrigctl_open(RIG *rig)
|
|||
* locally overridden it
|
||||
*/
|
||||
pttp->type.ptt = RIG_PTT_RIG_MICDATA;
|
||||
rig->caps->ptt_type = RIG_PTT_RIG_MICDATA;
|
||||
rig->caps->ptt_type = rig->state.ptt_type = RIG_PTT_RIG_MICDATA;
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: %s set to %d\n", __func__, setting,
|
||||
pttp->type.ptt);
|
||||
}
|
||||
|
@ -672,13 +673,13 @@ static int netrigctl_open(RIG *rig)
|
|||
{
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: ptt_type= %d\n", __func__, temp);
|
||||
pttp->type.ptt = temp;
|
||||
rig->caps->ptt_type = temp;
|
||||
rig->caps->ptt_type = rig->state.ptt_type = temp;
|
||||
}
|
||||
}
|
||||
|
||||
else if (strcmp(setting, "targetable_vfo") == 0)
|
||||
{
|
||||
rig->caps->targetable_vfo = strtol(value, NULL, 0);
|
||||
rig->caps->targetable_vfo = rig->state.targetable_vfo = strtol(value, NULL, 0);
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: targetable_vfo=0x%2x\n", __func__,
|
||||
rig->caps->targetable_vfo);
|
||||
}
|
||||
|
@ -862,7 +863,7 @@ static int netrigctl_open(RIG *rig)
|
|||
int level;
|
||||
sscanf(p, "%d", &level);
|
||||
|
||||
if (RIG_LEVEL_IS_FLOAT(level))
|
||||
if (RIG_PARM_IS_FLOAT(level))
|
||||
{
|
||||
double min, max, step;
|
||||
sscanf(p, "%*d=%lf,%lf,%lf", &min, &max, &step);
|
||||
|
@ -870,7 +871,11 @@ static int netrigctl_open(RIG *rig)
|
|||
rig->caps->parm_gran[i].max.f = rs->parm_gran[i].max.f = max;
|
||||
rig->caps->parm_gran[i].step.f = rs->parm_gran[i].step.f = step;
|
||||
}
|
||||
else
|
||||
else if (RIG_PARM_IS_STRING(level))
|
||||
{
|
||||
rig->caps->parm_gran[i].step.s = strdup(value);
|
||||
}
|
||||
else // must be INT
|
||||
{
|
||||
int min, max, step;
|
||||
sscanf(p, "%*d=%d,%d,%d", &min, &max, &step);
|
||||
|
@ -2807,7 +2812,7 @@ struct rig_caps netrigctl_caps =
|
|||
RIG_MODEL(RIG_MODEL_NETRIGCTL),
|
||||
.model_name = "NET rigctl",
|
||||
.mfg_name = "Hamlib",
|
||||
.version = "20231229.0",
|
||||
.version = "20240226.0",
|
||||
.copyright = "LGPL",
|
||||
.status = RIG_STATUS_STABLE,
|
||||
.rig_type = RIG_TYPE_OTHER,
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include "icom.h"
|
||||
#include "icom_defs.h"
|
||||
#include "frame.h"
|
||||
#include "cache.h"
|
||||
|
||||
/*
|
||||
* Build a CI-V frame.
|
||||
|
@ -159,7 +160,7 @@ int icom_one_transaction(RIG *rig, unsigned char cmd, int subcmd,
|
|||
set_transaction_active(rig);
|
||||
|
||||
collision_retry:
|
||||
rig_flush(rp);
|
||||
//rig_flush(rp);
|
||||
|
||||
if (data_len) { *data_len = 0; }
|
||||
|
||||
|
@ -183,6 +184,7 @@ collision_retry:
|
|||
* up to rs->retry times.
|
||||
*/
|
||||
|
||||
again1:
|
||||
retval = read_icom_frame(rp, buf, sizeof(buf));
|
||||
|
||||
if (retval == -RIG_ETIMEOUT || retval == 0)
|
||||
|
@ -205,6 +207,12 @@ collision_retry:
|
|||
RETURNFUNC(-RIG_EPROTO);
|
||||
}
|
||||
|
||||
if (icom_is_async_frame(rig, frm_len, buf))
|
||||
{
|
||||
icom_process_async_frame(rig, frm_len, buf);
|
||||
goto again1;
|
||||
}
|
||||
|
||||
// we might have 0xfe string during rig wakeup
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: DEBUG retval=%d, frm_len=%d, cmd=0x%02x\n",
|
||||
__func__, retval, frm_len, cmd);
|
||||
|
@ -289,6 +297,7 @@ read_another_frame:
|
|||
* FIXME: handle padding/collisions
|
||||
* ACKFRMLEN is the smallest frame we can expect from the rig
|
||||
*/
|
||||
again2:
|
||||
buf[0] = 0;
|
||||
frm_len = read_icom_frame(rp, buf, sizeof(buf));
|
||||
|
||||
|
@ -297,6 +306,12 @@ read_another_frame:
|
|||
priv->serial_USB_echo_off = 0;
|
||||
}
|
||||
|
||||
if (icom_is_async_frame(rig, frm_len, buf))
|
||||
{
|
||||
icom_process_async_frame(rig, frm_len, buf);
|
||||
goto again2;
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
||||
// this was causing rigctld to fail on IC706 and WSJT-X
|
||||
|
|
|
@ -273,7 +273,7 @@ struct rig_caps ft1000d_caps =
|
|||
RIG_MODEL(RIG_MODEL_FT1000D),
|
||||
.model_name = "FT-1000D",
|
||||
.mfg_name = "Yaesu",
|
||||
.version = "20211111.0",
|
||||
.version = "20240228.0",
|
||||
.copyright = "LGPL",
|
||||
.status = RIG_STATUS_STABLE,
|
||||
.rig_type = RIG_TYPE_TRANSCEIVER,
|
||||
|
@ -4112,6 +4112,13 @@ static int ft1000d_get_split_mode(RIG *rig, vfo_t vfo, rmode_t *tx_mode,
|
|||
|
||||
static int ft1000_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
|
||||
{
|
||||
if (vfo == RIG_VFO_CURR)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: current_vfo=%s\n", __func__,
|
||||
rig_strvfo(rig->state.current_vfo));
|
||||
vfo = rig->state.current_vfo;
|
||||
}
|
||||
|
||||
if (vfo == RIG_VFO_A)
|
||||
{
|
||||
*freq = rig->state.cache.freqMainA;
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
* iersion 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
|
@ -313,7 +313,7 @@ struct rig_caps ft1000mp_caps =
|
|||
RIG_MODEL(RIG_MODEL_FT1000MP),
|
||||
.model_name = "FT-1000MP",
|
||||
.mfg_name = "Yaesu",
|
||||
.version = "20230104.0",
|
||||
.version = "20240229.0",
|
||||
.copyright = "LGPL",
|
||||
.status = RIG_STATUS_STABLE,
|
||||
.rig_type = RIG_TYPE_TRANSCEIVER,
|
||||
|
@ -456,7 +456,7 @@ struct rig_caps ft1000mpmkv_caps =
|
|||
RIG_MODEL(RIG_MODEL_FT1000MPMKV),
|
||||
.model_name = "MARK-V FT-1000MP",
|
||||
.mfg_name = "Yaesu",
|
||||
.version = "20230104.0",
|
||||
.version = "20240228.0",
|
||||
.copyright = "LGPL",
|
||||
.status = RIG_STATUS_STABLE,
|
||||
.rig_type = RIG_TYPE_TRANSCEIVER,
|
||||
|
@ -599,7 +599,7 @@ struct rig_caps ft1000mpmkvfld_caps =
|
|||
RIG_MODEL(RIG_MODEL_FT1000MPMKVFLD),
|
||||
.model_name = "MARK-V Field FT-1000MP",
|
||||
.mfg_name = "Yaesu",
|
||||
.version = "20230104.0",
|
||||
.version = "20240228.0",
|
||||
.copyright = "LGPL",
|
||||
.status = RIG_STATUS_STABLE,
|
||||
.rig_type = RIG_TYPE_TRANSCEIVER,
|
||||
|
@ -860,8 +860,9 @@ static int ft1000mp_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
|
|||
break;
|
||||
|
||||
case RIG_VFO_MEM:
|
||||
/* TODO, hint: store current memory number */
|
||||
RETURNFUNC(-RIG_ENIMPL);
|
||||
// we can set VFOA when VFO MEM is selected
|
||||
cmd_index = FT1000MP_NATIVE_FREQA_SET;
|
||||
break;
|
||||
|
||||
default:
|
||||
rig_debug(RIG_DEBUG_WARN, "%s: unknown VFO %0x\n", __func__, vfo);
|
||||
|
@ -919,10 +920,6 @@ static int ft1000mp_get_vfo_data(RIG *rig, vfo_t vfo)
|
|||
|
||||
static int ft1000mp_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
|
||||
{
|
||||
struct ft1000mp_priv_data *priv;
|
||||
unsigned char *p;
|
||||
freq_t f;
|
||||
int retval;
|
||||
|
||||
ENTERFUNC;
|
||||
|
||||
|
@ -933,33 +930,16 @@ static int ft1000mp_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
|
|||
vfo = rig->state.current_vfo;
|
||||
}
|
||||
|
||||
retval = ft1000mp_get_vfo_data(rig, vfo);
|
||||
|
||||
|
||||
if (retval < 0)
|
||||
if (vfo == RIG_VFO_A)
|
||||
{
|
||||
RETURNFUNC(retval);
|
||||
}
|
||||
|
||||
priv = (struct ft1000mp_priv_data *)rig->state.priv;
|
||||
|
||||
if (vfo == RIG_VFO_B)
|
||||
{
|
||||
p = &priv->update_data[FT1000MP_SUMO_VFO_B_FREQ];
|
||||
*freq = rig->state.cache.freqMainA;
|
||||
}
|
||||
else
|
||||
{
|
||||
p = &priv->update_data[FT1000MP_SUMO_VFO_A_FREQ]; /* CURR_VFO has VFOA offset */
|
||||
*freq = rig->state.cache.freqMainB;
|
||||
}
|
||||
|
||||
/* big endian integer, kinda */
|
||||
f = ((((((p[0] << 8) + p[1]) << 8) + p[2]) << 8) + p[3]) * 10 / 16;
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: freq = %"PRIfreq" Hz for VFO [%x]\n", __func__,
|
||||
f,
|
||||
vfo);
|
||||
|
||||
*freq = f; /* return displayed frequency */
|
||||
return RIG_OK;
|
||||
|
||||
RETURNFUNC(RIG_OK);
|
||||
}
|
||||
|
|
|
@ -206,7 +206,7 @@ struct rig_caps ft991_caps =
|
|||
[LVL_RFPOWER] = { .min = { .f = .05 }, .max = { .f = 1.0 }, .step = { .f = 1.0f / 100.0f } },
|
||||
},
|
||||
.parm_gran = {
|
||||
[PARM_BANDSELECT] = {.min = {.f = 0.0f}, .max = {.f = 1.0f}, .step = {.s = "BAND160M,BAND80M,BANDUNUSED,BAND40M,BAND30M,BAND20M,BAND17M,BAND15M,BAND12M,BAND10M,BAND6M,BANDGEN,BANDMW,BANDUNUSED,BANDAIR,BAND70CM,BAND33CM"}}
|
||||
[PARM_BANDSELECT] = {.step = {.s = "BAND160M,BAND80M,BANDUNUSED,BAND40M,BAND30M,BAND20M,BAND17M,BAND15M,BAND12M,BAND10M,BAND6M,BANDGEN,BANDMW,BANDUNUSED,BANDAIR,BAND70CM,BAND33CM"}}
|
||||
},
|
||||
|
||||
.ctcss_list = common_ctcss_list,
|
||||
|
|
|
@ -124,6 +124,10 @@ again:
|
|||
printf("Set Main freq\n");
|
||||
break;
|
||||
|
||||
case 0x10:
|
||||
printf("Info\n");
|
||||
break;
|
||||
|
||||
case 0x0c:
|
||||
printf("Set mode\n");
|
||||
break;
|
||||
|
|
25
src/event.c
25
src/event.c
|
@ -614,8 +614,9 @@ int rig_fire_freq_event(RIG *rig, vfo_t vfo, freq_t freq)
|
|||
{
|
||||
ENTERFUNC;
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "Event: freq changed to %"PRIll"Hz on %s\n",
|
||||
(int64_t)freq, rig_strvfo(vfo));
|
||||
double dfreq = freq;
|
||||
rig_debug(RIG_DEBUG_TRACE, "Event: freq changed to %.0f Hz on %s\n",
|
||||
dfreq, rig_strvfo(vfo));
|
||||
|
||||
rig_set_cache_freq(rig, vfo, freq);
|
||||
|
||||
|
@ -626,12 +627,22 @@ int rig_fire_freq_event(RIG *rig, vfo_t vfo, freq_t freq)
|
|||
rig->state.use_cached_freq = 1;
|
||||
}
|
||||
|
||||
|
||||
network_publish_rig_transceive_data(rig);
|
||||
|
||||
if (rig->callbacks.freq_event)
|
||||
if (rig->state.freq_event_elapsed.tv_sec == 0)
|
||||
{
|
||||
rig->callbacks.freq_event(rig, vfo, freq, rig->callbacks.freq_arg);
|
||||
elapsed_ms(&rig->state.freq_event_elapsed, HAMLIB_ELAPSED_SET);
|
||||
}
|
||||
|
||||
double e = elapsed_ms(&rig->state.freq_event_elapsed, HAMLIB_ELAPSED_GET);
|
||||
|
||||
if (e >= 250) // throttle events to 4 per sec
|
||||
{
|
||||
elapsed_ms(&rig->state.freq_event_elapsed, HAMLIB_ELAPSED_SET);
|
||||
network_publish_rig_transceive_data(rig);
|
||||
|
||||
if (rig->callbacks.freq_event)
|
||||
{
|
||||
rig->callbacks.freq_event(rig, vfo, freq, rig->callbacks.freq_arg);
|
||||
}
|
||||
}
|
||||
|
||||
RETURNFUNC(0);
|
||||
|
|
18
src/misc.c
18
src/misc.c
|
@ -1350,7 +1350,7 @@ const char *HAMLIB_API rig_strparm(setting_t parm)
|
|||
{
|
||||
int i;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||
// rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||
|
||||
if (parm == RIG_PARM_NONE)
|
||||
{
|
||||
|
@ -2005,7 +2005,9 @@ vfo_t HAMLIB_API vfo_fixup2a(RIG *rig, vfo_t vfo, split_t split,
|
|||
// We need to add some exceptions to this like the ID-5100
|
||||
vfo_t HAMLIB_API vfo_fixup(RIG *rig, vfo_t vfo, split_t split)
|
||||
{
|
||||
vfo_t currvfo = rig->state.current_vfo;
|
||||
struct rig_state *rs = STATE(rig);
|
||||
vfo_t currvfo = rs->current_vfo;
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s:(from %s:%d) vfo=%s, vfo_curr=%s, split=%d\n",
|
||||
__func__, funcname, linenum,
|
||||
rig_strvfo(vfo), rig_strvfo(currvfo), split);
|
||||
|
@ -2013,8 +2015,6 @@ vfo_t HAMLIB_API vfo_fixup(RIG *rig, vfo_t vfo, split_t split)
|
|||
if (rig->caps->rig_model == RIG_MODEL_ID5100
|
||||
|| rig->caps->rig_model == RIG_MODEL_IC9700)
|
||||
{
|
||||
struct rig_state *rs = &rig->state;
|
||||
|
||||
// dualwatch on ID5100 is TX=Main, RX=Sub
|
||||
if (rig->caps->rig_model == RIG_MODEL_ID5100 && rs->dual_watch)
|
||||
{
|
||||
|
@ -2032,7 +2032,7 @@ vfo_t HAMLIB_API vfo_fixup(RIG *rig, vfo_t vfo, split_t split)
|
|||
vfo = RIG_VFO_MAIN_A;
|
||||
|
||||
// only have Main/Sub when in satmode
|
||||
if (rig->state.cache.satmode) { vfo = RIG_VFO_MAIN; }
|
||||
if (CACHE(rig)->satmode) { vfo = RIG_VFO_MAIN; }
|
||||
}
|
||||
else if (vfo == RIG_VFO_B && (currvfo == RIG_VFO_MAIN
|
||||
|| currvfo == RIG_VFO_MAIN_A))
|
||||
|
@ -2061,7 +2061,7 @@ vfo_t HAMLIB_API vfo_fixup(RIG *rig, vfo_t vfo, split_t split)
|
|||
|
||||
if (vfo == RIG_VFO_OTHER)
|
||||
{
|
||||
switch (rig->state.current_vfo)
|
||||
switch (rs->current_vfo)
|
||||
{
|
||||
case RIG_VFO_A:
|
||||
return RIG_VFO_B;
|
||||
|
@ -2085,7 +2085,7 @@ vfo_t HAMLIB_API vfo_fixup(RIG *rig, vfo_t vfo, split_t split)
|
|||
|
||||
if (vfo == RIG_VFO_RX)
|
||||
{
|
||||
vfo = rig->state.rx_vfo;
|
||||
vfo = rs->rx_vfo;
|
||||
}
|
||||
else if (vfo == RIG_VFO_A || vfo == RIG_VFO_MAIN)
|
||||
{
|
||||
|
@ -2098,7 +2098,7 @@ vfo_t HAMLIB_API vfo_fixup(RIG *rig, vfo_t vfo, split_t split)
|
|||
int satmode = CACHE(rig)->satmode;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s(%d): split=%d, vfo==%s tx_vfo=%s\n", __func__,
|
||||
__LINE__, split, rig_strvfo(vfo), rig_strvfo(rig->state.tx_vfo));
|
||||
__LINE__, split, rig_strvfo(vfo), rig_strvfo(rs->tx_vfo));
|
||||
|
||||
if (VFO_HAS_MAIN_SUB_ONLY && !split && !satmode && vfo != RIG_VFO_B) { vfo = RIG_VFO_MAIN; }
|
||||
|
||||
|
@ -2682,8 +2682,6 @@ uint64_t HAMLIB_API rig_get_caps_int(rig_model_t rig_model,
|
|||
return caps->port_type;
|
||||
|
||||
case RIG_CAPS_HAS_GET_LEVEL:
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s(%d): return %08"PRIll"\n", __func__, __LINE__,
|
||||
caps->has_get_level);
|
||||
return caps->has_get_level;
|
||||
|
||||
default:
|
||||
|
|
179
src/rig.c
179
src/rig.c
|
@ -174,16 +174,33 @@ const char hamlib_copyright[231] = /* hamlib 1.2 ABI specifies 231 bytes */
|
|||
|
||||
#define LOCK(n) if (rig->state.depth == 1) { rig_debug(RIG_DEBUG_CACHE, "%s: %s\n", n?"lock":"unlock", __func__); rig_lock(rig,n); }
|
||||
|
||||
#ifdef PTHREAD
|
||||
#ifdef HAVE_PTHREAD
|
||||
#define MUTEX(var) static pthread_mutex_t var = PTHREAD_MUTEX_INITIALIZER
|
||||
#define MUTEX_LOCK(var) pthread_mutex_lock(var)
|
||||
#define MUTEX_UNLOCK(var) pthread_mutex_unlock(var)
|
||||
#define MUTEX_LOCK(var) pthread_mutex_lock(&var)
|
||||
#define MUTEX_UNLOCK(var) pthread_mutex_unlock(&var)
|
||||
#else
|
||||
#warning NOT PTHREAD
|
||||
#define MUTEX(var)
|
||||
#define MUTEX_LOCK(var)
|
||||
#define MUTEX_UNLOCK(var)
|
||||
#endif
|
||||
|
||||
MUTEX(morse_mutex);
|
||||
|
||||
// returns true if mutex is busy
|
||||
int MUTEX_CHECK(pthread_mutex_t *m)
|
||||
{
|
||||
int trylock = pthread_mutex_trylock(m);
|
||||
|
||||
if (trylock != EBUSY)
|
||||
{
|
||||
pthread_mutex_unlock(m);
|
||||
}
|
||||
|
||||
return trylock == EBUSY;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Data structure to track the opened rig (by rig_open)
|
||||
*/
|
||||
|
@ -358,7 +375,7 @@ char debugmsgsave[DEBUGMSGSAVE_SIZE] = "";
|
|||
char debugmsgsave2[DEBUGMSGSAVE_SIZE] = ""; // deprecated
|
||||
char debugmsgsave3[DEBUGMSGSAVE_SIZE] = ""; // deprecated
|
||||
|
||||
MUTEX(debugmsgsave);
|
||||
MUTEX(mutex_debugmsgsave);
|
||||
|
||||
void add2debugmsgsave(const char *s)
|
||||
{
|
||||
|
@ -366,7 +383,7 @@ void add2debugmsgsave(const char *s)
|
|||
char stmp[DEBUGMSGSAVE_SIZE];
|
||||
int i, nlines;
|
||||
int maxmsg = DEBUGMSGSAVE_SIZE / 2;
|
||||
MUTEX_LOCK(debugmsgsave);
|
||||
MUTEX_LOCK(mutex_debugmsgsave);
|
||||
memset(stmp, 0, sizeof(stmp));
|
||||
|
||||
// we'll keep 20 lines including this one
|
||||
|
@ -409,7 +426,7 @@ void add2debugmsgsave(const char *s)
|
|||
(int)strlen(debugmsgsave), (int)strlen(s));
|
||||
}
|
||||
|
||||
MUTEX_UNLOCK(debugmsgsave);
|
||||
MUTEX_UNLOCK(mutex_debugmsgsave);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -589,7 +606,7 @@ RIG *HAMLIB_API rig_init(rig_model_t rig_model)
|
|||
* populate the rig->state
|
||||
* TODO: read the Preferences here!
|
||||
*/
|
||||
rs = &rig->state;
|
||||
rs = STATE(rig);
|
||||
#if defined(HAVE_PTHREAD)
|
||||
pthread_mutex_init(&rs->mutex_set_transaction, NULL);
|
||||
#endif
|
||||
|
@ -606,10 +623,13 @@ RIG *HAMLIB_API rig_init(rig_model_t rig_model)
|
|||
rs->rig_model = caps->rig_model;
|
||||
rs->priv = NULL;
|
||||
rs->async_data_enabled = 0;
|
||||
rs->depth = 1;
|
||||
rs->comm_state = 0;
|
||||
rs->comm_status = RIG_COMM_STATUS_CONNECTING;
|
||||
rs->tuner_control_pathname = DEFAULT_TUNER_CONTROL_PATHNAME;
|
||||
|
||||
rp->fd = -1;
|
||||
pttp->fd = -1;
|
||||
rs->comm_state = 0;
|
||||
rig->state.depth = 1;
|
||||
#if 0 // extra debug if needed
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s(%d): %p rs->comm_state==0?=%d\n", __func__,
|
||||
__LINE__, &rs->comm_state,
|
||||
|
@ -619,9 +639,6 @@ RIG *HAMLIB_API rig_init(rig_model_t rig_model)
|
|||
#if defined(HAVE_PTHREAD)
|
||||
rp->asyncio = 0;
|
||||
#endif
|
||||
rig->state.comm_status = RIG_COMM_STATUS_CONNECTING;
|
||||
|
||||
rs->tuner_control_pathname = DEFAULT_TUNER_CONTROL_PATHNAME;
|
||||
|
||||
switch (caps->port_type)
|
||||
{
|
||||
|
@ -696,6 +713,7 @@ RIG *HAMLIB_API rig_init(rig_model_t rig_model)
|
|||
|
||||
rs->vfo_comp = 0.0; /* override it with preferences */
|
||||
rs->current_vfo = RIG_VFO_CURR; /* we don't know yet! */
|
||||
rs->vfo_ops = caps->vfo_ops;
|
||||
rs->rx_vfo = RIG_VFO_CURR; /* we don't know yet! */
|
||||
rs->tx_vfo = RIG_VFO_CURR; /* we don't know yet! */
|
||||
rs->poll_interval = 1000; // enable polling by default
|
||||
|
@ -928,7 +946,7 @@ int HAMLIB_API rig_open(RIG *rig)
|
|||
}
|
||||
|
||||
caps = rig->caps;
|
||||
rs = &rig->state;
|
||||
rs = STATE(rig);
|
||||
rp->rig = rig;
|
||||
rs->rigport_deprecated.rig = rig;
|
||||
|
||||
|
@ -1624,7 +1642,7 @@ int HAMLIB_API rig_close(RIG *rig)
|
|||
|
||||
|
||||
caps = rig->caps;
|
||||
rs = &rig->state;
|
||||
rs = STATE(rig);
|
||||
|
||||
if (!rs->comm_state)
|
||||
{
|
||||
|
@ -2322,6 +2340,7 @@ int HAMLIB_API rig_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
|
|||
rmode_t mode;
|
||||
pbwidth_t width;
|
||||
int curr_band;
|
||||
int use_cache = 0;
|
||||
static int last_band = -1;
|
||||
|
||||
if (CHECK_RIG_ARG(rig))
|
||||
|
@ -2360,12 +2379,18 @@ int HAMLIB_API rig_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
|
|||
rig_debug(RIG_DEBUG_VERBOSE, "%s(%d) vfo=%s, curr_vfo=%s\n", __FILE__, __LINE__,
|
||||
rig_strvfo(vfo), rig_strvfo(curr_vfo));
|
||||
|
||||
if (MUTEX_CHECK(&morse_mutex))
|
||||
{
|
||||
use_cache = 1;
|
||||
}
|
||||
|
||||
if (vfo == RIG_VFO_CURR) { vfo = curr_vfo; }
|
||||
|
||||
// we ignore get_freq for the uplink VFO for gpredict to behave better
|
||||
if ((rig->state.uplink == 1 && vfo == RIG_VFO_SUB)
|
||||
|| (rig->state.uplink == 2 && vfo == RIG_VFO_MAIN)
|
||||
|| (vfo == RIG_VFO_TX && cachep->ptt == 0))
|
||||
|| (vfo == RIG_VFO_TX && cachep->ptt == 0)
|
||||
|| use_cache)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: uplink=%d, ignoring get_freq\n", __func__,
|
||||
rig->state.uplink);
|
||||
|
@ -2717,7 +2742,8 @@ int HAMLIB_API rig_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
|
|||
retcode = caps->get_mode(rig, vfo, &mode_curr, &width_curr);
|
||||
|
||||
// For Icom rigs we may need to force the filter so we always set mode
|
||||
if (retcode == RIG_OK && mode == mode_curr && RIG_ICOM != RIG_BACKEND_NUM(rig->caps->rig_model))
|
||||
if (retcode == RIG_OK && mode == mode_curr
|
||||
&& RIG_ICOM != RIG_BACKEND_NUM(rig->caps->rig_model))
|
||||
{
|
||||
rig_debug(RIG_DEBUG_VERBOSE,
|
||||
"%s: mode already %s and bw change not requested\n", __func__,
|
||||
|
@ -2842,6 +2868,7 @@ int HAMLIB_API rig_get_mode(RIG *rig,
|
|||
{
|
||||
const struct rig_caps *caps;
|
||||
int retcode;
|
||||
int use_cache = 0;
|
||||
freq_t freq;
|
||||
vfo_t curr_vfo;
|
||||
struct rig_cache *cachep = CACHE(rig);
|
||||
|
@ -2871,6 +2898,7 @@ int HAMLIB_API rig_get_mode(RIG *rig,
|
|||
|
||||
curr_vfo = rig->state.current_vfo;
|
||||
vfo = vfo_fixup(rig, vfo, cachep->split);
|
||||
|
||||
if (vfo == RIG_VFO_CURR) { vfo = curr_vfo; }
|
||||
|
||||
*mode = RIG_MODE_NONE;
|
||||
|
@ -2883,8 +2911,13 @@ int HAMLIB_API rig_get_mode(RIG *rig,
|
|||
|
||||
rig_cache_show(rig, __func__, __LINE__);
|
||||
|
||||
if (MUTEX_CHECK(&morse_mutex))
|
||||
{
|
||||
use_cache = 1;
|
||||
}
|
||||
|
||||
if (cachep->timeout_ms == HAMLIB_CACHE_ALWAYS
|
||||
|| rig->state.use_cached_mode)
|
||||
|| rig->state.use_cached_mode || use_cache)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: cache hit age mode=%dms, width=%dms\n",
|
||||
__func__, cache_ms_mode, cache_ms_width);
|
||||
|
@ -3006,7 +3039,7 @@ pbwidth_t HAMLIB_API rig_passband_normal(RIG *rig, rmode_t mode)
|
|||
|
||||
ENTERFUNC;
|
||||
|
||||
rs = &rig->state;
|
||||
rs = STATE(rig);
|
||||
|
||||
// return CW for CWR and RTTY for RTTYR
|
||||
if (mode == RIG_MODE_CWR) { mode = RIG_MODE_CW; }
|
||||
|
@ -3058,7 +3091,7 @@ pbwidth_t HAMLIB_API rig_passband_narrow(RIG *rig, rmode_t mode)
|
|||
|
||||
ENTERFUNC;
|
||||
|
||||
rs = &rig->state;
|
||||
rs = STATE(rig);
|
||||
|
||||
for (i = 0; i < HAMLIB_FLTLSTSIZ - 1 && rs->filters[i].modes; i++)
|
||||
{
|
||||
|
@ -3111,7 +3144,7 @@ pbwidth_t HAMLIB_API rig_passband_wide(RIG *rig, rmode_t mode)
|
|||
|
||||
ENTERFUNC;
|
||||
|
||||
rs = &rig->state;
|
||||
rs = STATE(rig);
|
||||
|
||||
for (i = 0; i < HAMLIB_FLTLSTSIZ - 1 && rs->filters[i].modes; i++)
|
||||
{
|
||||
|
@ -3305,6 +3338,7 @@ int HAMLIB_API rig_get_vfo(RIG *rig, vfo_t *vfo)
|
|||
struct rig_cache *cachep = CACHE(rig);
|
||||
int retcode = -RIG_EINTERNAL;
|
||||
int cache_ms;
|
||||
int use_cache = 0;
|
||||
|
||||
if (CHECK_RIG_ARG(rig) || !vfo)
|
||||
{
|
||||
|
@ -3328,7 +3362,12 @@ int HAMLIB_API rig_get_vfo(RIG *rig, vfo_t *vfo)
|
|||
cache_ms = elapsed_ms(&cachep->time_vfo, HAMLIB_ELAPSED_GET);
|
||||
//rig_debug(RIG_DEBUG_TRACE, "%s: cache check age=%dms\n", __func__, cache_ms);
|
||||
|
||||
if (cache_ms < cachep->timeout_ms)
|
||||
if (MUTEX_CHECK(&morse_mutex))
|
||||
{
|
||||
use_cache = 1;
|
||||
}
|
||||
|
||||
if (cache_ms < cachep->timeout_ms || use_cache)
|
||||
{
|
||||
*vfo = cachep->vfo;
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: cache hit age=%dms, vfo=%s\n", __func__,
|
||||
|
@ -3389,7 +3428,7 @@ int HAMLIB_API rig_get_vfo(RIG *rig, vfo_t *vfo)
|
|||
int HAMLIB_API rig_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
|
||||
{
|
||||
const struct rig_caps *caps;
|
||||
struct rig_state *rs = &rig->state;
|
||||
struct rig_state *rs = STATE(rig);
|
||||
hamlib_port_t *rp = RIGPORT(rig);
|
||||
hamlib_port_t *pttp = PTTPORT(rig);
|
||||
struct rig_cache *cachep = CACHE(rig);
|
||||
|
@ -3717,7 +3756,7 @@ int HAMLIB_API rig_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
|
|||
int HAMLIB_API rig_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt)
|
||||
{
|
||||
const struct rig_caps *caps;
|
||||
struct rig_state *rs = &rig->state;
|
||||
struct rig_state *rs = STATE(rig);
|
||||
hamlib_port_t *rp = RIGPORT(rig);
|
||||
hamlib_port_t *pttp = PTTPORT(rig);
|
||||
struct rig_cache *cachep = CACHE(rig);
|
||||
|
@ -4524,12 +4563,13 @@ int HAMLIB_API rig_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq)
|
|||
rig_strvfo(vfo), rig_strvfo(rig->state.current_vfo), tx_freq);
|
||||
|
||||
caps = rig->caps;
|
||||
rs = &rig->state;
|
||||
rs = STATE(rig);
|
||||
|
||||
// Always use the previously selected TX VFO for split. The targeted VFO will have no effect.
|
||||
tx_vfo = rs->tx_vfo;
|
||||
|
||||
if (cachep->split == RIG_SPLIT_OFF || tx_vfo == RIG_VFO_NONE || tx_vfo == RIG_VFO_CURR)
|
||||
if (cachep->split == RIG_SPLIT_OFF || tx_vfo == RIG_VFO_NONE
|
||||
|| tx_vfo == RIG_VFO_CURR)
|
||||
{
|
||||
// Turn split on if not enabled already
|
||||
retcode = rig_set_split_vfo(rig, rs->current_vfo, RIG_SPLIT_ON, vfo_fixup(rig,
|
||||
|
@ -4713,12 +4753,13 @@ int HAMLIB_API rig_get_split_freq(RIG *rig, vfo_t vfo, freq_t *tx_freq)
|
|||
}
|
||||
|
||||
caps = rig->caps;
|
||||
rs = &rig->state;
|
||||
rs = STATE(rig);
|
||||
|
||||
// Always use the previously selected TX VFO for split. The targeted VFO will have no effect.
|
||||
tx_vfo = rs->tx_vfo;
|
||||
|
||||
if (cachep->split == RIG_SPLIT_OFF || tx_vfo == RIG_VFO_NONE || tx_vfo == RIG_VFO_CURR)
|
||||
if (cachep->split == RIG_SPLIT_OFF || tx_vfo == RIG_VFO_NONE
|
||||
|| tx_vfo == RIG_VFO_CURR)
|
||||
{
|
||||
// Split frequency not available if split is off
|
||||
*tx_freq = 0;
|
||||
|
@ -4889,12 +4930,13 @@ int HAMLIB_API rig_set_split_mode(RIG *rig,
|
|||
ENTERFUNC;
|
||||
|
||||
caps = rig->caps;
|
||||
rs = &rig->state;
|
||||
rs = STATE(rig);
|
||||
|
||||
// Always use the previously selected TX VFO for split. The targeted VFO will have no effect.
|
||||
tx_vfo = rs->tx_vfo;
|
||||
|
||||
if (cachep->split == RIG_SPLIT_OFF || tx_vfo == RIG_VFO_NONE || tx_vfo == RIG_VFO_CURR)
|
||||
if (cachep->split == RIG_SPLIT_OFF || tx_vfo == RIG_VFO_NONE
|
||||
|| tx_vfo == RIG_VFO_CURR)
|
||||
{
|
||||
// Turn split on if not enabled already
|
||||
retcode = rig_set_split_vfo(rig, rs->current_vfo, RIG_SPLIT_ON, vfo_fixup(rig,
|
||||
|
@ -5125,12 +5167,13 @@ int HAMLIB_API rig_get_split_mode(RIG *rig, vfo_t vfo, rmode_t *tx_mode,
|
|||
}
|
||||
|
||||
caps = rig->caps;
|
||||
rs = &rig->state;
|
||||
rs = STATE(rig);
|
||||
|
||||
// Always use the previously selected TX VFO for split. The targeted VFO will have no effect.
|
||||
tx_vfo = rs->tx_vfo;
|
||||
|
||||
if (cachep->split == RIG_SPLIT_OFF || tx_vfo == RIG_VFO_NONE || tx_vfo == RIG_VFO_CURR)
|
||||
if (cachep->split == RIG_SPLIT_OFF || tx_vfo == RIG_VFO_NONE
|
||||
|| tx_vfo == RIG_VFO_CURR)
|
||||
{
|
||||
// Split mode and filter width are not available if split is off
|
||||
*tx_mode = RIG_MODE_NONE;
|
||||
|
@ -5284,12 +5327,13 @@ int HAMLIB_API rig_set_split_freq_mode(RIG *rig,
|
|||
ENTERFUNC;
|
||||
|
||||
caps = rig->caps;
|
||||
rs = &rig->state;
|
||||
rs = STATE(rig);
|
||||
|
||||
// Always use the previously selected TX VFO for split. The targeted VFO will have no effect.
|
||||
tx_vfo = rs->tx_vfo;
|
||||
|
||||
if (cachep->split == RIG_SPLIT_OFF || tx_vfo == RIG_VFO_NONE || tx_vfo == RIG_VFO_CURR)
|
||||
if (cachep->split == RIG_SPLIT_OFF || tx_vfo == RIG_VFO_NONE
|
||||
|| tx_vfo == RIG_VFO_CURR)
|
||||
{
|
||||
// Turn split on if not enabled already
|
||||
retcode = rig_set_split_vfo(rig, rs->current_vfo, RIG_SPLIT_ON, vfo_fixup(rig,
|
||||
|
@ -5430,12 +5474,13 @@ int HAMLIB_API rig_get_split_freq_mode(RIG *rig,
|
|||
}
|
||||
|
||||
caps = rig->caps;
|
||||
rs = &rig->state;
|
||||
rs = STATE(rig);
|
||||
|
||||
// Always use the previously selected TX VFO for split. The targeted VFO will have no effect.
|
||||
tx_vfo = rs->tx_vfo;
|
||||
|
||||
if (cachep->split == RIG_SPLIT_OFF || tx_vfo == RIG_VFO_NONE || tx_vfo == RIG_VFO_CURR)
|
||||
if (cachep->split == RIG_SPLIT_OFF || tx_vfo == RIG_VFO_NONE
|
||||
|| tx_vfo == RIG_VFO_CURR)
|
||||
{
|
||||
// Split frequency, mode and filter width are not available if split is off
|
||||
*tx_freq = 0;
|
||||
|
@ -5512,7 +5557,7 @@ int HAMLIB_API rig_set_split_vfo(RIG *rig,
|
|||
rig_strvfo(rx_vfo), split, rig_strvfo(tx_vfo), cachep->split);
|
||||
|
||||
caps = rig->caps;
|
||||
rs = &rig->state;
|
||||
rs = STATE(rig);
|
||||
|
||||
if (caps->set_split_vfo == NULL)
|
||||
{
|
||||
|
@ -5634,6 +5679,7 @@ int HAMLIB_API rig_set_split_vfo(RIG *rig,
|
|||
// Only update cache on success
|
||||
rs->rx_vfo = rs->current_vfo;
|
||||
cachep->split = split;
|
||||
|
||||
if (split == RIG_SPLIT_OFF)
|
||||
{
|
||||
rs->tx_vfo = rs->current_vfo;
|
||||
|
@ -5692,6 +5738,7 @@ int HAMLIB_API rig_set_split_vfo(RIG *rig,
|
|||
{
|
||||
// Only update cache on success
|
||||
cachep->split = split;
|
||||
|
||||
if (split == RIG_SPLIT_OFF)
|
||||
{
|
||||
if (caps->targetable_vfo & RIG_TARGETABLE_FREQ)
|
||||
|
@ -5746,6 +5793,7 @@ int HAMLIB_API rig_get_split_vfo(RIG *rig,
|
|||
struct rig_cache *cachep = CACHE(rig);
|
||||
int retcode;
|
||||
int cache_ms;
|
||||
int use_cache;
|
||||
|
||||
if (CHECK_RIG_ARG(rig))
|
||||
{
|
||||
|
@ -5765,16 +5813,18 @@ int HAMLIB_API rig_get_split_vfo(RIG *rig,
|
|||
}
|
||||
|
||||
caps = rig->caps;
|
||||
rs = &rig->state;
|
||||
rs = STATE(rig);
|
||||
|
||||
if (caps->get_split_vfo == NULL)
|
||||
if (MUTEX_CHECK(&morse_mutex))
|
||||
{
|
||||
use_cache = 1;
|
||||
}
|
||||
|
||||
if (caps->get_split_vfo == NULL || use_cache)
|
||||
{
|
||||
// if we can't get the vfo we will return whatever we have cached
|
||||
*split = cachep->split;
|
||||
*tx_vfo = cachep->split_vfo;
|
||||
rig_debug(RIG_DEBUG_VERBOSE,
|
||||
"%s: no get_split_vfo so returning split=%d, tx_vfo=%s\n", __func__, *split,
|
||||
rig_strvfo(*tx_vfo));
|
||||
ELAPSED2;
|
||||
RETURNFUNC(RIG_OK);
|
||||
}
|
||||
|
@ -6606,7 +6656,7 @@ shortfreq_t HAMLIB_API rig_get_resolution(RIG *rig, rmode_t mode)
|
|||
|
||||
ENTERFUNC;
|
||||
|
||||
rs = &rig->state;
|
||||
rs = STATE(rig);
|
||||
|
||||
for (i = 0; i < HAMLIB_TSLSTSIZ && rs->tuning_steps[i].ts; i++)
|
||||
{
|
||||
|
@ -6855,7 +6905,7 @@ vfo_op_t HAMLIB_API rig_has_vfo_op(RIG *rig, vfo_op_t op)
|
|||
|
||||
ENTERFUNC;
|
||||
|
||||
retcode = rig->caps->vfo_ops & op;
|
||||
retcode = rig->state.vfo_ops & op;
|
||||
RETURNFUNC(retcode);
|
||||
}
|
||||
|
||||
|
@ -8199,7 +8249,7 @@ void rig_lock(RIG *rig, int lock)
|
|||
#if defined(HAVE_PTHREAD)
|
||||
static int async_data_handler_start(RIG *rig)
|
||||
{
|
||||
struct rig_state *rs = &rig->state;
|
||||
struct rig_state *rs = STATE(rig);
|
||||
async_data_handler_priv_data *async_data_handler_priv;
|
||||
|
||||
ENTERFUNC;
|
||||
|
@ -8243,7 +8293,7 @@ static int async_data_handler_start(RIG *rig)
|
|||
#if defined(HAVE_PTHREAD)
|
||||
static int morse_data_handler_start(RIG *rig)
|
||||
{
|
||||
struct rig_state *rs = &rig->state;
|
||||
struct rig_state *rs = STATE(rig);
|
||||
morse_data_handler_priv_data *morse_data_handler_priv;
|
||||
|
||||
ENTERFUNC;
|
||||
|
@ -8284,7 +8334,7 @@ static int morse_data_handler_start(RIG *rig)
|
|||
#if defined(HAVE_PTHREAD)
|
||||
static int async_data_handler_stop(RIG *rig)
|
||||
{
|
||||
struct rig_state *rs = &rig->state;
|
||||
struct rig_state *rs = STATE(rig);
|
||||
async_data_handler_priv_data *async_data_handler_priv;
|
||||
|
||||
ENTERFUNC;
|
||||
|
@ -8325,7 +8375,7 @@ static int async_data_handler_stop(RIG *rig)
|
|||
#if defined(HAVE_PTHREAD)
|
||||
static int morse_data_handler_stop(RIG *rig)
|
||||
{
|
||||
struct rig_state *rs = &rig->state;
|
||||
struct rig_state *rs = STATE(rig);
|
||||
morse_data_handler_priv_data *morse_data_handler_priv;
|
||||
|
||||
ENTERFUNC;
|
||||
|
@ -8340,7 +8390,7 @@ static int morse_data_handler_stop(RIG *rig)
|
|||
hl_usleep(100 * 1000);
|
||||
|
||||
//HAMLIB_TRACE;
|
||||
while (peek(rig->state.fifo_morse) >= 0)
|
||||
while (peek(rs->fifo_morse) >= 0)
|
||||
{
|
||||
HAMLIB_TRACE;
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: waiting for fifo queue to flush\n", __func__);
|
||||
|
@ -8385,7 +8435,7 @@ void *async_data_handler(void *arg)
|
|||
arg;
|
||||
RIG *rig = args->rig;
|
||||
unsigned char frame[MAX_FRAME_LENGTH];
|
||||
struct rig_state *rs = &rig->state;
|
||||
struct rig_state *rs = STATE(rig);
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: Starting async data handler thread\n",
|
||||
__func__);
|
||||
|
@ -8471,18 +8521,19 @@ void *morse_data_handler(void *arg)
|
|||
struct morse_data_handler_args_s *args =
|
||||
(struct morse_data_handler_args_s *) arg;
|
||||
RIG *rig = args->rig;
|
||||
const struct rig_state *rs = &rig->state;
|
||||
const struct rig_state *rs = STATE(rig);
|
||||
int result;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: Starting morse data handler thread\n",
|
||||
__func__);
|
||||
|
||||
if (rig->state.fifo_morse == NULL)
|
||||
if (STATE(rig)->fifo_morse == NULL)
|
||||
{
|
||||
rig->state.fifo_morse = calloc(1, sizeof(FIFO_RIG));
|
||||
// Can't use rs-> 'cuz it's const
|
||||
STATE(rig)->fifo_morse = calloc(1, sizeof(FIFO_RIG));
|
||||
}
|
||||
|
||||
initFIFO(rig->state.fifo_morse);
|
||||
initFIFO(rs->fifo_morse);
|
||||
|
||||
char *c;
|
||||
int qsize = rig->caps->morse_qsize; // if backend overrides qsize
|
||||
|
@ -8498,14 +8549,14 @@ void *morse_data_handler(void *arg)
|
|||
|
||||
for (n = 0; n < qsize; n++)
|
||||
{
|
||||
int d = peek(rig->state.fifo_morse);
|
||||
int d = peek(rs->fifo_morse);
|
||||
|
||||
if (d < 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
d = pop(rig->state.fifo_morse);
|
||||
d = pop(rs->fifo_morse);
|
||||
c[n] = (char) d;
|
||||
}
|
||||
|
||||
|
@ -8560,6 +8611,7 @@ void *morse_data_handler(void *arg)
|
|||
if (strlen(c) > 0)
|
||||
{
|
||||
int nloops = 10;
|
||||
MUTEX_LOCK(morse_mutex);
|
||||
|
||||
do
|
||||
{
|
||||
|
@ -8572,7 +8624,7 @@ void *morse_data_handler(void *arg)
|
|||
if (result == -RIG_EINVAL)
|
||||
{
|
||||
// severe error -- so flush it and stop
|
||||
resetFIFO(rig->state.fifo_morse);
|
||||
resetFIFO(rs->fifo_morse);
|
||||
nloops = 0;
|
||||
}
|
||||
|
||||
|
@ -8583,7 +8635,9 @@ void *morse_data_handler(void *arg)
|
|||
nloops--;
|
||||
|
||||
}
|
||||
while (result != RIG_OK && rig->state.fifo_morse->flush == 0 && --nloops > 0);
|
||||
while (result != RIG_OK && STATE(rig)->fifo_morse->flush == 0 && --nloops > 0);
|
||||
|
||||
MUTEX_UNLOCK(morse_mutex);
|
||||
|
||||
if (nloops == 0)
|
||||
{
|
||||
|
@ -8592,13 +8646,13 @@ void *morse_data_handler(void *arg)
|
|||
}
|
||||
}
|
||||
|
||||
rig->state.fifo_morse->flush = 0; // reset flush flag
|
||||
rs->fifo_morse->flush = 0; // reset flush flag
|
||||
hl_usleep(100 * 1000);
|
||||
}
|
||||
|
||||
free(rig->state.fifo_morse);
|
||||
free(STATE(rig)->fifo_morse);
|
||||
free(c);
|
||||
rig->state.fifo_morse = NULL;
|
||||
STATE(rig)->fifo_morse = NULL;
|
||||
pthread_exit(NULL);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -8777,7 +8831,7 @@ HAMLIB_EXPORT(int) rig_is_model(RIG *rig, rig_model_t model)
|
|||
#if defined(HAVE_PTHREAD)
|
||||
int morse_data_handler_set_keyspd(RIG *rig, int keyspd)
|
||||
{
|
||||
struct rig_state *rs = &rig->state;
|
||||
struct rig_state *rs = STATE(rig);
|
||||
morse_data_handler_priv_data *morse_data_handler_priv =
|
||||
(morse_data_handler_priv_data *) rs->morse_data_handler_priv_data;
|
||||
morse_data_handler_priv->keyspd = keyspd;
|
||||
|
@ -8817,6 +8871,9 @@ HAMLIB_EXPORT(void *) rig_data_pointer(RIG *rig, rig_ptrx_t idx)
|
|||
case RIG_PTRX_CACHE:
|
||||
return CACHE(rig);
|
||||
|
||||
case RIG_PTRX_STATE:
|
||||
return STATE(rig);
|
||||
|
||||
default:
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: Invalid data index=%d\n", __func__, idx);
|
||||
return NULL;
|
||||
|
|
|
@ -328,7 +328,7 @@ int main(int argc, char *argv[])
|
|||
|
||||
if (amp_file)
|
||||
{
|
||||
strncpy(my_amp->state.ampport.pathname, amp_file, HAMLIB_FILPATHLEN - 1);
|
||||
strncpy(AMPPORT(my_amp)->pathname, amp_file, HAMLIB_FILPATHLEN - 1);
|
||||
strncpy(my_amp->state.ampport_deprecated.pathname, amp_file,
|
||||
HAMLIB_FILPATHLEN - 1);
|
||||
}
|
||||
|
@ -336,7 +336,7 @@ int main(int argc, char *argv[])
|
|||
/* FIXME: bound checking and port type == serial */
|
||||
if (serial_rate != 0)
|
||||
{
|
||||
my_amp->state.ampport.parm.serial.rate = serial_rate;
|
||||
AMPPORT(my_amp)->parm.serial.rate = serial_rate;
|
||||
my_amp->state.ampport_deprecated.parm.serial.rate = serial_rate;
|
||||
}
|
||||
|
||||
|
|
|
@ -1990,7 +1990,7 @@ declare_proto_amp(get_powerstat)
|
|||
declare_proto_amp(send_cmd)
|
||||
{
|
||||
int retval;
|
||||
struct amp_state *rs;
|
||||
hamlib_port_t *ampp = AMPPORT(amp);
|
||||
int backend_num, cmd_len;
|
||||
#define BUFSZ 128
|
||||
unsigned char bufcmd[BUFSZ];
|
||||
|
@ -2038,11 +2038,9 @@ declare_proto_amp(send_cmd)
|
|||
eom_buf[2] = send_cmd_term;
|
||||
}
|
||||
|
||||
rs = &->state;
|
||||
rig_flush(ampp);
|
||||
|
||||
rig_flush(&rs->ampport);
|
||||
|
||||
retval = write_block(&rs->ampport, bufcmd, cmd_len);
|
||||
retval = write_block(ampp, bufcmd, cmd_len);
|
||||
|
||||
if (retval != RIG_OK)
|
||||
{
|
||||
|
@ -2060,7 +2058,7 @@ declare_proto_amp(send_cmd)
|
|||
* assumes CR or LF is end of line char
|
||||
* for all ascii protocols
|
||||
*/
|
||||
retval = read_string(&rs->ampport, buf, BUFSZ, eom_buf, strlen(eom_buf), 0, 1);
|
||||
retval = read_string(ampp, buf, BUFSZ, eom_buf, strlen(eom_buf), 0, 1);
|
||||
|
||||
if (retval < 0)
|
||||
{
|
||||
|
|
|
@ -353,13 +353,13 @@ int main(int argc, char *argv[])
|
|||
|
||||
if (amp_file)
|
||||
{
|
||||
strncpy(my_amp->state.ampport.pathname, amp_file, HAMLIB_FILPATHLEN - 1);
|
||||
strncpy(AMPPORT(my_amp)->pathname, amp_file, HAMLIB_FILPATHLEN - 1);
|
||||
}
|
||||
|
||||
/* FIXME: bound checking and port type == serial */
|
||||
if (serial_rate != 0)
|
||||
{
|
||||
my_amp->state.ampport.parm.serial.rate = serial_rate;
|
||||
AMPPORT(my_amp)->parm.serial.rate = serial_rate;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -77,9 +77,9 @@ int main(int argc, char *argv[])
|
|||
/* Set up serial port, baud rate */
|
||||
rig_file = argv[2]; // your serial device
|
||||
|
||||
strncpy(my_rig->state.rigport.pathname, rig_file, HAMLIB_FILPATHLEN - 1);
|
||||
strncpy(RIGPORT(my_rig)->pathname, rig_file, HAMLIB_FILPATHLEN - 1);
|
||||
|
||||
my_rig->state.rigport.parm.serial.rate = baud; // your baud rate
|
||||
RIGPORT(my_rig)->parm.serial.rate = baud; // your baud rate
|
||||
|
||||
/* Open my rig */
|
||||
retcode = rig_open(my_rig);
|
||||
|
|
|
@ -44,7 +44,7 @@ int main(int argc, const char *argv[])
|
|||
/* Set up serial port, baud rate */
|
||||
rig_file = "127.0.0.1:4532"; // your serial device
|
||||
|
||||
strncpy(my_rig->state.rigport.pathname, rig_file, HAMLIB_FILPATHLEN - 1);
|
||||
strncpy(RIGPORT(my_rig)->pathname, rig_file, HAMLIB_FILPATHLEN - 1);
|
||||
|
||||
/* Open my rig */
|
||||
retcode = rig_open(my_rig);
|
||||
|
|
|
@ -12,7 +12,7 @@ int callback(const struct rig_caps *caps, rig_ptr_t rigp)
|
|||
}
|
||||
|
||||
const char *port = "/dev/pts/3";
|
||||
strcpy(rig->state.rigport.pathname, port);
|
||||
strcpy(RIGPORT(rig)->pathname, port);
|
||||
|
||||
printf("%20s:", caps->model_name);
|
||||
fflush(stdout);
|
||||
|
|
|
@ -57,7 +57,7 @@ int main(int argc, const char *argv[])
|
|||
exit(1); /* whoops! something went wrong (mem alloc?) */
|
||||
}
|
||||
|
||||
strncpy(my_rig->state.rigport.pathname, SERIAL_PORT, HAMLIB_FILPATHLEN - 1);
|
||||
strncpy(RIGPORT(my_rig)->pathname, SERIAL_PORT, HAMLIB_FILPATHLEN - 1);
|
||||
|
||||
if (rig_open(my_rig))
|
||||
{
|
||||
|
|
|
@ -67,12 +67,12 @@ int main(int argc, const char *argv[])
|
|||
my_rig->caps->version,
|
||||
rig_strstatus(my_rig->caps->status));
|
||||
|
||||
printf("Serial speed: %d baud\n", my_rig->state.rigport.parm.serial.rate);
|
||||
printf("Serial speed: %d baud\n", RIGPORT(my_rig)->parm.serial.rate);
|
||||
#if 0 // if we want to bench serial or network I/O use this time
|
||||
rig_set_cache_timeout_ms(my_rig, HAMLIB_CACHE_ALL, 0);
|
||||
#endif
|
||||
|
||||
strncpy(my_rig->state.rigport.pathname, SERIAL_PORT, HAMLIB_FILPATHLEN - 1);
|
||||
strncpy(RIGPORT(my_rig)->pathname, SERIAL_PORT, HAMLIB_FILPATHLEN - 1);
|
||||
|
||||
retcode = rig_open(my_rig);
|
||||
|
||||
|
|
|
@ -592,7 +592,7 @@ int main(int argc, char *argv[])
|
|||
|
||||
if (rig_file)
|
||||
{
|
||||
strncpy(my_rig->state.rigport.pathname, rig_file, HAMLIB_FILPATHLEN - 1);
|
||||
strncpy(RIGPORT(my_rig)->pathname, rig_file, HAMLIB_FILPATHLEN - 1);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -600,7 +600,7 @@ int main(int argc, char *argv[])
|
|||
*/
|
||||
if (ptt_type != RIG_PTT_NONE)
|
||||
{
|
||||
my_rig->state.pttport.type.ptt = ptt_type;
|
||||
PTTPORT(my_rig)->type.ptt = ptt_type;
|
||||
}
|
||||
|
||||
if (dcd_type != RIG_DCD_NONE)
|
||||
|
@ -610,7 +610,7 @@ int main(int argc, char *argv[])
|
|||
|
||||
if (ptt_file)
|
||||
{
|
||||
strncpy(my_rig->state.pttport.pathname, ptt_file, HAMLIB_FILPATHLEN - 1);
|
||||
strncpy(PTTPORT(my_rig)->pathname, ptt_file, HAMLIB_FILPATHLEN - 1);
|
||||
}
|
||||
|
||||
if (dcd_file)
|
||||
|
@ -621,7 +621,7 @@ int main(int argc, char *argv[])
|
|||
/* FIXME: bound checking and port type == serial */
|
||||
if (serial_rate != 0)
|
||||
{
|
||||
my_rig->state.rigport.parm.serial.rate = serial_rate;
|
||||
RIGPORT(my_rig)->parm.serial.rate = serial_rate;
|
||||
my_rig->state.rigport_deprecated.parm.serial.rate = serial_rate;
|
||||
}
|
||||
|
||||
|
|
|
@ -2576,7 +2576,7 @@ declare_proto_rig(set_ptt)
|
|||
if (rig->caps->ptt_type != RIG_PTT_RIG_MICDATA)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: pttport.type.ptt=%d\n", __func__,
|
||||
rig->state.pttport.type.ptt);
|
||||
PTTPORT(rig)->type.ptt);
|
||||
ptt = RIG_PTT_ON;
|
||||
}
|
||||
|
||||
|
@ -3919,7 +3919,7 @@ declare_proto_rig(vfo_op)
|
|||
if (!strcmp(arg1, "?"))
|
||||
{
|
||||
char s[SPRINTF_MAX_SIZE];
|
||||
rig_sprintf_vfop(s, sizeof(s), rig->caps->vfo_ops);
|
||||
rig_sprintf_vfop(s, sizeof(s), rig->state.vfo_ops);
|
||||
fprintf(fout, "%s\n", s);
|
||||
RETURNFUNC2(RIG_OK);
|
||||
}
|
||||
|
@ -4654,7 +4654,7 @@ declare_proto_rig(dump_state)
|
|||
{
|
||||
fprintf(fout, "vfo_ops=0x%x\n", rig->caps->vfo_ops);
|
||||
fprintf(fout, "ptt_type=0x%x\n",
|
||||
rig->state.pttport.type.ptt);
|
||||
PTTPORT(rig)->type.ptt);
|
||||
fprintf(fout, "targetable_vfo=0x%x\n", rig->caps->targetable_vfo);
|
||||
fprintf(fout, "has_set_vfo=%d\n", rig->caps->set_vfo != NULL);
|
||||
fprintf(fout, "has_get_vfo=%d\n", rig->caps->get_vfo != NULL);
|
||||
|
@ -5005,7 +5005,7 @@ extern int flrig_cat_string(RIG *rig, const char *arg);
|
|||
declare_proto_rig(send_cmd)
|
||||
{
|
||||
int retval;
|
||||
struct rig_state *rs = &rig->state;
|
||||
hamlib_port_t *rp = RIGPORT(rig);
|
||||
int backend_num, cmd_len;
|
||||
#define BUFSZ 512
|
||||
char bufcmd[BUFSZ * 5]; // allow for 5 chars for binary
|
||||
|
@ -5015,7 +5015,7 @@ declare_proto_rig(send_cmd)
|
|||
int rxbytes = BUFSZ;
|
||||
int simulate = rig->caps->rig_model == RIG_MODEL_DUMMY ||
|
||||
rig->caps->rig_model == RIG_MODEL_NONE ||
|
||||
rs->rigport.rig == RIG_PORT_NONE;
|
||||
rp->rig == RIG_PORT_NONE;
|
||||
|
||||
ENTERFUNC2;
|
||||
|
||||
|
@ -5120,7 +5120,7 @@ declare_proto_rig(send_cmd)
|
|||
}
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: rigport=%d, bufcmd=%s, cmd_len=%d\n", __func__,
|
||||
rs->rigport.fd, hasbinary(bufcmd, cmd_len) ? "BINARY" : bufcmd, cmd_len);
|
||||
rp->fd, hasbinary(bufcmd, cmd_len) ? "BINARY" : bufcmd, cmd_len);
|
||||
|
||||
set_transaction_active(rig);
|
||||
|
||||
|
@ -5131,17 +5131,17 @@ declare_proto_rig(send_cmd)
|
|||
}
|
||||
else
|
||||
{
|
||||
rig_flush(&rs->rigport);
|
||||
rig_flush(rp);
|
||||
|
||||
// we don't want the 'w' command to wait too long
|
||||
int save_retry = rs->rigport.retry;
|
||||
rs->rigport.retry = 0;
|
||||
retval = write_block(&rs->rigport, (unsigned char *) bufcmd, cmd_len);
|
||||
rs->rigport.retry = save_retry;
|
||||
int save_retry = rp->retry;
|
||||
rp->retry = 0;
|
||||
retval = write_block(rp, (unsigned char *) bufcmd, cmd_len);
|
||||
rp->retry = save_retry;
|
||||
|
||||
if (retval != RIG_OK)
|
||||
{
|
||||
rig_flush_force(&rs->rigport, 1);
|
||||
rig_flush_force(rp, 1);
|
||||
set_transaction_inactive(rig);
|
||||
RETURNFUNC2(retval);
|
||||
}
|
||||
|
@ -5193,7 +5193,7 @@ declare_proto_rig(send_cmd)
|
|||
else
|
||||
{
|
||||
/* Assumes CR or LF is end of line char for all ASCII protocols. */
|
||||
retval = read_string(&rs->rigport, buf, rxbytes, eom_buf,
|
||||
retval = read_string(rp, buf, rxbytes, eom_buf,
|
||||
strlen(eom_buf), 0, 1);
|
||||
|
||||
if (retval < 0)
|
||||
|
@ -5245,7 +5245,7 @@ declare_proto_rig(send_cmd)
|
|||
strncat(hexbuf, hex, hexbufbytes - 1);
|
||||
}
|
||||
|
||||
rig_flush_force(&rs->rigport, 1);
|
||||
rig_flush_force(rp, 1);
|
||||
set_transaction_inactive(rig);
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: binary=%s, retval=%d\n", __func__, hexbuf,
|
||||
|
@ -5262,7 +5262,7 @@ declare_proto_rig(send_cmd)
|
|||
}
|
||||
while (retval > 0 && rxbytes == BUFSZ);
|
||||
|
||||
rig_flush_force(&rs->rigport, 1);
|
||||
rig_flush_force(rp, 1);
|
||||
set_transaction_inactive(rig);
|
||||
|
||||
// we use fwrite in case of any nulls in binary return
|
||||
|
@ -5786,7 +5786,7 @@ declare_proto_rig(cm108_get_bit)
|
|||
|
||||
if (n != 1) { return -RIG_EINVAL; }
|
||||
|
||||
int retval = rig_cm108_get_bit(&rig->state.pttport, gpio, &bit);
|
||||
int retval = rig_cm108_get_bit(PTTPORT(rig), gpio, &bit);
|
||||
|
||||
if (retval != RIG_OK)
|
||||
{
|
||||
|
@ -5826,7 +5826,7 @@ declare_proto_rig(cm108_set_bit)
|
|||
if (n != 1) { return -RIG_EINVAL; }
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: set gpio=%d, bit=%d\n", __func__, gpio, bit);
|
||||
int retval = rig_cm108_set_bit(&rig->state.pttport, gpio, bit);
|
||||
int retval = rig_cm108_set_bit(PTTPORT(rig), gpio, bit);
|
||||
|
||||
if (retval != RIG_OK)
|
||||
{
|
||||
|
|
|
@ -512,7 +512,7 @@ int main(int argc, char *argv[])
|
|||
|
||||
if (rig_file)
|
||||
{
|
||||
strncpy(my_rig->state.rigport.pathname, rig_file, HAMLIB_FILPATHLEN - 1);
|
||||
strncpy(RIGPORT(my_rig)->pathname, rig_file, HAMLIB_FILPATHLEN - 1);
|
||||
}
|
||||
|
||||
if (!rig_file2)
|
||||
|
@ -528,7 +528,7 @@ int main(int argc, char *argv[])
|
|||
*/
|
||||
if (ptt_type != RIG_PTT_NONE)
|
||||
{
|
||||
my_rig->state.pttport.type.ptt = ptt_type;
|
||||
PTTPORT(my_rig)->type.ptt = ptt_type;
|
||||
}
|
||||
|
||||
if (dcd_type != RIG_DCD_NONE)
|
||||
|
@ -538,7 +538,7 @@ int main(int argc, char *argv[])
|
|||
|
||||
if (ptt_file)
|
||||
{
|
||||
strncpy(my_rig->state.pttport.pathname, ptt_file, HAMLIB_FILPATHLEN - 1);
|
||||
strncpy(PTTPORT(my_rig)->pathname, ptt_file, HAMLIB_FILPATHLEN - 1);
|
||||
}
|
||||
|
||||
if (dcd_file)
|
||||
|
@ -549,7 +549,7 @@ int main(int argc, char *argv[])
|
|||
/* FIXME: bound checking and port type == serial */
|
||||
if (serial_rate != 0)
|
||||
{
|
||||
my_rig->state.rigport.parm.serial.rate = serial_rate;
|
||||
RIGPORT(my_rig)->parm.serial.rate = serial_rate;
|
||||
}
|
||||
|
||||
if (serial_rate2 != 0)
|
||||
|
|
|
@ -691,7 +691,7 @@ int main(int argc, char *argv[])
|
|||
|
||||
if (rig_file)
|
||||
{
|
||||
strncpy(my_rig->state.rigport.pathname, rig_file, HAMLIB_FILPATHLEN - 1);
|
||||
strncpy(RIGPORT(my_rig)->pathname, rig_file, HAMLIB_FILPATHLEN - 1);
|
||||
}
|
||||
|
||||
my_rig->state.twiddle_timeout = twiddle_timeout;
|
||||
|
@ -706,7 +706,7 @@ int main(int argc, char *argv[])
|
|||
*/
|
||||
if (ptt_type != RIG_PTT_NONE)
|
||||
{
|
||||
my_rig->state.pttport.type.ptt = ptt_type;
|
||||
PTTPORT(my_rig)->type.ptt = ptt_type;
|
||||
my_rig->state.pttport_deprecated.type.ptt = ptt_type;
|
||||
// This causes segfault since backend rig_caps are const
|
||||
// rigctld will use the rig->state version of this for clients
|
||||
|
@ -721,7 +721,7 @@ int main(int argc, char *argv[])
|
|||
|
||||
if (ptt_file)
|
||||
{
|
||||
strncpy(my_rig->state.pttport.pathname, ptt_file, HAMLIB_FILPATHLEN - 1);
|
||||
strncpy(PTTPORT(my_rig)->pathname, ptt_file, HAMLIB_FILPATHLEN - 1);
|
||||
strncpy(my_rig->state.pttport_deprecated.pathname, ptt_file,
|
||||
HAMLIB_FILPATHLEN - 1);
|
||||
}
|
||||
|
@ -736,7 +736,7 @@ int main(int argc, char *argv[])
|
|||
/* FIXME: bound checking and port type == serial */
|
||||
if (serial_rate != 0)
|
||||
{
|
||||
my_rig->state.rigport.parm.serial.rate = serial_rate;
|
||||
RIGPORT(my_rig)->parm.serial.rate = serial_rate;
|
||||
my_rig->state.rigport_deprecated.parm.serial.rate = serial_rate;
|
||||
}
|
||||
|
||||
|
|
|
@ -540,11 +540,11 @@ int main(int argc, char *argv[])
|
|||
|
||||
if (rig_file)
|
||||
{
|
||||
strncpy(my_rig->state.rigport.pathname, rig_file, HAMLIB_FILPATHLEN - 1);
|
||||
strncpy(RIGPORT(my_rig)->pathname, rig_file, HAMLIB_FILPATHLEN - 1);
|
||||
}
|
||||
|
||||
fprintf(stderr, "rig to send frequency to: %s\n", rig_file2);
|
||||
strncpy(my_rig_sync->state.rigport.pathname, rig_file2, HAMLIB_FILPATHLEN - 1);
|
||||
strncpy(RIGPORT(my_rig_sync)->pathname, rig_file2, HAMLIB_FILPATHLEN - 1);
|
||||
|
||||
#if 0
|
||||
|
||||
|
@ -553,7 +553,7 @@ int main(int argc, char *argv[])
|
|||
*/
|
||||
if (ptt_type != RIG_PTT_NONE)
|
||||
{
|
||||
my_rig->state.pttport.type.ptt = ptt_type;
|
||||
PTTPORT(my_rig)->type.ptt = ptt_type;
|
||||
}
|
||||
|
||||
if (dcd_type != RIG_DCD_NONE)
|
||||
|
@ -563,7 +563,7 @@ int main(int argc, char *argv[])
|
|||
|
||||
if (ptt_file)
|
||||
{
|
||||
strncpy(my_rig->state.pttport.pathname, ptt_file, HAMLIB_FILPATHLEN - 1);
|
||||
strncpy(PTTPORT(my_rig)->pathname, ptt_file, HAMLIB_FILPATHLEN - 1);
|
||||
}
|
||||
|
||||
if (dcd_file)
|
||||
|
@ -576,12 +576,12 @@ int main(int argc, char *argv[])
|
|||
/* FIXME: bound checking and port type == serial */
|
||||
if (serial_rate != 0)
|
||||
{
|
||||
my_rig->state.rigport.parm.serial.rate = serial_rate;
|
||||
RIGPORT(my_rig)->parm.serial.rate = serial_rate;
|
||||
}
|
||||
|
||||
if (serial_rate2 != 0)
|
||||
{
|
||||
my_rig_sync->state.rigport.parm.serial.rate = serial_rate2;
|
||||
RIGPORT(my_rig_sync)->parm.serial.rate = serial_rate2;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -686,7 +686,7 @@ int main(int argc, char *argv[])
|
|||
|
||||
if (rig_file)
|
||||
{
|
||||
strncpy(my_rig->state.rigport.pathname, rig_file, HAMLIB_FILPATHLEN - 1);
|
||||
strncpy(RIGPORT(my_rig)->pathname, rig_file, HAMLIB_FILPATHLEN - 1);
|
||||
}
|
||||
|
||||
my_rig->state.twiddle_timeout = twiddle_timeout;
|
||||
|
@ -701,7 +701,7 @@ int main(int argc, char *argv[])
|
|||
*/
|
||||
if (ptt_type != RIG_PTT_NONE)
|
||||
{
|
||||
my_rig->state.pttport.type.ptt = ptt_type;
|
||||
PTTPORT(my_rig)->type.ptt = ptt_type;
|
||||
my_rig->state.pttport_deprecated.type.ptt = ptt_type;
|
||||
// This causes segfault since backend rig_caps are const
|
||||
// rigctld will use the rig->state version of this for clients
|
||||
|
@ -716,7 +716,7 @@ int main(int argc, char *argv[])
|
|||
|
||||
if (ptt_file)
|
||||
{
|
||||
strncpy(my_rig->state.pttport.pathname, ptt_file, HAMLIB_FILPATHLEN - 1);
|
||||
strncpy(PTTPORT(my_rig)->pathname, ptt_file, HAMLIB_FILPATHLEN - 1);
|
||||
strncpy(my_rig->state.pttport_deprecated.pathname, ptt_file,
|
||||
HAMLIB_FILPATHLEN - 1);
|
||||
}
|
||||
|
@ -731,7 +731,7 @@ int main(int argc, char *argv[])
|
|||
/* FIXME: bound checking and port type == serial */
|
||||
if (serial_rate != 0)
|
||||
{
|
||||
my_rig->state.rigport.parm.serial.rate = serial_rate;
|
||||
RIGPORT(my_rig)->parm.serial.rate = serial_rate;
|
||||
my_rig->state.rigport_deprecated.parm.serial.rate = serial_rate;
|
||||
}
|
||||
|
||||
|
@ -1309,7 +1309,7 @@ void *handle_socket(void *arg)
|
|||
if (cmd[0] != 0)
|
||||
{
|
||||
memset(reply, 0, sizeof(reply));
|
||||
rig_flush(&my_rig->state.rigport);
|
||||
rig_flush(RIGPORT(my_rig));
|
||||
retcode = rig_send_raw(my_rig, cmd, nbytes, reply, sizeof(reply),
|
||||
term);
|
||||
|
||||
|
|
|
@ -82,7 +82,7 @@ int main(int argc, const char *argv[])
|
|||
exit(1); /* whoops! something went wrong (mem alloc?) */
|
||||
}
|
||||
|
||||
strncpy(my_rig->state.rigport.pathname, argv[2], HAMLIB_FILPATHLEN - 1);
|
||||
rig_set_conf(my_rig, rig_token_lookup(my_rig, "rig_pathname"), argv[2]);
|
||||
|
||||
retcode = rig_open(my_rig);
|
||||
|
||||
|
|
|
@ -283,13 +283,13 @@ int main(int argc, char *argv[])
|
|||
|
||||
if (rig_file)
|
||||
{
|
||||
strncpy(rig->state.rigport.pathname, rig_file, HAMLIB_FILPATHLEN - 1);
|
||||
strncpy(RIGPORT(rig)->pathname, rig_file, HAMLIB_FILPATHLEN - 1);
|
||||
}
|
||||
|
||||
/* FIXME: bound checking and port type == serial */
|
||||
if (serial_rate != 0)
|
||||
{
|
||||
rig->state.rigport.parm.serial.rate = serial_rate;
|
||||
RIGPORT(rig)->parm.serial.rate = serial_rate;
|
||||
}
|
||||
|
||||
if (civaddr)
|
||||
|
|
|
@ -265,13 +265,13 @@ int main(int argc, char *argv[])
|
|||
|
||||
if (rig_file)
|
||||
{
|
||||
strncpy(rig->state.rigport.pathname, rig_file, HAMLIB_FILPATHLEN - 1);
|
||||
strncpy(RIGPORT(rig)->pathname, rig_file, HAMLIB_FILPATHLEN - 1);
|
||||
}
|
||||
|
||||
/* FIXME: bound checking and port type == serial */
|
||||
if (serial_rate != 0)
|
||||
{
|
||||
rig->state.rigport.parm.serial.rate = serial_rate;
|
||||
RIGPORT(rig)->parm.serial.rate = serial_rate;
|
||||
}
|
||||
|
||||
if (civaddr)
|
||||
|
@ -329,13 +329,13 @@ int main(int argc, char *argv[])
|
|||
|
||||
if (rot_file)
|
||||
{
|
||||
strncpy(rot->state.rotport.pathname, rot_file, HAMLIB_FILPATHLEN - 1);
|
||||
strncpy(ROTPORT(rot)->pathname, rot_file, HAMLIB_FILPATHLEN - 1);
|
||||
}
|
||||
|
||||
/* FIXME: bound checking and port type == serial */
|
||||
if (rot_serial_rate != 0)
|
||||
{
|
||||
rot->state.rotport.parm.serial.rate = rot_serial_rate;
|
||||
ROTPORT(rot)->parm.serial.rate = rot_serial_rate;
|
||||
}
|
||||
|
||||
retcode = rot_open(rot);
|
||||
|
|
|
@ -257,23 +257,23 @@ int main(int argc, char *argv[])
|
|||
|
||||
if (ptt_type != RIG_PTT_NONE)
|
||||
{
|
||||
rig->state.pttport.type.ptt = ptt_type;
|
||||
PTTPORT(rig)->type.ptt = ptt_type;
|
||||
}
|
||||
|
||||
if (ptt_file)
|
||||
{
|
||||
strncpy(rig->state.pttport.pathname, ptt_file, HAMLIB_FILPATHLEN - 1);
|
||||
strncpy(PTTPORT(rig)->pathname, ptt_file, HAMLIB_FILPATHLEN - 1);
|
||||
}
|
||||
|
||||
if (rig_file)
|
||||
{
|
||||
strncpy(rig->state.rigport.pathname, rig_file, HAMLIB_FILPATHLEN - 1);
|
||||
strncpy(RIGPORT(rig)->pathname, rig_file, HAMLIB_FILPATHLEN - 1);
|
||||
}
|
||||
|
||||
/* FIXME: bound checking and port type == serial */
|
||||
if (serial_rate != 0)
|
||||
{
|
||||
rig->state.rigport.parm.serial.rate = serial_rate;
|
||||
RIGPORT(rig)->parm.serial.rate = serial_rate;
|
||||
}
|
||||
|
||||
if (civaddr)
|
||||
|
@ -283,7 +283,7 @@ int main(int argc, char *argv[])
|
|||
|
||||
|
||||
if (!rig_has_get_level(rig, RIG_LEVEL_SWR)
|
||||
|| rig->state.pttport.type.ptt == RIG_PTT_NONE)
|
||||
|| PTTPORT(rig)->type.ptt == RIG_PTT_NONE)
|
||||
{
|
||||
|
||||
fprintf(stderr,
|
||||
|
|
|
@ -25,11 +25,11 @@ int main(int argc, const char *argv[])
|
|||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
strncpy(rig->state.rigport.pathname, "COM37", HAMLIB_FILPATHLEN - 1);
|
||||
strncpy(RIGPORT(rig)->pathname, "COM37", HAMLIB_FILPATHLEN - 1);
|
||||
#else
|
||||
strncpy(rig->state.rigport.pathname, "/dev/ttyUSB0", HAMLIB_FILPATHLEN - 1);
|
||||
strncpy(RIGPORT(rig)->pathname, "/dev/ttyUSB0", HAMLIB_FILPATHLEN - 1);
|
||||
#endif
|
||||
rig->state.rigport.parm.serial.rate = 38400;
|
||||
RIGPORT(rig)->parm.serial.rate = 38400;
|
||||
rig_open(rig);
|
||||
// disabled until we change this to the other multicast capability
|
||||
#if 0
|
||||
|
|
|
@ -368,26 +368,26 @@ int main(int argc, char *argv[])
|
|||
token = strtok(NULL, ",");
|
||||
}
|
||||
|
||||
hamlib_port_t *rotp = ROTPORT(my_rot);
|
||||
hamlib_port_t *rotp2 = ROTPORT2(my_rot);
|
||||
if (rot_file)
|
||||
{
|
||||
strncpy(my_rot->state.rotport.pathname, rot_file, HAMLIB_FILPATHLEN - 1);
|
||||
strncpy(rotp->pathname, rot_file, HAMLIB_FILPATHLEN - 1);
|
||||
}
|
||||
|
||||
if (rot_file2)
|
||||
{
|
||||
strncpy(my_rot->state.rotport2.pathname, rot_file2, HAMLIB_FILPATHLEN - 1);
|
||||
strncpy(rotp2->pathname, rot_file2, HAMLIB_FILPATHLEN - 1);
|
||||
}
|
||||
|
||||
/* FIXME: bound checking and port type == serial */
|
||||
my_rot->state.rotport2.parm.serial.rate =
|
||||
my_rot->state.rotport.parm.serial.rate;
|
||||
my_rot->state.rotport2.parm.serial.data_bits =
|
||||
my_rot->state.rotport.parm.serial.data_bits;
|
||||
rotp2->parm.serial.rate = rotp->parm.serial.rate;
|
||||
rotp2->parm.serial.data_bits = rotp->parm.serial.data_bits;
|
||||
|
||||
if (serial_rate != 0)
|
||||
{
|
||||
my_rot->state.rotport.parm.serial.rate = serial_rate;
|
||||
my_rot->state.rotport2.parm.serial.rate = serial_rate;
|
||||
rotp->parm.serial.rate = serial_rate;
|
||||
rotp2->parm.serial.rate = serial_rate;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -2507,7 +2507,7 @@ declare_proto_rot(dump_state)
|
|||
declare_proto_rot(send_cmd)
|
||||
{
|
||||
int retval;
|
||||
struct rot_state *rs;
|
||||
hamlib_port_t *rotp = ROTPORT(rot);
|
||||
int backend_num, cmd_len;
|
||||
#define BUFSZ 128
|
||||
unsigned char bufcmd[BUFSZ];
|
||||
|
@ -2555,11 +2555,9 @@ declare_proto_rot(send_cmd)
|
|||
eom_buf[2] = send_cmd_term;
|
||||
}
|
||||
|
||||
rs = &rot->state;
|
||||
rig_flush(rotp);
|
||||
|
||||
rig_flush(&rs->rotport);
|
||||
|
||||
retval = write_block(&rs->rotport, bufcmd, cmd_len);
|
||||
retval = write_block(rotp, bufcmd, cmd_len);
|
||||
|
||||
if (retval != RIG_OK)
|
||||
{
|
||||
|
@ -2577,7 +2575,7 @@ declare_proto_rot(send_cmd)
|
|||
* assumes CR or LF is end of line char
|
||||
* for all ascii protocols
|
||||
*/
|
||||
retval = read_string(&rs->rotport, buf, BUFSZ, eom_buf, strlen(eom_buf), 0, 1);
|
||||
retval = read_string(rotp, buf, BUFSZ, eom_buf, strlen(eom_buf), 0, 1);
|
||||
|
||||
if (retval < 0)
|
||||
{
|
||||
|
|
|
@ -376,18 +376,18 @@ int main(int argc, char *argv[])
|
|||
|
||||
if (rot_file)
|
||||
{
|
||||
strncpy(my_rot->state.rotport.pathname, rot_file, HAMLIB_FILPATHLEN - 1);
|
||||
strncpy(ROTPORT(my_rot)->pathname, rot_file, HAMLIB_FILPATHLEN - 1);
|
||||
}
|
||||
|
||||
if (rot_file2)
|
||||
{
|
||||
strncpy(my_rot->state.rotport2.pathname, rot_file2, HAMLIB_FILPATHLEN - 1);
|
||||
strncpy(ROTPORT2(my_rot)->pathname, rot_file2, HAMLIB_FILPATHLEN - 1);
|
||||
}
|
||||
|
||||
/* FIXME: bound checking and port type == serial */
|
||||
if (serial_rate != 0)
|
||||
{
|
||||
my_rot->state.rotport.parm.serial.rate = serial_rate;
|
||||
ROTPORT(my_rot)->parm.serial.rate = serial_rate;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <hamlib/rig.h>
|
||||
#define PATH "/dev/pts/4"
|
||||
|
||||
int
|
||||
main()
|
||||
|
@ -15,7 +16,7 @@ main()
|
|||
int retcode;
|
||||
|
||||
my_rig = rig_init(2048);
|
||||
strcpy(my_rig->state.rigport.pathname, "/dev/pts/4");
|
||||
rig_set_conf(my_rig, rig_token_lookup(my_rig, "rig_pathname"), PATH);
|
||||
|
||||
retcode = rig_open(my_rig);
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ int main(int argc, char *argv[])
|
|||
|
||||
/* Set up serial port, baud rate */
|
||||
|
||||
strncpy(my_rig->state.rigport.pathname, rig_file, HAMLIB_FILPATHLEN - 1);
|
||||
rig_set_conf(my_rig, rig_token_lookup(my_rig, "rig_pathname"), rig_file);
|
||||
|
||||
/* Open my rig */
|
||||
retcode = rig_open(my_rig);
|
||||
|
|
|
@ -68,7 +68,7 @@ int main(int argc, const char *argv[])
|
|||
exit(1); /* whoops! something went wrong (mem alloc?) */
|
||||
}
|
||||
|
||||
//strncpy(my_rig->state.rigport.pathname, SERIAL_PORT, HAMLIB_FILPATHLEN - 1);
|
||||
//strncpy(RIGPORT(my_rig)->pathname, SERIAL_PORT, HAMLIB_FILPATHLEN - 1);
|
||||
|
||||
retcode = rig_open(my_rig);
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ int callback(struct rig_caps *caps, rig_ptr_t rigp)
|
|||
}
|
||||
|
||||
const char *port = "/dev/pts/3";
|
||||
strcpy(rig->state.rigport.pathname, port);
|
||||
rig_set_conf(rig, rig_token_lookup(rig, "rig_pathname"), port);
|
||||
|
||||
printf("%20s:", caps->model_name);
|
||||
fflush(stdout);
|
||||
|
|
|
@ -52,7 +52,7 @@ int main(int argc, const char *argv[])
|
|||
exit(1); /* whoops! something went wrong (mem alloc?) */
|
||||
}
|
||||
|
||||
strncpy(my_rig->state.rigport.pathname, SERIAL_PORT, HAMLIB_FILPATHLEN - 1);
|
||||
rig_set_conf(my_rig, rig_token_lookup(my_rig, "rig_pathname"), SERIAL_PORT);
|
||||
|
||||
if (rig_open(my_rig))
|
||||
{
|
||||
|
|
Ładowanie…
Reference in New Issue