From be1bf6d6654d3cc05e38afb7f9bf17bcbd340561 Mon Sep 17 00:00:00 2001 From: Diego Barrios Romero Date: Tue, 1 Aug 2023 18:36:53 +0200 Subject: [PATCH] Update nix and bitflags --- CHANGELOG.md | 4 ++-- Cargo.toml | 4 ++-- src/ffi.rs | 36 ++++++++++++++++++------------------ 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ac10d5a3..4a807999 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,8 +9,8 @@ Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] - Hide nix from the public api such that it can be updated without resulting in a breaking change. -- Updated nix to version `0.25`. -- Updated nix to version `0.24`; only use the `ioctl` feature. +- Updated nix to version `0.26`; only use the `ioctl` feature. +- Updated `bitflags` to version `2.3`. - Use `File.read_exact` instead of `File.read` in `LinuxI2CDevice.read` so that the buffer is filled. - Fix the lifetime parameter on `LinuxI2CMessage` to ensure that it does not outlive the buffer it points to. - Updated MSRV to 1.60.0. diff --git a/Cargo.toml b/Cargo.toml index 8e681f3c..d7f687b7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,9 +16,9 @@ Provides API for safe access to Linux i2c device interface. [dependencies] libc = "0.2" -bitflags = "1.3" +bitflags = "2.3" byteorder = "1" -nix = { version = "0.25", default-features = false, features = ["ioctl"] } +nix = { version = "0.26", default-features = false, features = ["ioctl"] } [dev-dependencies] docopt = "1" diff --git a/src/ffi.rs b/src/ffi.rs index fbe733d4..3fadd70b 100644 --- a/src/ffi.rs +++ b/src/ffi.rs @@ -55,24 +55,24 @@ bitflags! { const I2C_FUNC_SMBUS_READ_I2C_BLOCK = 0x0400_0000; /* I2C-like block xfer */ const I2C_FUNC_SMBUS_WRITE_I2C_BLOCK = 0x0800_0000; /* w/ 1-byte reg. addr. */ - const I2C_FUNC_SMBUS_BYTE = (I2CFunctions::I2C_FUNC_SMBUS_READ_BYTE.bits | - I2CFunctions::I2C_FUNC_SMBUS_WRITE_BYTE.bits); - const I2C_FUNC_SMBUS_BYTE_DATA = (I2CFunctions::I2C_FUNC_SMBUS_READ_BYTE_DATA.bits | - I2CFunctions::I2C_FUNC_SMBUS_WRITE_BYTE_DATA.bits); - const I2C_FUNC_SMBUS_WORD_DATA = (I2CFunctions::I2C_FUNC_SMBUS_READ_WORD_DATA.bits | - I2CFunctions::I2C_FUNC_SMBUS_WRITE_WORD_DATA.bits); - const I2C_FUNC_SMBUS_BLOCK_DATA = (I2CFunctions::I2C_FUNC_SMBUS_READ_BLOCK_DATA.bits | - I2CFunctions::I2C_FUNC_SMBUS_WRITE_BLOCK_DATA.bits); - const I2C_FUNC_SMBUS_I2C_BLOCK = (I2CFunctions::I2C_FUNC_SMBUS_READ_I2C_BLOCK.bits | - I2CFunctions::I2C_FUNC_SMBUS_WRITE_I2C_BLOCK.bits); - const I2C_FUNC_SMBUS_EMUL = (I2CFunctions::I2C_FUNC_SMBUS_QUICK.bits | - I2CFunctions::I2C_FUNC_SMBUS_BYTE.bits | - I2CFunctions::I2C_FUNC_SMBUS_BYTE_DATA.bits | - I2CFunctions::I2C_FUNC_SMBUS_WORD_DATA.bits | - I2CFunctions::I2C_FUNC_SMBUS_PROC_CALL.bits | - I2CFunctions::I2C_FUNC_SMBUS_WRITE_BLOCK_DATA.bits | - I2CFunctions::I2C_FUNC_SMBUS_I2C_BLOCK.bits | - I2CFunctions::I2C_FUNC_SMBUS_PEC.bits); + const I2C_FUNC_SMBUS_BYTE = (I2CFunctions::I2C_FUNC_SMBUS_READ_BYTE.bits() | + I2CFunctions::I2C_FUNC_SMBUS_WRITE_BYTE.bits()); + const I2C_FUNC_SMBUS_BYTE_DATA = (I2CFunctions::I2C_FUNC_SMBUS_READ_BYTE_DATA.bits() | + I2CFunctions::I2C_FUNC_SMBUS_WRITE_BYTE_DATA.bits()); + const I2C_FUNC_SMBUS_WORD_DATA = (I2CFunctions::I2C_FUNC_SMBUS_READ_WORD_DATA.bits() | + I2CFunctions::I2C_FUNC_SMBUS_WRITE_WORD_DATA.bits()); + const I2C_FUNC_SMBUS_BLOCK_DATA = (I2CFunctions::I2C_FUNC_SMBUS_READ_BLOCK_DATA.bits() | + I2CFunctions::I2C_FUNC_SMBUS_WRITE_BLOCK_DATA.bits()); + const I2C_FUNC_SMBUS_I2C_BLOCK = (I2CFunctions::I2C_FUNC_SMBUS_READ_I2C_BLOCK.bits() | + I2CFunctions::I2C_FUNC_SMBUS_WRITE_I2C_BLOCK.bits()); + const I2C_FUNC_SMBUS_EMUL = (I2CFunctions::I2C_FUNC_SMBUS_QUICK.bits() | + I2CFunctions::I2C_FUNC_SMBUS_BYTE.bits() | + I2CFunctions::I2C_FUNC_SMBUS_BYTE_DATA.bits() | + I2CFunctions::I2C_FUNC_SMBUS_WORD_DATA.bits() | + I2CFunctions::I2C_FUNC_SMBUS_PROC_CALL.bits() | + I2CFunctions::I2C_FUNC_SMBUS_WRITE_BLOCK_DATA.bits() | + I2CFunctions::I2C_FUNC_SMBUS_I2C_BLOCK.bits() | + I2CFunctions::I2C_FUNC_SMBUS_PEC.bits()); } }