]> granicus.if.org Git - intel_nuc_led/commitdiff
Update Makefile with new DKMS targets, contrib modprobe config files, and update...
authorJulio Lajara <julio@tvisioninsights.com>
Fri, 25 May 2018 20:29:13 +0000 (16:29 -0400)
committerJulio Lajara <julio@tvisioninsights.com>
Fri, 25 May 2018 20:29:55 +0000 (16:29 -0400)
- Includes @R0nd PR #9

.gitignore
Makefile
README.CentOS.md [deleted file]
README.md
contrib/etc/modprobe.d/nuc_led.conf [new file with mode: 0644]
contrib/etc/modules [new file with mode: 0644]
dkms.conf

index b9bcc017fb511ca5e39fd7a8a550f18a95b47485..2b8f8cdf8d97bf10e9bec3e07752acc9643bff17 100644 (file)
@@ -5,3 +5,4 @@
 *.cmd
 *.mod.c
 .tmp_versions/
+*~
index e033584aa2dc5d8d29aa51acbc90a466cb1c7871..b8e8179e76eec9afcb88cd52526140f330f22f55 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -4,12 +4,37 @@ KVERSION := $(shell uname -r)
 KDIR := /lib/modules/$(KVERSION)/build
 PWD := $(shell pwd)
 
-default:
-       $(MAKE) -C $(KDIR) M=$(PWD) modules
+.PHONY: clean default dkms-add dkms-build dkms-deb dkms-install dkms-rpm dkms-uninstall install
 
 clean:
        $(MAKE) -C $(KDIR) M=$(PWD) clean
 
+default:
+       $(MAKE) -C $(KDIR) M=$(PWD) modules
+
+dkms-add:
+       dkms add --force $(PWD)
+
+dkms-build: dkms-add
+       dkms build -m intel-nuc-led -v 1.0
+
+dkms-deb: dkms-add
+       dkms mkdeb intel-nuc-led/1.0 --source-only
+
+dkms-install: dkms-build
+       dkms install -m intel-nuc-led -v 1.0
+       @depmod -a $(KVERSION)
+
+dkms-rpm: dkms-add
+       dkms mkrpm intel-nuc-led/1.0 --source-only
+
+dkms-status:
+       dkms status intel-nuc-led/1.0
+
+dkms-uninstall:
+       dkms remove -m intel-nuc-led -v 1.0 --all
+       rm -rf /usr/src/intel-nuc-led-1.0/
+
 install:
        $(MAKE) -C $(KDIR) M=$(PWD) modules_install
        @depmod -a $(KVERSION)
diff --git a/README.CentOS.md b/README.CentOS.md
deleted file mode 100644 (file)
index 6dcb7db..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-# Building on CentOS
-
-To build on CentOS:
-
-Install gcc and the kernel development package:
-
-```
-sudo yum -y install kernel-devel-`uname -r` gcc
-```
-
-Build with make:
-
-```
-make
-```
-
-and load the module with insmod:
-
-```
-sudo insmod nuc_led.ko
-```
index 7842093d07f9ff1e34d083b3ad764aa6630fdd87..6e3000ff2e680d4413cc71dbc95fbf06586d6727 100644 (file)
--- a/README.md
+++ b/README.md
@@ -7,56 +7,120 @@ it can act as a jumping off point for a more polished and complete implementatio
 manipulation of the power LED and ring LED, it ought to work fine, but use with caution none the less. This
 has only been tested on 4.4.x kernels.
 
+
+## Requirements
+
 Requirements:
 
 * Intel NUC7i[x]BN and NUC6CAY
 * BIOS AY0038 or BN0043 or later
 * ACPI/WMI support in kernel
-* LED(s) set to SW Control in BIOS
+* LED(s) set to `SW Control` in BIOS
+
+## Building
+
+THe `nuc_led` kernel module supports building and installing "from source" directly or using `dkms`.
+
+### Installing Build Dependencies
+
+Ubuntu:
+
+```
+apt-get install build-essential linux-headers-$(uname -r)
+
+# DKMS dependencies
+apt-get install debhelper dkms
+```
+
+Redhat:
+
+```
+yum groupinstall "Development Tools"
+yum install kernel-devel-$(uname -r)
+
+# Install appropriate EPEL for DKMS if needed by your RHEL variant
+yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
+
+yum install dkms
+```
+
+### Building and Installing "from source"
+
+```
+make clean
+make install
+```
+
+### Building and Installing Using DKMS
+
+Build and install without system packaging:
+
+```
+make dkms-install
+```
+
+Uninstall without system packaging:
+
+```
+make dkms-uninstall
+```
+
+Build and install using system packaging:
+
+```
+# Ubuntu
+make dkms-deb
+
+# RHEL
+make dkms-rpm
+
+# Install generated RPM from the folder specified in the output using system package manager
+```
+
+## Usage
     
 This driver works via '/proc/acpi/nuc_led'.  To get current LED state:
 
