From 3dfe622b850987a4b39919095ec40bdbf5ab6d59 Mon Sep 17 00:00:00 2001 From: Parker Reed Date: Mon, 25 Nov 2019 18:00:50 -0500 Subject: [PATCH] Add DKMS support --- Kbuild | 3 +++ Makefile | 9 +++------ README.md | 27 ++++++++++++++++++++++++++- dkms.conf | 8 ++++++++ 4 files changed, 40 insertions(+), 7 deletions(-) create mode 100644 Kbuild create mode 100644 dkms.conf diff --git a/Kbuild b/Kbuild new file mode 100644 index 0000000..6ea23cc --- /dev/null +++ b/Kbuild @@ -0,0 +1,3 @@ +obj-m := hid-logitech-new.o +hid-logitech-new-y := hid-lg.o hid-lgff.o hid-lg2ff.o hid-lg3ff.o hid-lg4ff.o +ccflags-y := -Idrivers/hid diff --git a/Makefile b/Makefile index 80c659b..c93d77b 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,3 @@ -ifneq ($(KERNELRELEASE),) -obj-m := hid-logitech-new.o -hid-logitech-new-y := hid-lg.o hid-lgff.o hid-lg2ff.o hid-lg3ff.o hid-lg4ff.o -ccflags-y := -Idrivers/hid -else KDIR ?= /lib/modules/`uname -r`/build default: @@ -21,4 +16,6 @@ unload: rmmod hid-logitech-new modprobe hid-logitech -endif +clean: + $(MAKE) -C $(KDIR) M=$$PWD clean + diff --git a/README.md b/README.md index c28cbcf..34ee6b5 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,29 @@ This module adds the following features: ## Build and install +The module can be installed with DKMS or manually. Follow just one of the +following procedures. + +If you want to use DKMS but the module was previously installed with the manual +method delete the module by hand: + +`$ sudo rm /lib/modules/$(uname -r)/extra/hid-logitech-new.ko` + +### DKMS + +This installs the module to the system `src` directory and allows the module to +be rebuilt any time the kernel updates. + +From your package manager of choice, install the package providing the `dkms` command. + +Download the project to `/usr/src/new-lg4ff`. + +Run the command: + +`$ sudo dkms install /usr/src/new-lg4ff` + +### Manual method + ``` $ make $ sudo make install @@ -39,7 +62,9 @@ Unload the module (restoring the in-kernel module): `$ sudo make unload` -Check that the driver is loaded: +### Check that the driver is loaded + +Run: `sudo dmesg` diff --git a/dkms.conf b/dkms.conf new file mode 100644 index 0000000..9fae752 --- /dev/null +++ b/dkms.conf @@ -0,0 +1,8 @@ +PACKAGE_NAME="new-lg4ff" +PACKAGE_VERSION="0.1" +MAKE[0]="make" +CLEAN="make clean" +BUILT_MODULE_NAME[0]="hid-logitech-new" +DEST_MODULE_NAME[0]="hid-logitech" +DEST_MODULE_LOCATION[0]="/kernel/drivers/hid" +AUTOINSTALL="yes"