From 9b9cf09b3e6a1ab9161d478195beb8f93a36cddb Mon Sep 17 00:00:00 2001 From: Ansa89 Date: Wed, 11 May 2016 10:48:50 +0200 Subject: [PATCH] Import version 0.3.2 --- Makefile | 29 +++++++++++++---------------- lcdtopgun.c | 14 +++++++++++--- 2 files changed, 24 insertions(+), 19 deletions(-) diff --git a/Makefile b/Makefile index b4533a3..3dd1530 100644 --- a/Makefile +++ b/Makefile @@ -1,21 +1,18 @@ -TOPDIR := /usr/src/linux -MOD_ROOT := -PWD := $(shell pwd) +PWD := $(shell pwd) +KVER ?= $(shell uname -r) +KDIR := /lib/modules/$(KVER)/build +obj-m := lcdtopgun.o -obj-m := lcdtopgun.o +lcdtopgun.ko: + $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules -default: - $(MAKE) -C $(TOPDIR) SUBDIRS=$(PWD) modules +.PHONY: all clean install -clean: - rm -f lcdtopgun.o lcdtopgun.ko - rm -f lcdtopgun.mod.c lcdtopgun.mod.o - rm -f Module.symvers - rm -f modules.order - rm -f .lcdtopgun* - rm -fr .tmp_versions +all: lcdtopgun.ko -install: - $(MAKE) -C $(TOPDIR) SUBDIRS=$(PWD) modules_install - depmod -ae +clean: + $(MAKE) -C $(KDIR) M=$(PWD) clean +install: lcdtopgun.ko + $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules_install + depmod -F$(KDIR)/System.map -ae $(KVER) diff --git a/lcdtopgun.c b/lcdtopgun.c index daca398..09e7efd 100644 --- a/lcdtopgun.c +++ b/lcdtopgun.c @@ -9,6 +9,10 @@ * * History: * + * 2012-07-24 - 0.3.2: (Ansa89) Add "err" macro + * - Added the "err" macro since it was missing on linux 3.5. + * - Tested up to linux kernel 3.5. + * * 2011-11-30 - 0.3.1: (Ansa89) Fix "info" macro * - Rewrote the "info" macro (for aesthetics reasons). * - Use "printk" instead of "info" in "usb_topgun_init()". @@ -62,15 +66,18 @@ MODULE_PARM_DESC(debug, "Debugging"); /* * Version Information */ -#define DRIVER_VERSION "v0.3.1" +#define DRIVER_VERSION "v0.3.2" #define DRIVER_AUTHOR "Christophe Thibault " #define DRIVER_DESC "USB EMS LCD TopGun driver" #define DRIVER_LICENSE "GPL" /* - * Missing macro (at least on linux >= 3.0) + * Missing macro (at least on linux >= 3.5) */ -#define info(format, arg...) printk(KERN_INFO format "\n" , ## arg) +#define info(format, arg...) \ + printk(KERN_INFO format "\n" , ## arg) +#define err(format, arg...) \ + printk(KERN_ERR KBUILD_MODNAME ": " format "\n", ##arg) MODULE_AUTHOR(DRIVER_AUTHOR); MODULE_DESCRIPTION(DRIVER_DESC); @@ -344,6 +351,7 @@ static int __init usb_topgun_init(void) { int retval = usb_register(&usb_topgun_driver); if (retval == 0) +// info(DRIVER_DESC " " DRIVER_VERSION " initialized" ); printk(KERN_INFO "%s: " DRIVER_DESC " " DRIVER_VERSION " initialized\n" , usb_topgun_driver.name); return retval; }