Add udev rules to assign /dev/comedi* to the comedi group.
authorW. Trevor King <wking@drexel.edu>
Fri, 28 Jan 2011 14:05:22 +0000 (09:05 -0500)
committerW. Trevor King <wking@drexel.edu>
Fri, 28 Jan 2011 14:05:22 +0000 (09:05 -0500)
ChangeLog
Manifest
comedi-headers-9999.ebuild
files/52-comedi.rules [new file with mode: 0644]

index 5ced1c937104d5dd965f492b107327e9ec805fa2..f07a2a59e3ea0d255423c4014c51a0377dc28d78 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,11 @@
 # Distributed under the terms of the GNU General Public License v2
 # $Header: $
 
+*comedi-headers-9999 (27 Jan 2011)
+  27 Jan 2010; W. Trevor King <wking@drexel.edu> comedi-headers-9999.ebuild, 52-comedi.rules :
+  Add udev use flag.  If set, /dev/comedi* will belong to a newly
+  created comedi group.
+
 *comedi-headers-9999 (31 Dec 2010)
   31 Dec 2010; W. Trevor King <wking@drexel.edu> comedi-headers-9999.ebuild :
   Fix repoman-reported issues with 9999.
index fc67a00ffa15e4e5332e822fd4d67bb3943fdabb..3c68a77d73f052bb55de444da842fdbfc704bfe0 100644 (file)
--- a/Manifest
+++ b/Manifest
@@ -1,3 +1,4 @@
-EBUILD comedi-headers-9999.ebuild 613 RMD160 e17b08fd4f5736e8a2508f5ef6a969972f4419bd SHA1 bc0572123089cbe27e8f3ae9c6c43ced493c3888 SHA256 319eabe2a147c597417ddb6553af4a9cb8e70a4fc416d02fce9f2f1de9b5a121
-MISC ChangeLog 878 RMD160 ec7f60425992f1376d1f487cfa4994968dae1edd SHA1 1c0238d61c46c4d88c48da3768eed931d93cc2b9 SHA256 43c80a516e9405ef5864141723d386f916a779de964e370fe276b81eb5726650
+AUX 52-comedi.rules 102 RMD160 95ec7903803ad026770b1480476a9bf9f58addbe SHA1 904923ef8dde3f2e5a6375c48f70f20490e8b920 SHA256 df691c0f1c3ffe334c165a4290cb9f98e70fcb29cfcf6808b9be09b567707b80
+EBUILD comedi-headers-9999.ebuild 1311 RMD160 f10cbe1a917d7735cf7fa23a3d39771cabff0982 SHA1 91084d6e392ed710599917bb7ce679023fbdc6d9 SHA256 5feb79da8f05976b3c374db70f59f8cf249b2f41f1be4bc9b1df09e7da3365e8
+MISC ChangeLog 1099 RMD160 1c04bee27a6ec09816f9bc3a68a38d1418bb217c SHA1 71cce88d0da5f6df111779dc21a2faaebdcbc52d SHA256 74c603537d55eacd7f2859266bf97f473d9146046d41178bd4a014e80a3f63aa
 MISC metadata.xml 247 RMD160 6735f3a5dd2d7a2b70589d1693f35d54291b7147 SHA1 c015969fe50967340dd050a44cb9f8a30b5e34a5 SHA256 9e65060e5f9d0a50d28c7a69d9c27fed6c3037fdd3e420cc276627fde2794f72
index 3fdf884f7aa5f3063a9564c00d87c16dcd0f7aac..7315ac24bdff6be359d4210d86a424c580fd622d 100644 (file)
@@ -16,13 +16,18 @@ HOMEPAGE="http://www.comedi.org/"
 LICENSE="LGPL-2.1"
 SLOT="0"
 KEYWORDS="~x86"
-IUSE=""
+IUSE="+udev"
 
 DEPEND=""
 RDEPEND=""
 
 RESTRICT="binchecks strip"
 
+pkg_setup() {
+       use udev && enewgroup comedi
+       #groupdel in pkg_postrm()?
+}
+
 src_configure() { :; }
 
 src_compile() { :; }
@@ -30,5 +35,26 @@ src_compile() { :; }
 src_install() {
        cd "${S}/include/linux"
        insinto /usr/include/
-       doins comedi.h || die "include failed"
+       doins comedi.h || die "include install failed"
+       if use udev; then
+               insinto /etc/udev/rules.d
+               doins "${FILESDIR}/52-comedi.rules" || die "udev rule install failed"
+       fi
+}
+
+pkg_postinst() {
+       if use udev; then
+               elog "To be able to use Comedi devices, you need to be a"
+               elog "member of the group 'comedi' which has just been added"
+               elog "to your system. You can add your user to the group by"
+               elog "running the following command as root:"
+               elog
+               elog "  usermod -a -G comedi youruser"
+               elog
+               elog "Please be aware that you need to either re-login or run"
+               elog
+               elog "  newgrp - comedi"
+               elog
+               elog "for the group membership to take effect."
+       fi
 }
diff --git a/files/52-comedi.rules b/files/52-comedi.rules
new file mode 100644 (file)
index 0000000..a3f058c
--- /dev/null
@@ -0,0 +1,3 @@
+# Setup /dev/comedi* devices to belong to the `comedi' group.
+
+KERNEL=="comedi[0-9]*", GROUP="comedi"