From 1cb93af4f71edcadd2877102ee98af5ee00bc46f Mon Sep 17 00:00:00 2001 From: Daniel <0xc0decafe@users.noreply.github.com> Date: Sun, 15 Oct 2023 13:52:05 +0200 Subject: [PATCH] Adjust syscall no. for 32bit platforms --- smbus2/smbus2.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/smbus2/smbus2.py b/smbus2/smbus2.py index 2f71a83..7d0cbcb 100644 --- a/smbus2/smbus2.py +++ b/smbus2/smbus2.py @@ -22,7 +22,7 @@ import os import sys -from platform import system +from platform import system, architecture from fcntl import ioctl from ctypes import c_uint32, c_uint8, c_uint16, c_char, POINTER, Structure, Array, Union, create_string_buffer, string_at @@ -51,7 +51,8 @@ I2C_SMBUS_BLOCK_MAX = 32 #FreeBSD RDWR syscall -I2CRDWR = 0x80106906 +(bits, _) = architecture() +I2CRDWR = { '64bit': 0x80106906, '32bit': 0x80086906 }[bits] # To determine what functionality is present (uapi/linux/i2c.h) try: