Skip to content

Bladerf1 support with pure rust driver#23

Merged
bastibl merged 2 commits into
FutureSDR:mainfrom
ratzrattillo:bladerf1
Apr 7, 2026
Merged

Bladerf1 support with pure rust driver#23
bastibl merged 2 commits into
FutureSDR:mainfrom
ratzrattillo:bladerf1

Conversation

@ratzrattillo

Copy link
Copy Markdown
Contributor

If desired, we could add support for the BladeRF1 with libbladerf-rs, additionally to the support from Soapy.

@bastibl

bastibl commented Feb 19, 2026

Copy link
Copy Markdown
Member

I don't have a BladeRF to test, but I'd be fine adding it.

Could you squash your commits and rebase them on the main branch please?

@ratzrattillo

Copy link
Copy Markdown
Contributor Author

@bastibl , would you like to merge this feature?

Comment thread Cargo.toml Outdated

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
once_cell = "1.20"
libbladerf-rs = { git = "https://github.com/ratzrattillo/libbladerf-rs", rev="dfdd5ad", optional = true }

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think with this as dependency, we can no longer publish the create. IIRC, it requires a version, no?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe you could craft a release for the version that should be used here, so we don't have to reference the git repo.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, i will find out how to publish a crate. Never did that before.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I published the driver on crates.io: https://crates.io/crates/libbladerf-rs/

@bastibl

bastibl commented Mar 13, 2026

Copy link
Copy Markdown
Member

Sorry for the delay. Can you say something about the state of this implementation? Does TX/RX work, is it actively developed? Just that I know, I think we should mention the state of the impls somewhere in the readme.

@ratzrattillo

Copy link
Copy Markdown
Contributor Author

Sorry for the delay. Can you say something about the state of this implementation? Does TX/RX work, is it actively developed? Just that I know, I think we should mention the state of the impls somewhere in the readme.

The goal of libbladerf-rs is not to replace the original libbladerf completely, as i do not have a BladeRF2 and thus cannot do an implementation for that board. Also i only own a BladeRF XB200 expansion baord, but not the XB-100 and not the XB-300, thus the implementation for those might be flawed.

The current implementation supports TX/RX as well as most of the methods that seify exposes.

It is actively maintained by me, with focus on bugfixing. Originally this implementation was meant to run on an android device, but unfortuantely it seems like the nusb library on which this project is based on stripped Android support.

@kevinmehall

Copy link
Copy Markdown

Originally this implementation was meant to run on an android device, but unfortuantely it seems like the nusb library on which this project is based on stripped Android support.

If nusb v0.2 broke a use case you have, please open a discussion on the nusb repo. Are you working with rooted Android devices? I'm assuming what you're referring to is that v0.2 no longer compiles the device discovery (sysfs and udev) parts of the Linux backend for Android targets, but those rely on Linux APIs that are not supported in the app sandbox on Android so v0.1 list_devices only worked with root and watch_devices didn't work at all. However, if you obtain a USB file descriptor via Android APIs or something like termux-usb, you can still pass it to Device::from_fd.

The plan to fully support Android is by calling Android APIs via JNI in kevinmehall/nusb#150, which I haven't had a chance to review or test yet. If you can review and/or test that and comment on that PR it could help move it along because part of the problem is that I'm not very familiar with Android.

@ratzrattillo

Copy link
Copy Markdown
Contributor Author

Originally this implementation was meant to run on an android device, but unfortuantely it seems like the nusb library on which this project is based on stripped Android support.

If nusb v0.2 broke a use case you have, please open a discussion on the nusb repo. Are you working with rooted Android devices? I'm assuming what you're referring to is that v0.2 no longer compiles the device discovery (sysfs and udev) parts of the Linux backend for Android targets, but those rely on Linux APIs that are not supported in the app sandbox on Android so v0.1 list_devices only worked with root and watch_devices didn't work at all. However, if you obtain a USB file descriptor via Android APIs or something like termux-usb, you can still pass it to Device::from_fd.

The plan to fully support Android is by calling Android APIs via JNI in kevinmehall/nusb#150, which I haven't had a chance to review or test yet. If you can review and/or test that and comment on that PR it could help move it along because part of the problem is that I'm not very familiar with Android.

Thanks for the information on Device::from_fd. I will check this soon. I am also not very familiar with Android unfortunately. Next thing I will do in that regard is to write a small example app which controls my BladeRF.

@bastibl

bastibl commented Apr 7, 2026

Copy link
Copy Markdown
Member

Thanks!

@bastibl bastibl merged commit e0ed8bb into FutureSDR:main Apr 7, 2026
1 check passed
@ratzrattillo ratzrattillo deleted the bladerf1 branch May 3, 2026 22:14
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