Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for the use of CM108 for PTT on Mac #500

Open
wants to merge 6 commits into
base: dev
Choose a base branch
from

Conversation

mfncooper
Copy link

These changes implement support for PTT using CM108 on a Mac. A few notes:

  • The actual code is exactly the same as for Windows, using the hidapi API, so the changes are little more than updated #if conditions.

  • The CMake changes are slightly complicated by the Windows build using a local copy of some hidapi files, for some reason, instead of using the library itself. The Mac version uses hidapi in the same way as other libraries.

  • In the CMake files, it is unclear to me whether "elseif (NOT WIN32 AND NOT CYGWIN)" means the same thing as "elseif (APPLE)", so they are treated separately in order to avoid breaking other build types.

  • The generic config file has been simplified slightly, since the section on using CM108 for PTT is now common to all of Linux, Windows and Mac.

  • The README has been updated to include a build section for Mac.

These changes have been verified on macOS Ventura 13.6 (Apple M2 silicon) and macOS High Sierra 10.13.6 (Intel), as well as on Linux Mint 20.3 to verify that nothing was broken. I do not have a Windows system to test with.

Support for CM108-based PTT on Mac is provided using the hidapi library
in the same way as on Windows. As such, the code changes are limited
almost entirely to updated #if conditions, treating Windows and Mac in
the same way.
The CMake changes are slightly complicated by the Windows build using
a local copy of some hidapi files, for some reason, instead of using
the hidapi library itself. The Mac version uses hidapi in the same way
as other libraries.

In the CMake files, it is unclear to me whether "elseif (NOT WIN32 AND
NOT CYGWIN)" means the same thing as "elseif (APPLE)", so they are
treated separately in order to avoid breaking other build types.
The generic config file can now be simplified slightly, since the
section on using CM108 for PTT is now common to all of Linux, Windows
and Mac.
Since building on Mac using Homebrew is straightforward, include this
information in a new section of the README.
@mrnoisytiger
Copy link

Flagging that this appears to be broken in Seqouia. When running direwolf -x a to test PTT issues, I get:

Channel 0: 1200 baud, AFSK 1200 & 2200 Hz, A+, 44100 sample rate.
Using DevSrvsID:4294972279 GPIO 3 for channel 0 PTT control.

Sending alternating mark/space calibration tones (1200/2200Hz) on channel 0.
Press control-C to terminate.

Could not open DevSrvsID:4294972279 for write
ERROR:  PTT for channel 0 has failed.  See User Guide for troubleshooting tips.

Similarly, running cm108 DevSrvsID:4294972279 gets me:

0Could not open DevSrvsID:4294972279 for write

WRITE ERROR for USB Audio Adapter GPIO!

I imagine this has to do with some increased hardening for access to physical raw devices present in Seqouia that isn't in prior versions. Sadly, I don't have any other device to test this.

@mfncooper
Copy link
Author

@mrnoisytiger Thanks for the heads-up. Unfortunately I don't have access to Seqouia to look at this right now.

This is certainly not a real solution, but as a test, could you try running those commands (i.e. both the direwolf and cm108 command lines you mentioned) using sudo, to see if this is purely a permissions issue? You'll get a warning when you run direwolf as sudo, but that's normal.

@mrnoisytiger
Copy link

mrnoisytiger commented Sep 17, 2024

@mrnoisytiger Thanks for the heads-up. Unfortunately I don't have access to Seqouia to look at this right now.

This is certainly not a real solution, but as a test, could you try running those commands (i.e. both the direwolf and cm108 command lines you mentioned) using sudo, to see if this is purely a permissions issue? You'll get a warning when you run direwolf as sudo, but that's normal.

Unfortunately, it ends up in the same place with sudo sadly, as does going into super-user mode with sudo su.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants