Skip to content

Commit

Permalink
Merge pull request #12 from tvision-insights/feature/dkms
Browse files Browse the repository at this point in the history
DKMS support and updated README
  • Loading branch information
milesp20 authored May 27, 2018
2 parents 1ee419d + 4672d73 commit 6a3850e
Show file tree
Hide file tree
Showing 7 changed files with 135 additions and 57 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
*.cmd
*.mod.c
.tmp_versions/
*~
29 changes: 27 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)
21 changes: 0 additions & 21 deletions README.CentOS.md

This file was deleted.

134 changes: 100 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 DEB/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:

Expand All @@ -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.
1 change: 1 addition & 0 deletions contrib/etc/modprobe.d/nuc_led.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
options nuc_led nuc_led_perms=0664 nuc_led_gid=0 nuc_led_uid=0
1 change: 1 addition & 0 deletions contrib/etc/modules
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nuc_led
5 changes: 5 additions & 0 deletions dkms.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
AUTOINSTALL="yes"
BUILT_MODULE_NAME[0]="nuc_led"
DEST_MODULE_LOCATION[0]="/extra"
PACKAGE_NAME="intel-nuc-led"
PACKAGE_VERSION=1.0

0 comments on commit 6a3850e

Please sign in to comment.