From c62e32d57fd07315bbe5ffb3fcac3ea3956fee5b Mon Sep 17 00:00:00 2001 From: nulln0ne Date: Sat, 10 Dec 2022 19:37:36 +0300 Subject: [PATCH] initial --- AKMBUILD | 8 ++++++++ bbswitch.c | 14 +++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 AKMBUILD diff --git a/AKMBUILD b/AKMBUILD new file mode 100644 index 0000000..9a9c0e9 --- /dev/null +++ b/AKMBUILD @@ -0,0 +1,8 @@ +modname=bbswitch +modver=0.8 +built_modules='bbswitch.ko' + +build() { + touch "$builddir"/Makefile + make $MAKEFLAGS -C "$kernel_srcdir" M="$builddir" src="$srcdir" modules +} diff --git a/bbswitch.c b/bbswitch.c index 341608f..c0c6713 100644 --- a/bbswitch.c +++ b/bbswitch.c @@ -31,10 +31,12 @@ #include #include #include -#include +#include #include #include #include +#include +#include #define BBSWITCH_VERSION "0.8" @@ -375,6 +377,15 @@ static int bbswitch_pm_handler(struct notifier_block *nbp, return 0; } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0) +static struct proc_ops bbswitch_fops = { + .proc_open = bbswitch_proc_open, + .proc_read = seq_read, + .proc_write = bbswitch_proc_write, + .proc_lseek = seq_lseek, + .proc_release= single_release +}; +#else static struct file_operations bbswitch_fops = { .open = bbswitch_proc_open, .read = seq_read, @@ -382,6 +393,7 @@ static struct file_operations bbswitch_fops = { .llseek = seq_lseek, .release= single_release }; +#endif static struct notifier_block nb = { .notifier_call = &bbswitch_pm_handler