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

SoapySDR Python only connects to channel 0. #440

Open
jberwald opened this issue Aug 26, 2024 · 6 comments
Open

SoapySDR Python only connects to channel 0. #440

jberwald opened this issue Aug 26, 2024 · 6 comments

Comments

@jberwald
Copy link

Hello,

Thanks for the great SoapySDR library.

I'm having an issue when connecting to Cariboulite SDR using SoapySDR. I'm pretty sure the issue is contained within SoapySDR's Python interface: I can see both of Cariboulite's channels (S1G and HiF) and use them both from SDR++ and CubicSDR. But when writing Python scripts, I am limited to using only the S1G channel. For instance, getAntenna only ever returns the S1G channel. Here is an example:

import SoapySDR        # main package
from SoapySDR import * # constants
import numpy           # buffers
import sys             # exit on error
import pprint          # pretty printer

mydriver    = "Cariboulite"      # Ref: "SoapySDRUtil --find"
mydirection = SOAPY_SDR_RX  # Interested in receiver info
mychannel   = 0             #  or 1 
stream_format = SOAPY_SDR_CS16

pp = pprint.PrettyPrinter()

print('\nDevices:')
devices = SoapySDR.Device.enumerate()
for result in devices: 
    pp.pprint(dict(result))

The above code returns the expected channels, so I know that SoapySDR can see them:

{'channel': 'S1G',
 'device_id': '0',
 'driver': 'Cariboulite',
 'label': 'CaribouLite S1G[28fc7a78]',
 'name': 'CaribouLite RPI Hat',
 'serial': '28fc7a78',
 'uuid': 'c8c3d8e6-f596-462b-a92b-d9678ec92d38',
 'vendor': 'CaribouLabs LTD',
 'version': '0x0001'}

{'channel': 'HiF',
 'device_id': '1',
 'driver': 'Cariboulite',
 'label': 'CaribouLite HiF[28fc7a79]',
 'name': 'CaribouLite RPI Hat',
 'serial': '28fc7a79',
 'uuid': 'c8c3d8e6-f596-462b-a92b-d9678ec92d38',
 'vendor': 'CaribouLabs LTD',
 'version': '0x0001'}

Unfortunately, when I call getAntenna to start trying to collect a signal I am only able to get the S1G channel:

print('\nAntennas:')
for channel in range(len(devices)):
    ants = sdr.listAntennas(mydirection, channel)

    for result in ants: pp.pprint(result)

# activate the antenna
print('\nANT:')
ant = sdr.getAntenna(mydirection, 1)
print(ant)

print('\nSetup Stream:')
rxStream = sdr.setupStream(SOAPY_SDR_RX, stream_format)
print('\nActivate Stream:')
sdr.activateStream(rxStream) #start streaming

gives

Antennas:
'TX/RX Sub1GHz'
'TX/RX Sub1GHz'

ANT:
TX/RX Sub1GHz

Setup Stream:

Activate Stream:

[ERROR] SoapySDR::Device::enumerate(sdrplay) sdrplay_api_Open() failed
[INFO] setupStream: dir= RX, format= CS16

I'm pretty sure the sdrplay error isn't an issue here. As mentioned above, I know that through SDR++ and CubicSDR running with SoapySDR I can access the HiF antenna.

Any hints as to how I can access the channel listed as device_id: 1?
Thanks for any help.

@zuckschwerdt
Copy link
Member

Do not download, unpack or run that rar archive, it is malware.
Multiple engines report an encryption trojan. See https://www.virustotal.com/gui/file/3962b839a75c06c014c975bd857c723e126e81f546c0c2e54182272820b5cbb5

@zuckschwerdt
Copy link
Member

If possible confirm this by submitting the contained file x86_64-w64-ranlib.exe to some malware scanners, then report the user for malware activity.

@jberwald
Copy link
Author

No worries, not touching that malware. Thanks @zuckschwerdt .

@zuckschwerdt
Copy link
Member

GitHub was fast to react and the file hosting site also took that upload down.

Regarding your python api worries I can't really help, I've never used the python bindings and I don't have multi-channel capable hardware. But looking at the source https://github.com/cariboulabs/cariboulite/blob/main/software/libcariboulite/src/soapy_api/Cariboulite.cpp#L86 I notice that the channel arg is disregarded, the cariboulite_radio_state_st radio type is used. This type is setup with the channel info from device creation https://github.com/cariboulabs/cariboulite/blob/main/software/libcariboulite/src/soapy_api/Cariboulite.cpp#L17
Maybe something to check.

@jberwald
Copy link
Author

Many thanks for the pointers. I'll start there and let you know how it goes.

@zuckschwerdt
Copy link
Member

I.e. I guess you need different sdr = SoapySDR.Device(args) with channel already set in those args.

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

No branches or pull requests

3 participants
@zuckschwerdt @jberwald and others