Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 19 additions & 19 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ DRIVERDIR?=$(shell pwd)/driver
MODULEDIR?=/lib/modules/$(shell uname -r)/kernel/drivers/usb

DKMS_NAME?=leetmouse-driver
DKMS_VER?=0.9.0
DKMS_VER?=0.10.1


.PHONY: driver
Expand All @@ -22,7 +22,7 @@ clean: driver_clean
driver:
@echo -e "\n::\033[32m Compiling leetmouse kernel module\033[0m"
@echo "========================================"
cp -n $(DRIVERDIR)/config.sample.h $(DRIVERDIR)/config.h
#cp -n $(DRIVERDIR)/config.sample.h $(DRIVERDIR)/config.h
$(MAKE) -C $(KERNELDIR) M=$(DRIVERDIR) modules


Expand All @@ -35,38 +35,38 @@ driver_clean:
driver_install:
@echo -e "\n::\033[34m Installing leetmouse kernel module\033[0m"
@echo "====================================================="
@cp -v $(DRIVERDIR)/*.ko $(DESTDIR)/$(MODULEDIR)
@chown -v root:root $(DESTDIR)/$(MODULEDIR)/*.ko
@cp -v $(DRIVERDIR)/*.ko $(DESTDIR)$(MODULEDIR)
@chown -v root:root $(DESTDIR)$(MODULEDIR)/*.ko
depmod

# Remove kernel modules
driver_uninstall:
@echo -e "\n::\033[34m Uninstalling leetmouse kernel module\033[0m"
@echo "====================================================="
@rm -fv $(DESTDIR)/$(MODULEDIR)/leetmouse.ko
@rm -fv $(DESTDIR)$(MODULEDIR)/leetmouse.ko

setup_dkms:
@echo -e "\n::\033[34m Installing DKMS files\033[0m"
@echo "====================================================="
install -m 644 -v -D Makefile $(DESTDIR)/usr/src/$(DKMS_NAME)-$(DKMS_VER)/Makefile
install -m 644 -v -D install_files/dkms/dkms.conf $(DESTDIR)/usr/src/$(DKMS_NAME)-$(DKMS_VER)/dkms.conf
install -m 755 -v -d driver $(DESTDIR)/usr/src/$(DKMS_NAME)-$(DKMS_VER)/driver
install -m 644 -v -D driver/Makefile $(DESTDIR)/usr/src/$(DKMS_NAME)-$(DKMS_VER)/driver/Makefile
install -m 644 -v driver/*.c $(DESTDIR)/usr/src/$(DKMS_NAME)-$(DKMS_VER)/driver/
install -m 644 -v driver/*.h $(DESTDIR)/usr/src/$(DKMS_NAME)-$(DKMS_VER)/driver/
rm -fv $(DESTDIR)/usr/src/$(DKMS_NAME)-$(DKMS_VER)/driver/*.mod.c
install -m 644 -v -D Makefile $(DESTDIR)usr/src/$(DKMS_NAME)-$(DKMS_VER)/Makefile
install -m 644 -v -D install_files/dkms/dkms.conf $(DESTDIR)usr/src/$(DKMS_NAME)-$(DKMS_VER)/dkms.conf
install -m 755 -v -d driver $(DESTDIR)usr/src/$(DKMS_NAME)-$(DKMS_VER)/driver
install -m 644 -v -D driver/Makefile $(DESTDIR)usr/src/$(DKMS_NAME)-$(DKMS_VER)/driver/Makefile
install -m 644 -v driver/*.c $(DESTDIR)usr/src/$(DKMS_NAME)-$(DKMS_VER)/driver/
install -m 644 -v driver/*.h $(DESTDIR)usr/src/$(DKMS_NAME)-$(DKMS_VER)/driver/
rm -fv $(DESTDIR)usr/src/$(DKMS_NAME)-$(DKMS_VER)/driver/*.mod.c

remove_dkms:
@echo -e "\n::\033[34m Removing DKMS files\033[0m"
@echo "====================================================="
rm -rf $(DESTDIR)/usr/src/$(DKMS_NAME)-$(DKMS_VER)
rm -rf $(DESTDIR)usr/src/$(DKMS_NAME)-$(DKMS_VER)

udev_install:
@echo -e "\n::\033[34m Installing leetmouse udev rules\033[0m"
@echo "====================================================="
install -m 644 -v -D install_files/udev/99-leetmouse.rules $(DESTDIR)/usr/lib/udev/rules.d/99-leetmouse.rules
install -m 755 -v -D install_files/udev/leetmouse_bind $(DESTDIR)/usr/lib/udev/leetmouse_bind
install -m 755 -v -D install_files/udev/leetmouse_manage $(DESTDIR)/usr/lib/udev/leetmouse_manage
install -m 644 -v -D install_files/udev/99-leetmouse.rules $(DESTDIR)etc/udev/rules.d/99-leetmouse.rules
install -m 755 -v -D install_files/udev/leetmouse_bind $(DESTDIR)etc/udev/leetmouse_bind
install -m 755 -v -D install_files/udev/leetmouse_manage $(DESTDIR)etc/udev/leetmouse_manage

udev_trigger:
@echo -e "\n::\033[34m Triggering new udev rules\033[0m"
Expand All @@ -77,10 +77,10 @@ udev_trigger:
udev_uninstall:
@echo -e "\n::\033[34m Uninstalling leetmouse udev rules\033[0m"
@echo "====================================================="
rm -f $(DESTDIR)/usr/lib/udev/rules.d/99-leetmouse.rules $(DESTDIR)/usr/lib/udev/leetmouse_bind $(DESTDIR)/usr/lib/udev/leetmouse_manage
rm -f $(DESTDIR)etc/udev/rules.d/99-leetmouse.rules $(DESTDIR)etc/udev/leetmouse_bind
udevadm control --reload-rules
. $(DESTDIR)/usr/lib/udev/leetmouse_manage unbind_all
rm -f $(DESTDIR)/usr/lib/udev/leetmouse_manage
. $(DESTDIR)etc/udev/leetmouse_manage unbind_all
rm -f $(DESTDIR)etc/udev/leetmouse_manage

install_i_know_what_i_am_doing: all driver_install udev_install udev_trigger
install: manual_install_msg ;
Expand Down
72 changes: 72 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Description
This fork of =LEETMOUSE= by korsilyn, chilliams and systemofapwne adds in Classic acceleration, a sigmoid function acceleration and changes the functionality of sensitivity to behave more like RawAccel. Below are the changes from this fork:
* Moved to fixedptc.h - No more mouse lag, like in both forks of leetmouse
* Compiling on latest kernel
* Pre Scale is removed
* Post Scale is removed
* Sensitivity is made to behave more like RawAccel (post calculation multiplier, like Post Scale)

The **LEETMOUSE** kernelmodule enables quake-live like acceleration for your mouse on Linux and is heavily inspired by previous works from [Povohat's mouse driver for Windows.](http://accel.drok-radnik.com/old.html)
**LEETMOUSE** basically fuses the original [Linux USB mouse driver](https://github.com/torvalds/linux/blob/master/drivers/hid/usbhid/usbmouse.c) code with the acceleration code-base and has been initially developed by [Christopher Williams](https://github.com/chilliams).
Since the [original work](https://github.com/chilliams/mousedriver) was in a rough state and seem to have been abandonned, this fork has been started.

# Installation & Uninstallation
## Preparation & Configuration
+ Clone this repository, copy **driver/config.sample.h** to **driver/config.h** and edit it in your favorite text editor. Change the defines at the top of config.h to match your desired acceleration settings.
+ Make sure, you have the required toolchains (e.g. *base-devel* on Arch or *build-essentials* on Debian) installed as well as the *linux-headers* for your installed kernel.
## Arch/Manjaro
Since the maintainer of **LEETMOUSE** is an Arch and Manjaro user, a **PKGBUILD** has been written for seamless integration into pacman.

### Installation
```
# Create the PKGBUILD, copy associated files and run makepkg
./scripts/build_arch.sh
# Run pacman on the created package
sudo pacman -U pkg/build/leetmouse*.zst
```
All your mice should now be bound to this driver. They will also automatically bind to it after a reboot. If this did not work, run =sudo /usr/lib/udev/leetmouse_manage bind_all=

### Uninstallation
```
sudo pacman -R leetmouse-driver-dkms
```
All your mice should now be bound to the generic usbhid driver again.

## Other distros
Other distributions' package-managers are not yet supported and thus need a manual installation. However Debian based systems are planned.
The installation is not yet very polished but eventually will become so.

### Installation

Determine the current version of this module by examining the variable =DKMS_VER= in the =Makefile=. It can be e.g. 0.9.0
Run the following commands to build and install the kernel module
```
# Install the driver and activate the dkms module
sudo make setup_dkms && sudo make udev_install
sudo dkms install -m leetmouse-driver -v 0.9.0 # Enter the version you determined from the Makefile earlier in here
```
All your mice should now be bound to this driver. They will also automatically bind to it after a reboot. If this did not work, run =sudo /usr/lib/udev/leetmouse_manage bind_all=
If this still does not work, there is a major problem

### Uninstallation

You again need to know then =version= as described above for the installation
```
# Unbind all mice from the driver
sudo /usr/lib/udev/leetmouse_manage unbind_all
# Uninstall the driver
sudo dkms remove -m leetmouse-driver -v 0.9.0
sudo make remove_dkms && sudo make udev_uninstall
```
Unplug and replug your mouse or reboot to have your mice bound back to the generic usbhid.
# Manual compile, insmod, bind
If you want to compile this module only for testing purposes or development, you do not need to install the whole package to your system

Compile the module, remove previously loaded modules and insert it.
```
make clean && make
sudo rmmod leetmouse
sudo insmod ./driver/leetmouse.ko
```
If you did not install the udev rules before via **sudo make udev_install** you need to manually bind your mouse to this driver.
You can take a look at **scripts/bind.sh** for an example on how to determine your mouse's USB address for that. However using the udev rules for development is advised.
84 changes: 0 additions & 84 deletions README.org

This file was deleted.

22 changes: 21 additions & 1 deletion driver/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,27 @@
KERNELRELEASE ?= $(shell uname -r)
KERNEL_DIR ?= /lib/modules/$(KERNELRELEASE)/build
PWD := $(shell pwd)

obj-m += leetmouse.o
leetmouse-objs := usbmouse.o accel.o util.o

ccflags-y += -mhard-float -mpreferred-stack-boundary=4

all:
cp -n config.sample.h config.h
cp -n $(PWD)/config.sample.h $(PWD)/config.h
$(MAKE) -C $(KERNEL_DIR) M=$(PWD) modules

install:
cp -n $(PWD)/config.sample.h $(PWD)/config.h
$(MAKE) -C $(KERNEL_DIR) M=$(PWD) modules_install

clean:
rm $(PWD)/config.h
$(MAKE) -C $(KERNEL_DIR) M=$(PWD) clean

insmod:
sudo insmod leetmouse.ko

rmmod:
sudo rmmod leetmouse.ko

Loading