-    cat /proc/acpi/nuc_led
+```
+cat /proc/acpi/nuc_led
+```
     
 To change the LED state:
 
-    echo '<led>,<brightness>,<blink/fade>,<color>' | sudo tee /proc/acpi/nuc_led > /dev/null
-    
-LEDs:
+```
+ echo '<led>,<brightness>,<blink/fade>,<color>' | sudo tee /proc/acpi/nuc_led > /dev/null
+```
+
+|LED  |Description                              |
+|-----|-----------------------------------------|
+|power|The power button LED.                    |
+|ring |The ring LED surrounding the front panel.|
 
-* power - the power button LED
-* ring  - the ring LED surrounding the front panel
-    
 Brightness:
 
-* any integer between 0 and 100
+* any integer between `0` and `100`.
 
-Blink/fade:
+|Blink/Fade Option|Description    |
+|-----------------|---------------|
+|blink\_fast      |1Hz blink      |
+|blink\_medium    |0.5Hz blink    |
+|blink\_slow      |0.25Hz blink   |
+|fade\_fast       |1Hz blink      |
+|fade\_medium     |0.5Hz blink    |
+|fade\_slow       |0.25Hz blink   |
+|none             |solid/always on|
 
-* none          solid/always on
-* blink_slow    0.25Hz blink
-* blink_medium  0.5Hz blink
-* blink_fast    1Hz blink
-* fade_slow     0.25Hz blink
-* fade_medium   0.5Hz blink
-* fade_fast     1Hz blink
-    
-Color (power LED):
-
-* off
-* blue
-* amber
-    
-Color (ring LED):
-
-* off
-* cyan
-* pink
-* yellow
-* blue
-* red
-* green
-* white
+|LED Color|power|ring|
+|---------|:---:|:--:|
+|amber    |X    |    |
+|cyan     |     |X   |
+|blue     |X    |X   |
+|green    |     |X   |
+|off      |X    |X   |
+|pink     |     |X   |
+|red      |     |X   |
+|white    |     |X   |
+|yellow   |     |X   |
     
 Example execution to cause the ring LED blink green at a medium rate at partial intensity:
 
@@ -69,3 +133,5 @@ You can change the owner, group and permissions of `/proc/acpi/nuc_led` by passi
 * `nuc_led_uid` to set the owner (default is 0, root)
 * `nuc_led_gid` to set the owning group (default is 0, root)
 * `nuc_led_perms` to set the file permissions (default is r+w for group and user and r for others)
+
+Note: Once an LED has been set to `SW Control` in the BIOS, it will remain off initially until a color is explicitly set, after which the set color is retained across reboots.
diff --git a/contrib/etc/modprobe.d/nuc_led.conf b/contrib/etc/modprobe.d/nuc_led.conf
new file mode 100644 (file)
index 0000000..e381419
--- /dev/null
@@ -0,0 +1 @@
+options nuc_led nuc_led_perms=0664 nuc_led_gid=0 nuc_led_uid=0
\ No newline at end of file
diff --git a/contrib/etc/modules b/contrib/etc/modules
new file mode 100644 (file)
index 0000000..c26c8f1
--- /dev/null
@@ -0,0 +1 @@
+nuc_led
\ No newline at end of file
index 471fe01c211a813bc600eec5689c48aeae1e1d62..2d56c5d4894bbbaf7db67e8647e5f54420742300 100644 (file)
--- a/dkms.conf
+++ b/dkms.conf
@@ -1,5 +1,5 @@
-PACKAGE_NAME="intel-nuc-led"
-PACKAGE_VERSION=1.0
+AUTOINSTALL="yes"
 BUILT_MODULE_NAME[0]="nuc_led"
 DEST_MODULE_LOCATION[0]="/extra"
-AUTOINSTALL="yes"
+PACKAGE_NAME="intel-nuc-led"
+PACKAGE_VERSION=1.0
\ No newline at end of file