Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,17 @@

## Not yet released

[Full Changelog](https://github.com/rust-embedded/rust-spidev/compare/0.6.0...HEAD)
[Full Changelog](https://github.com/rust-embedded/rust-spidev/compare/0.6.1...HEAD)

## 0.6.1 / 2025-10-23

[Full Changelog](https://github.com/rust-embedded/rust-spidev/compare/0.6.0...0.6.1)

- Backport `read_write_in_place` from [#49](https://github.com/rust-embedded/rust-spidev/pull/49)
for fixing
[linux-embedded-hal/#120](https://github.com/rust-embedded/linux-embedded-hal/issues/120)
with a patch release


## 0.6.0 / 2023-08-03

Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]

name = "spidev"
version = "0.6.0"
version = "0.6.2-alpha.0"
Copy link
Member

Choose a reason for hiding this comment

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

This looks wrong for the 0.6.1 release. Or am I somehow misunderstanding the release process?

Suggested change
version = "0.6.2-alpha.0"
version = "0.6.1"

Copy link
Member Author

@sirhcel sirhcel Oct 23, 2025

Choose a reason for hiding this comment

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

Version 0.6.1 is set with 3e9b3b2. This is the revision I planned for tagging release 0.6.1 and releasing to crates.io from.

For the time after 0.6.1 ee8a1e5 attempts to cleanly state that the code in question is no longer 0.6.1 and there is less room for confusion.

Copy link
Member

Choose a reason for hiding this comment

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

Ah ok, that wasn't obvious when viewing the changes.

So this MR should be merged in "rebase and merge" mode, because "squash and merge" would destroy the intermediate commit, and the default mode "merge pull request" would create a slightly confusing commit history, right?

authors = [
"Paul Osborne <osbpau@gmail.com>",
"The Embedded Linux Team <embedded-linux@teams.rust-embedded.org>"
Expand Down
13 changes: 13 additions & 0 deletions src/spidevioctl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,19 @@ impl<'a, 'b> spi_ioc_transfer<'a, 'b> {
}
}

/// Create a read/write transfer using the same buffer for reading
/// and writing (in-place transfer).
pub fn read_write_in_place(buf: &'a mut [u8]) -> Self {
// This is allowed according to a comment in the linux source tree:
// https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/Documentation/spi/spidev.rst?id=211ddde0823f1442e4ad052a2f30f050145ccada#n191
spi_ioc_transfer {
rx_buf: buf.as_ptr() as *const () as usize as u64,
tx_buf: buf.as_ptr() as *const () as usize as u64,
len: buf.len() as u32,
..Default::default()
}
}

/// Create a delay transfer of a number of microseconds
pub fn delay(microseconds: u16) -> Self {
spi_ioc_transfer {
Expand Down