Initial commit

master
itycodes 2 weeks ago
commit 4c6da5c6ad

File diff suppressed because it is too large Load Diff

@ -0,0 +1,56 @@
From 0de2cb135aed20f3e706c3502d4cc9597debbda7 Mon Sep 17 00:00:00 2001
From: itycodes <tranquillitycodes@proton.me>
Date: Thu, 12 Jun 2025 02:03:17 +0200
Subject: [PATCH 2/4] Fix build errors for 6.10
---
cc1101_chrdev.c | 4 ++--
cc1101_main.c | 3 +--
2 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/cc1101_chrdev.c b/cc1101_chrdev.c
index 21779b0..9a0bc69 100644
--- a/cc1101_chrdev.c
+++ b/cc1101_chrdev.c
@@ -378,7 +378,7 @@ int cc1101_chrdev_add_device(cc1101_t * cc1101) {
cc1101->devt = MKDEV(SPI_MAJOR_NUMBER, device_index);
// Create a /dev/cc1101.x.x character device
- if(IS_ERR(device_create(dev_class, &cc1101->spi->dev, cc1101->devt, cc1101, "cc1101.%d.%d", cc1101->spi->master->bus_num, cc1101->spi->chip_select))) {
+ if(IS_ERR(device_create(dev_class, &cc1101->spi->dev, cc1101->devt, cc1101, "cc1101.%d.%s", cc1101->spi->controller->bus_num, cc1101->spi->chip_select))) {
ret = -ENODEV;
goto done;
}
@@ -432,7 +432,7 @@ int cc1101_chrdev_setup(struct spi_driver* cc1101_driver)
goto err_register;
}
- dev_class = class_create(THIS_MODULE, "cc1101");
+ dev_class = class_create("cc1101");
if (IS_ERR(dev_class)) {
ret = PTR_ERR(dev_class);
goto err_class_create;
diff --git a/cc1101_main.c b/cc1101_main.c
index fde434c..8bc340f 100755
--- a/cc1101_main.c
+++ b/cc1101_main.c
@@ -117,7 +117,7 @@ static int cc1101_spi_probe(struct spi_device *spi)
/*
* Function called on module removal for each CC1101 entry in device tree
*/
-static int cc1101_spi_remove(struct spi_device *spi)
+static void cc1101_spi_remove(struct spi_device *spi)
{
cc1101_t* cc1101;
cc1101 = spi_get_drvdata(spi);
@@ -131,7 +131,6 @@ static int cc1101_spi_remove(struct spi_device *spi)
// Remove /dev/cc1101.x.x
cc1101_chrdev_remove_device(cc1101);
CC1101_INFO(cc1101, "Removed");
- return 0;
}
/*
--
2.49.0

@ -0,0 +1,35 @@
From b7f93f17eb508c07d45ace1b7b7e62be3ed81664 Mon Sep 17 00:00:00 2001
From: itycodes <tranquillitycodes@proton.me>
Date: Thu, 12 Jun 2025 02:07:07 +0200
Subject: [PATCH 3/4] Fix Makefile not respecting KDIR
---
Makefile | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/Makefile b/Makefile
index c3154cc..30a4df4 100755
--- a/Makefile
+++ b/Makefile
@@ -1,11 +1,13 @@
obj-m := cc1101.o
cc1101-objs+= cc1101_main.o cc1101_chrdev.o cc1101_spi.o cc1101_radio.o cc1101_config.o
+KDIR ?= /lib/modules/$(shell uname -r)/build
+
all:
- make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
+ make -C $(KDIR) M=$(PWD) modules
rxonly:
- make -C /lib/modules/$(shell uname -r)/build M=$(PWD) ccflags-y="-DRXONLY" modules
+ make -C $(KDIR) M=$(PWD) ccflags-y="-DRXONLY" modules
clean:
- make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
\ No newline at end of file
+ make -C $(KDIR) M=$(PWD) clean
\ No newline at end of file
--
2.49.0

@ -0,0 +1,27 @@
From 4cd1b3906c5f42334629866afd5616515ab94bd1 Mon Sep 17 00:00:00 2001
From: itycodes <tranquillitycodes@proton.me>
Date: Thu, 12 Jun 2025 02:10:13 +0200
Subject: [PATCH 4/4] Update to 6.12
---
cc1101_internal.h | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/cc1101_internal.h b/cc1101_internal.h
index 4d0a30f..5f4c958 100644
--- a/cc1101_internal.h
+++ b/cc1101_internal.h
@@ -7,6 +7,10 @@
#include <linux/kernel.h>
#include <linux/kfifo.h>
+#include <linux/mutex.h>
+#include <linux/timer.h>
+#include <linux/workqueue.h>
+
#include "cc1101.h"
--
2.49.0

@ -0,0 +1,52 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
config.allowUnfree = true;
};
lib = pkgs.lib;
kernel = pkgs.linuxPackages.kernel;
kmod = pkgs.stdenv.mkDerivation rec {
name = "cc1101-driver";
src = builtins.fetchGit {
url = "https://github.com/28757B2/cc1101-driver";
rev = "2d0293ee8afba84846da9ebdca2a718d6cc7a387";
};
patches = [
./0001-Replace-Windows-line-endings-with-Unix-ones.patch
./0002-Fix-build-errors-for-6.10.patch
./0003-Fix-Makefile-not-respecting-KDIR.patch
./0004-Update-to-6.12.patch
];
nativeBuildInputs = [ pkgs.kmod pkgs.ncurses pkgs.gnumake ];
makeFlags = [
"KDIR=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
];
buildPhase = ''
make ${lib.concatStringsSep " " makeFlags}
'';
installPhase = ''
mkdir -p $out/lib/modules/${kernel.modDirVersion}/extra
cp *.ko $out/lib/modules/${kernel.modDirVersion}/extra
'';
meta = {
description = "Linux device driver for the Texas Instruments CC1101 radio";
platforms = pkgs.lib.platforms.linux;
};
};
in {
packages.default = kmod;
});
}
Loading…
Cancel
Save