EttusResearch / uhd

The USRP™ Hardware Driver Repository
http://uhd.ettus.com
Other
946 stars 646 forks source link

Add in OpenBSD support to uhd::path_expandvars #668

Closed paultag closed 1 year ago

paultag commented 1 year ago

OpenBSD has explicitly declined1 to support 'wordexp' on their platform, which just leaves glob(3) for expanding strings according to shell-like rules. The API is similar, but -- notably -- does not support environment variable expansion (for instance, the string "/home/${USER_NAME}/" will be left unchanged, whereas wordexp(3) would expand it).

However, OpenBSD supports the well understood but non-POSIX extension to glob, 'GLOB_TILDE', which will allow for user directory expansion, such as '~user/.ssh/authorized_keys' or '~/bin/*.sh'.

This is a fairly large difference between OpenBSD and other supported platforms, but one that will at least enable libuhd to be built, but users may need to be careful with filepaths, since they'll behave slightly differently on OpenBSD than Windows, Linux or OSX.

sugartoad# uhd_find_devices
[INFO] [UHD] OpenBSD 1; Clang version 13.0.0 ; Boost_108000; UHD_4.4.0.0-68-g02558b69
[INFO] [B200] Loading firmware image: /usr/local/share/uhd/images/usrp_b200_fw.hex...
--------------------------------------------------
-- UHD Device 0
--------------------------------------------------
Device Address:
    serial: XXXXXXX
    name: MyB210
    product: B210
    type: b200

Which devices/areas does this affect?

Building libuhd on OpenBSD.

Testing Done

Building libuhd requires OpenBSD 7.3 from snapshots (current release is 7.2), because the waitid(2) syscall was only just added to OpenBSD. Which is to say, the master branch will still fail to build until the 7.3 release.

USB I/O isn't working still with my Ettus B210 and B200mini, due to constraints of libusb on OpenBSD, I believe. Some follow-on MRs may come out of that, but this would (at least) work with networked USRP devices, as well as talking via USB without streaming, yet. I also suspect it's possible to fix that without changes to libuhd. That being said, this doesn't impact just libuhd -- rtl-sdr has a note in the OpenBSD port about async usb transfer not working right. I don't think OpenBSD users would find this note particularly shocking.

Checklist

My 2c: I do not believe libuhd should claim any meaningful OpenBSD support yet. This platform has been (for the history of this project) totally DOA, so I suspect these changes won't impact any users yet.

github-actions[bot] commented 1 year ago

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

paultag commented 1 year ago

I have read the CLA Document and I hereby sign the CLA

mbr0wn commented 1 year ago

Thanks again. It will go public on our master (and the next stable release) as soon as we sync our branches.