I have a few brand new Digirig lite that have just arrived in the mail not long ago.
I have one connected to my laptop running Ubuntu 22.04, I can control the CM108 GPIO3 pin with no issues via interacting with the corresponding /dev/hidraw
device with Python.
The story is different for my Le Potato running Raspbian 12. I’ve spent a lot of time troubleshooting and wanted to ask for advice here. My Le Potato is a Libre Computer board AML-S905X-CC, you can read about that here.
This is the super basic python I’ve wrote that tests activating PTT and playing a tone. Works good on my laptop /w the digirig and Baofeng uv5r.
import numpy as np
import sounddevice as sd
# Hard-coded HID device path as a global constant
HID_DEVICE_PATH = "/dev/hidraw1"
def set_gpio_pin(hidraw_device, pin_number, state):
if pin_number < 1 or pin_number > 8:
raise ValueError("GPIO pin number must be in 1..8")
if state not in [0, 1]:
raise ValueError("GPIO state must be 0 or 1")
iomask = 1 << (pin_number - 1)
iodata = state << (pin_number - 1)
io = bytes([0, 0, iomask, iodata, 0])
with open(hidraw_device, 'wb', buffering=0) as f:
written = f.write(io)
if written != len(io):
raise IOError(f"Failed to write all bytes to {hidraw_device}")
def main():
samplerate = 48000
duration = 5.0
frequency = 1000.0
print(f"Using HID device: {HID_DEVICE_PATH}")
t = np.linspace(0, duration, int(samplerate * duration), endpoint=False)
mono_tone = (0.2 * np.sin(2 * np.pi * frequency * t)).astype(np.float32)
silence = np.zeros_like(mono_tone)
stereo_tone = np.column_stack((mono_tone, silence))
print("Enabling PTT...")
set_gpio_pin(HID_DEVICE_PATH, 3, 1)
print(f"Playing {frequency} Hz tone for {duration} seconds...")
sd.play(stereo_tone, samplerate)
sd.wait()
print("Disabling PTT...")
set_gpio_pin(HID_DEVICE_PATH, 3, 0)
print("Done.")
if __name__ == "__main__":
main()
On the Le Potato, the ID of the hidraw device changes, currently it’s /dev/hidraw2
and I’m running this script as root on that computer. When the script runs, sometimes, it’ll activate PTT correctly (I’ll see the indicator light turn on), but it can’t turn it off. Then thereafter, it can’t turn it on at all. After a reboot, this resets things. Sometimes when the script tries to activate PTT, the indicator light will just momentarily blink, and it won’t allow control thereafter.
Both digirigs have baofeng uv5r hooked to them. I’ve tried swapping the digirig on the le potato with a different one and I get the same behavior. I realize this is very likely a hardware difference with the Le Potato, or perhaps a kernel problem. Not looking for the magic answer here, but more so looking for direction.