summaryrefslogtreecommitdiff
path: root/pid2/loader.sh
diff options
context:
space:
mode:
authorGuillermo Ramos2011-07-20 21:46:28 +0200
committerGuillermo Ramos2011-07-20 21:46:28 +0200
commit00d5bce9f24e2114316bd1165ebdad05644b7365 (patch)
tree8ac2742f30517069505d31b9387f28743a95b03f /pid2/loader.sh
parent389cc1ba8d9e673f1313fd966820c6d9d463525f (diff)
downloadlkm-00d5bce9f24e2114316bd1165ebdad05644b7365.tar.gz
AƱadido pid2 y ejemplos de oreilly
Diffstat (limited to 'pid2/loader.sh')
-rw-r--r--pid2/loader.sh23
1 files changed, 23 insertions, 0 deletions
diff --git a/pid2/loader.sh b/pid2/loader.sh
new file mode 100644
index 0000000..579acff
--- /dev/null
+++ b/pid2/loader.sh
@@ -0,0 +1,23 @@
+#!/bin/bash
+module="pidevice"
+device="pidevice"
+mode="644"
+
+insmod ./$module.ko $* || exit -1
+
+rm -f /dev/${device}[0-4]
+
+major=$(cat /proc/devices | grep $module | cut -f 1)
+
+echo major
+exit -1
+
+for i in {0..3}; do
+ mknod /dev/${device}$i c $major $i
+done
+
+group="staff"
+grep -q '^staff:' /etc/group || group="wheel"
+
+chgrp $group /dev/${device}[0-3]
+chmod $mode /dev/${device}[0-3]