Add udev rule to configure /dev/i2c-*.
authorWalter Fetter Lages <w.fetter@ieee.org>
Thu, 31 May 2018 20:14:59 +0000 (17:14 -0300)
committerWalter Fetter Lages <w.fetter@ieee.org>
Thu, 31 May 2018 20:14:59 +0000 (17:14 -0300)
.gitignore
README [new file with mode: 0644]
udev/rules.d/99-i2c-dev.rules [new file with mode: 0644]

index c02f83a..982c590 100644 (file)
@@ -6,6 +6,7 @@
 # C++
 # Prerequisites
 *.d
+!udev/rules.d
 
 # Compiled Object files
 *.slo
diff --git a/README b/README
new file mode 100644 (file)
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 <login>
+
+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 (file)
index 0000000..b854019
--- /dev/null
@@ -0,0 +1,2 @@
+KERNEL=="i2c-[0-9]*", GROUP="i2c", MODE="0660"
+