Last active
February 26, 2018 19:41
-
-
Save ephemient/f4959799377e0dde0724fdf366152013 to your computer and use it in GitHub Desktop.
hid-apple-dkms
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| pkgbase = hid-apple-dkms | |
| pkgdesc = hid_apple.ko patched | |
| pkgver = 4.15.5 | |
| pkgrel = 1 | |
| url = https://www.kernel.org/ | |
| arch = x86_64 | |
| license = GPL2 | |
| depends = dkms | |
| source = https://www.kernel.org/pub/linux/kernel/v4.x/linux-4.15.tar.xz | |
| source = https://www.kernel.org/pub/linux/kernel/v4.x/linux-4.15.tar.sign | |
| source = https://www.kernel.org/pub/linux/kernel/v4.x/patch-4.15.5.xz | |
| source = https://www.kernel.org/pub/linux/kernel/v4.x/patch-4.15.5.sign | |
| source = hid-apple-scancodes.patch | |
| source = Makefile | |
| source = dkms.conf | |
| validpgpkeys = ABAF11C65A2970B130ABE3C479BE3E4300411886 | |
| validpgpkeys = 647F28654894E3BD457199BE38DBBDC86092693E | |
| sha256sums = 5a26478906d5005f4f809402e981518d2b8844949199f60c4b6e1f986ca2a769 | |
| sha256sums = SKIP | |
| sha256sums = b5dc7021bd0c08e4a58b59035f9b757ce6909b46067950ac56d2ad68c1b69dd1 | |
| sha256sums = SKIP | |
| sha256sums = aa7d48ab459a3cd961846d34a78e0d2e2b943ca45212f3104532973822c2f862 | |
| sha256sums = 9e5ce2c5e75673f72753e6f981d07933464bd77ab0acb93266f028d08b2b5ef8 | |
| sha256sums = d03a6dbe8ebe1939b0ea7950006c92fdf645821f67563b8377efd55bdd925d9f | |
| pkgname = hid-apple-dkms | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| PACKAGE_NAME="@_PKGBASE@" | |
| PACKAGE_VERSION="@PKGVER@" | |
| AUTOINSTALL="yes" | |
| BUILT_MODULE_NAME[0]="hid-apple" | |
| MAKE[0]="make KDIR=/usr/lib/modules/$kernelver/build" | |
| DEST_MODULE_LOCATION[0]="/updates/drivers/hid" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- a/drivers/hid/hid-apple.c 2017-03-04 01:34:38.655588991 -0500 | |
| +++ b/drivers/hid/hid-apple.c 2017-03-04 01:47:08.082599141 -0500 | |
| @@ -177,6 +177,15 @@ | |
| return NULL; | |
| } | |
| +static void input_event_with_scancode(struct input_dev *input, | |
| + __u8 type, __u16 code, unsigned int hid, __s32 value) | |
| +{ | |
| + if (type == EV_KEY && | |
| + (!test_bit(code, input->key)) == value) | |
| + input_event(input, EV_MSC, MSC_SCAN, hid); | |
| + input_event(input, type, code, value); | |
| +} | |
| + | |
| static int hidinput_apple_event(struct hid_device *hid, struct input_dev *input, | |
| struct hid_usage *usage, __s32 value) | |
| { | |
| @@ -185,7 +194,8 @@ | |
| if (usage->code == KEY_FN) { | |
| asc->fn_on = !!value; | |
| - input_event(input, usage->type, usage->code, value); | |
| + input_event_with_scancode(input, usage->type, usage->code, | |
| + usage->hid, value); | |
| return 1; | |
| } | |
| @@ -217,8 +227,8 @@ | |
| else | |
| clear_bit(usage->code, asc->pressed_fn); | |
| - input_event(input, usage->type, trans->to, | |
| - value); | |
| + input_event_with_scancode(input, usage->type, | |
| + trans->to, usage->hid, value); | |
| return 1; | |
| } | |
| @@ -238,8 +248,8 @@ | |
| clear_bit(usage->code, | |
| asc->pressed_numlock); | |
| - input_event(input, usage->type, trans->to, | |
| - value); | |
| + input_event_with_scancode(input, usage->type, | |
| + trans->to, usage->hid, value); | |
| } | |
| return 1; | |
| @@ -250,7 +260,8 @@ | |
| if (asc->quirks & APPLE_ISO_KEYBOARD) { | |
| trans = apple_find_translation(apple_iso_keyboard, usage->code); | |
| if (trans) { | |
| - input_event(input, usage->type, trans->to, value); | |
| + input_event_with_scancode(input, usage->type, | |
| + trans->to, usage->hid, value); | |
| return 1; | |
| } | |
| } | |
| @@ -259,7 +270,8 @@ | |
| if (swap_opt_cmd) { | |
| trans = apple_find_translation(swapped_option_cmd_keys, usage->code); | |
| if (trans) { | |
| - input_event(input, usage->type, trans->to, value); | |
| + input_event_with_scancode(input, usage->type, | |
| + trans->to, usage->hid, value); | |
| return 1; | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| obj-m := hid-apple.o | |
| KVERSION := $(KERNELRELEASE) | |
| ifeq ($(origin KERNELRELEASE), undefined) | |
| KVERSION := $(shell uname -r) | |
| endif | |
| KDIR := /lib/modules/$(KVERSION)/build | |
| PWD := $(shell pwd) | |
| all: | |
| $(MAKE) -C $(KDIR) M=$(PWD) modules | |
| clean: | |
| $(MAKE) -C $(KDIR) M=$(PWD) clean | |
| install: | |
| $(MAKE) -C $(KDIR) M=$(PWD) modules_install | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| _pkgbase=hid-apple | |
| pkgname=(${_pkgbase}-dkms) | |
| _srcname=linux-4.15 | |
| pkgver=4.15.5 | |
| pkgrel=1 | |
| pkgdesc="hid_apple.ko patched" | |
| arch=('x86_64') | |
| url="https://www.kernel.org/" | |
| license=('GPL2') | |
| groups=('') | |
| depends=('dkms') | |
| optdepends=() | |
| source=("https://www.kernel.org/pub/linux/kernel/v4.x/${_srcname}.tar.xz" | |
| "https://www.kernel.org/pub/linux/kernel/v4.x/${_srcname}.tar.sign" | |
| "https://www.kernel.org/pub/linux/kernel/v4.x/patch-${pkgver}.xz" | |
| "https://www.kernel.org/pub/linux/kernel/v4.x/patch-${pkgver}.sign" | |
| 'hid-apple-scancodes.patch' | |
| 'Makefile' | |
| 'dkms.conf') | |
| sha256sums=('5a26478906d5005f4f809402e981518d2b8844949199f60c4b6e1f986ca2a769' | |
| 'SKIP' | |
| 'b5dc7021bd0c08e4a58b59035f9b757ce6909b46067950ac56d2ad68c1b69dd1' | |
| 'SKIP' | |
| 'aa7d48ab459a3cd961846d34a78e0d2e2b943ca45212f3104532973822c2f862' | |
| '9e5ce2c5e75673f72753e6f981d07933464bd77ab0acb93266f028d08b2b5ef8' | |
| 'd03a6dbe8ebe1939b0ea7950006c92fdf645821f67563b8377efd55bdd925d9f') | |
| validpgpkeys=('ABAF11C65A2970B130ABE3C479BE3E4300411886' # Linus Torvalds | |
| '647F28654894E3BD457199BE38DBBDC86092693E' # Greg Kroah-Hartman | |
| ) | |
| prepare() { | |
| cd "${srcdir}/${_srcname}" | |
| patch -Np1 -i "${srcdir}/patch-${pkgver}" | |
| patch -Np1 -i "${srcdir}/hid-apple-scancodes.patch" | |
| } | |
| package() { | |
| cd "${srcdir}" | |
| install -dm755 "${pkgdir}"/usr/src/${_pkgbase}-${pkgver} | |
| install -Dm644 -t "${pkgdir}/usr/src/${_pkgbase}-${pkgver}" \ | |
| "${_srcname}/drivers/hid/hid-ids.h" \ | |
| "${_srcname}/drivers/hid/hid-apple.c" \ | |
| Makefile dkms.conf | |
| sed -e "s/@_PKGBASE@/${_pkgbase}/" \ | |
| -e "s/@PKGVER@/${pkgver}/" \ | |
| -i "${pkgdir}"/usr/src/${_pkgbase}-${pkgver}/dkms.conf | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment