From f5982261f7f9bfe1a39b8d739a3e6c2693e373ac Mon Sep 17 00:00:00 2001 From: Walter Fetter Lages Date: Thu, 31 May 2018 17:14:59 -0300 Subject: [PATCH] Add udev rule to configure /dev/i2c-*. --- .gitignore | 1 + README | 18 ++++++++++++++++++ udev/rules.d/99-i2c-dev.rules | 2 ++ 3 files changed, 21 insertions(+) create mode 100644 README create mode 100644 udev/rules.d/99-i2c-dev.rules diff --git a/.gitignore b/.gitignore index c02f83a..982c590 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ # C++ # Prerequisites *.d +!udev/rules.d # Compiled Object files *.slo diff --git a/README b/README new file mode 100644 index 0000000..d6a3902 --- /dev/null +++ b/README @@ -0,0 +1,18 @@ +The user should have read and write access to /dev/i2c-0 (or the +corresponding device if there is more than on I2C bus). + +The recomended way to grand the required premissions is to incude the user +in the i2c group: + +groupadd -r i2c +groupmems -g i2c -a + +and set the /dev/i2c-0 read and write permissions to this group by +installing the file 99-i2c-dev.rules in the /etc/udev/rules.d directory and +reloading the udev rules and the i2c-dev module with the commands: + +udvadm control -R +rmmod i2c-dev +modprobe i2c-dev + + diff --git a/udev/rules.d/99-i2c-dev.rules b/udev/rules.d/99-i2c-dev.rules new file mode 100644 index 0000000..b854019 --- /dev/null +++ b/udev/rules.d/99-i2c-dev.rules @@ -0,0 +1,2 @@ +KERNEL=="i2c-[0-9]*", GROUP="i2c", MODE="0660" + -- 2.12.0