Compare commits
17 Commits
docs-updat
...
0.0.6
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3d19599175 | ||
|
|
6d0ac791b1 | ||
|
|
bc87313267 | ||
|
|
8f42ca6774 | ||
|
|
2ee89cb9a4 | ||
|
|
f8e9545f39 | ||
|
|
241a25cee9 | ||
|
|
8220bbbfb0 | ||
|
|
96e036acda | ||
|
|
bfbdb9620e | ||
|
|
38c629829f | ||
|
|
b58aee4403 | ||
|
|
34d6d6b294 | ||
|
|
3ff83db322 | ||
|
|
d2585bcf17 | ||
|
|
c092780bf3 | ||
|
|
dcdd8c1e6a |
@@ -29,11 +29,13 @@ And that's basically it
|
|||||||
2. `Firmware Update` function. Use Windows PC or Windows VM at the moment.
|
2. `Firmware Update` function. Use Windows PC or Windows VM at the moment.
|
||||||
3. Setup through proprietary software. May require [some tweaking](#how-to-set-up-a-base-parameters))
|
3. Setup through proprietary software. May require [some tweaking](#how-to-set-up-a-base-parameters))
|
||||||
|
|
||||||
## How to use this driver?
|
## How to install this driver?
|
||||||
You can install it through AUR package, through DKMS or manually.
|
You can install it through AUR package, through DKMS or manually.
|
||||||
|
|
||||||
|
On SecureBoot enabled systems you will need additional steps for load this driver into the system. See [Signing](docs/SIGNING.md#signing) section.
|
||||||
|
|
||||||
### AUR package
|
### AUR package
|
||||||
There's an [AUR package](https://aur.archlinux.org/packages/universal-ff-dkms-git) for Arch Linux maintained by [@Lawstorant](https://github.com/Lawstorant).
|
There's an [AUR package](https://aur.archlinux.org/packages/universal-pidff-dkms-git) for Arch Linux maintained by [@Lawstorant](https://github.com/Lawstorant).
|
||||||
|
|
||||||
### DKMS
|
### DKMS
|
||||||
DKMS will install module into system, and will update it every time you update your kernel. Module will persist after reboots. It's the preferrable way to install it on the most distros.
|
DKMS will install module into system, and will update it every time you update your kernel. Module will persist after reboots. It's the preferrable way to install it on the most distros.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
PACKAGE_NAME="universal-pidff"
|
PACKAGE_NAME="universal-pidff"
|
||||||
PACKAGE_VERSION="0.0.3"
|
PACKAGE_VERSION="0.0.6"
|
||||||
MAKE[0]="make KVERSION=$kernelver"
|
MAKE[0]="make KVERSION=$kernelver"
|
||||||
CLEAN="make clean"
|
CLEAN="make clean"
|
||||||
BUILT_MODULE_NAME[0]="hid-universal-pidff"
|
BUILT_MODULE_NAME[0]="hid-universal-pidff"
|
||||||
|
|||||||
59
docs/SIGNING.md
Normal file
59
docs/SIGNING.md
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
|
||||||
|
# Signing
|
||||||
|
|
||||||
|
## Signing module for SecureBoot
|
||||||
|
Latest kernels forbid loading unsigned custom kernel modules into the system with SecureBoot enabled.
|
||||||
|
|
||||||
|
For SecureBoot enabled system you have a choice:
|
||||||
|
1. Disable SecureBoot in your UEFI/BIOS
|
||||||
|
2. Use generated Machine Owner Key from DKMS (supports automatic signing)
|
||||||
|
3. Create Machine Owner Key and load it into your UEFI/BIOS, and sign kernel module with it.
|
||||||
|
|
||||||
|
### Using DKMS MOK key
|
||||||
|
MOK private key and certificates are generated the first time DKMS is run. You just need to import it to your system.
|
||||||
|
|
||||||
|
The location as well can be changed by setting the appropriate variables in /etc/dkms/framework.conf. For example, to allow usage of the system default Ubuntu update-secureboot-policy set the configuration file as follows:
|
||||||
|
```
|
||||||
|
mok_signing_key="/var/lib/shim-signed/mok/MOK.priv"
|
||||||
|
mok_certificate="/var/lib/shim-signed/mok/MOK.der"
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
# Find where keys are on your distro
|
||||||
|
ls -al /var/lib/dkms/mok*
|
||||||
|
# OR (on Ubuntu)
|
||||||
|
ls -al /var/lib/shim-signed/mok/MOK*
|
||||||
|
|
||||||
|
# Enroll keys into system
|
||||||
|
sudo mokutil --import /var/lib/dkms/mok.pub
|
||||||
|
# OR (on Ubuntu)
|
||||||
|
sudo mokutil --import /var/lib/shim-signed/mok/MOK.der
|
||||||
|
```
|
||||||
|
You need to reboot your PC after that, you will be greeted with blue screen dialog.
|
||||||
|
Choose "Enroll MOK", then "Continue" and "Yes". After that choose "Reboot system".
|
||||||
|
|
||||||
|
Now DKMS should sign updated modules automatically as they updated.
|
||||||
|
|
||||||
|
[Reference](https://github.com/dell/dkms/blob/master/README.md#module-signing)
|
||||||
|
|
||||||
|
### Manually create MOK key and manually sign kernel module
|
||||||
|
```
|
||||||
|
# This creates Machine Owner Key
|
||||||
|
openssl req -new -x509 -newkey rsa:2048 -keyout mok.key -outform DER -out mok.pub -nodes -days 36500 -subj "/CN=$hostname kernel module signing key/"
|
||||||
|
|
||||||
|
# This loads it into UEFI
|
||||||
|
sudo mokutil --import mok.pub
|
||||||
|
```
|
||||||
|
|
||||||
|
You need to reboot your PC after that, you will be greeted with blue screen dialog
|
||||||
|
Choose "Enroll MOK", enter your MOK password if exists, then "Continue", "Yes", and then reboot your system.
|
||||||
|
|
||||||
|
After that you can manually sign your built kernel module like so (feel free to adjust paths to keys/certificate/modules):
|
||||||
|
```
|
||||||
|
sudo /usr/src/linux-headers-$(uname -r)/scripts/sign-file sha256 mok.key mok.pub hid-universal-pidff.ko
|
||||||
|
```
|
||||||
|
|
||||||
|
Then you should be able to load driver like so:
|
||||||
|
```
|
||||||
|
sudo insmod hid-universal-pidff.ko
|
||||||
|
```
|
||||||
@@ -14,15 +14,15 @@
|
|||||||
|
|
||||||
static const struct hid_device_id pidff_wheel_devices[] = {
|
static const struct hid_device_id pidff_wheel_devices[] = {
|
||||||
{ HID_USB_DEVICE(USB_VENDOR_ID_MOZA, USB_DEVICE_ID_MOZA_R3),
|
{ HID_USB_DEVICE(USB_VENDOR_ID_MOZA, USB_DEVICE_ID_MOZA_R3),
|
||||||
.driver_data = PIDFF_QUIRK_FIX_WHEEL_DIRECTION | PIDFF_QUIRK_FIX_PERIODIC_ENVELOPE },
|
.driver_data = PIDFF_QUIRK_FIX_WHEEL_DIRECTION },
|
||||||
{ HID_USB_DEVICE(USB_VENDOR_ID_MOZA, USB_DEVICE_ID_MOZA_R5),
|
{ HID_USB_DEVICE(USB_VENDOR_ID_MOZA, USB_DEVICE_ID_MOZA_R5),
|
||||||
.driver_data = PIDFF_QUIRK_FIX_WHEEL_DIRECTION | PIDFF_QUIRK_FIX_PERIODIC_ENVELOPE },
|
.driver_data = PIDFF_QUIRK_FIX_WHEEL_DIRECTION },
|
||||||
{ HID_USB_DEVICE(USB_VENDOR_ID_MOZA, USB_DEVICE_ID_MOZA_R9),
|
{ HID_USB_DEVICE(USB_VENDOR_ID_MOZA, USB_DEVICE_ID_MOZA_R9),
|
||||||
.driver_data = PIDFF_QUIRK_FIX_WHEEL_DIRECTION | PIDFF_QUIRK_FIX_PERIODIC_ENVELOPE },
|
.driver_data = PIDFF_QUIRK_FIX_WHEEL_DIRECTION },
|
||||||
{ HID_USB_DEVICE(USB_VENDOR_ID_MOZA, USB_DEVICE_ID_MOZA_R12),
|
{ HID_USB_DEVICE(USB_VENDOR_ID_MOZA, USB_DEVICE_ID_MOZA_R12),
|
||||||
.driver_data = PIDFF_QUIRK_FIX_WHEEL_DIRECTION | PIDFF_QUIRK_FIX_PERIODIC_ENVELOPE },
|
.driver_data = PIDFF_QUIRK_FIX_WHEEL_DIRECTION },
|
||||||
{ HID_USB_DEVICE(USB_VENDOR_ID_MOZA, USB_DEVICE_ID_MOZA_R16_R21),
|
{ HID_USB_DEVICE(USB_VENDOR_ID_MOZA, USB_DEVICE_ID_MOZA_R16_R21),
|
||||||
.driver_data = PIDFF_QUIRK_FIX_WHEEL_DIRECTION | PIDFF_QUIRK_FIX_PERIODIC_ENVELOPE },
|
.driver_data = PIDFF_QUIRK_FIX_WHEEL_DIRECTION },
|
||||||
{ HID_USB_DEVICE(USB_VENDOR_ID_CAMMUS, USB_DEVICE_ID_CAMMUS_C5),
|
{ HID_USB_DEVICE(USB_VENDOR_ID_CAMMUS, USB_DEVICE_ID_CAMMUS_C5),
|
||||||
.driver_data = PIDFF_QUIRK_NO_DELAY_EFFECT },
|
.driver_data = PIDFF_QUIRK_NO_DELAY_EFFECT },
|
||||||
{ }
|
{ }
|
||||||
|
|||||||
34
hid-pidff.c
34
hid-pidff.c
@@ -311,6 +311,14 @@ static void pidff_set_envelope_report(struct pidff_device *pidff,
|
|||||||
static int pidff_needs_set_envelope(struct ff_envelope *envelope,
|
static int pidff_needs_set_envelope(struct ff_envelope *envelope,
|
||||||
struct ff_envelope *old)
|
struct ff_envelope *old)
|
||||||
{
|
{
|
||||||
|
if (!old) {
|
||||||
|
return envelope->attack_level != 0 ||
|
||||||
|
envelope->fade_level != 0 ||
|
||||||
|
envelope->attack_length != 0 ||
|
||||||
|
envelope->fade_length != 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
return envelope->attack_level != old->attack_level ||
|
return envelope->attack_level != old->attack_level ||
|
||||||
envelope->fade_level != old->fade_level ||
|
envelope->fade_level != old->fade_level ||
|
||||||
envelope->attack_length != old->attack_length ||
|
envelope->attack_length != old->attack_length ||
|
||||||
@@ -643,9 +651,8 @@ static int pidff_upload_effect(struct input_dev *dev, struct ff_effect *effect,
|
|||||||
pidff_set_effect_report(pidff, effect);
|
pidff_set_effect_report(pidff, effect);
|
||||||
if (!old || pidff_needs_set_constant(effect, old))
|
if (!old || pidff_needs_set_constant(effect, old))
|
||||||
pidff_set_constant_force_report(pidff, effect);
|
pidff_set_constant_force_report(pidff, effect);
|
||||||
if (!old ||
|
if (pidff_needs_set_envelope(&effect->u.constant.envelope,
|
||||||
pidff_needs_set_envelope(&effect->u.constant.envelope,
|
old ? &old->u.periodic.envelope : NULL))
|
||||||
&old->u.constant.envelope))
|
|
||||||
pidff_set_envelope_report(pidff,
|
pidff_set_envelope_report(pidff,
|
||||||
&effect->u.constant.envelope);
|
&effect->u.constant.envelope);
|
||||||
break;
|
break;
|
||||||
@@ -683,19 +690,8 @@ static int pidff_upload_effect(struct input_dev *dev, struct ff_effect *effect,
|
|||||||
if (!old || pidff_needs_set_periodic(effect, old))
|
if (!old || pidff_needs_set_periodic(effect, old))
|
||||||
pidff_set_periodic_report(pidff, effect);
|
pidff_set_periodic_report(pidff, effect);
|
||||||
|
|
||||||
if (pidff->quirks & PIDFF_QUIRK_FIX_PERIODIC_ENVELOPE)
|
if (pidff_needs_set_envelope(&effect->u.periodic.envelope,
|
||||||
{
|
old ? &old->u.periodic.envelope : NULL))
|
||||||
effect->u.periodic.envelope.attack_level =
|
|
||||||
effect->u.periodic.envelope.attack_level == 0
|
|
||||||
? 0x7fff : effect->u.periodic.envelope.attack_level;
|
|
||||||
|
|
||||||
effect->u.periodic.envelope.fade_level =
|
|
||||||
effect->u.periodic.envelope.fade_level == 0
|
|
||||||
? 0x7fff : effect->u.periodic.envelope.fade_level;
|
|
||||||
}
|
|
||||||
if (!old ||
|
|
||||||
pidff_needs_set_envelope(&effect->u.periodic.envelope,
|
|
||||||
&old->u.periodic.envelope))
|
|
||||||
pidff_set_envelope_report(pidff,
|
pidff_set_envelope_report(pidff,
|
||||||
&effect->u.periodic.envelope);
|
&effect->u.periodic.envelope);
|
||||||
break;
|
break;
|
||||||
@@ -711,9 +707,9 @@ static int pidff_upload_effect(struct input_dev *dev, struct ff_effect *effect,
|
|||||||
pidff_set_effect_report(pidff, effect);
|
pidff_set_effect_report(pidff, effect);
|
||||||
if (!old || pidff_needs_set_ramp(effect, old))
|
if (!old || pidff_needs_set_ramp(effect, old))
|
||||||
pidff_set_ramp_force_report(pidff, effect);
|
pidff_set_ramp_force_report(pidff, effect);
|
||||||
if (!old ||
|
|
||||||
pidff_needs_set_envelope(&effect->u.ramp.envelope,
|
if (pidff_needs_set_envelope(&effect->u.ramp.envelope,
|
||||||
&old->u.ramp.envelope))
|
old ? &old->u.periodic.envelope : NULL))
|
||||||
pidff_set_envelope_report(pidff,
|
pidff_set_envelope_report(pidff,
|
||||||
&effect->u.ramp.envelope);
|
&effect->u.ramp.envelope);
|
||||||
break;
|
break;
|
||||||
|
|||||||
14
hid-pidff.h
14
hid-pidff.h
@@ -4,21 +4,15 @@
|
|||||||
|
|
||||||
/* PIDFF Quirks to solve issues with certain devices */
|
/* PIDFF Quirks to solve issues with certain devices */
|
||||||
|
|
||||||
/*
|
|
||||||
* Always set a value > 0 for PERIODIC envelope attack and fade level
|
|
||||||
*/
|
|
||||||
#define PIDFF_QUIRK_FIX_PERIODIC_ENVELOPE BIT(0)
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Ignore direction and always set 16384 (0x4000)
|
* Ignore direction and always set 16384 (0x4000)
|
||||||
*/
|
*/
|
||||||
#define PIDFF_QUIRK_FIX_WHEEL_DIRECTION BIT(1)
|
#define PIDFF_QUIRK_FIX_WHEEL_DIRECTION BIT(0)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Skip initialization of 0xA7 descriptor (Delay effect)
|
* Skip initialization of 0xA7 descriptor (Delay effect)
|
||||||
*/
|
*/
|
||||||
#define PIDFF_QUIRK_NO_DELAY_EFFECT BIT(2)
|
#define PIDFF_QUIRK_NO_DELAY_EFFECT BIT(1)
|
||||||
|
|
||||||
|
|
||||||
int hid_pidff_init_quirks(struct hid_device *hid, const struct hid_device_id *id);
|
int hid_pidff_init_quirks(struct hid_device *hid, const struct hid_device_id *id);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user