diff options
author | Scott Shumate | 2020-05-16 21:41:06 -0500 |
---|---|---|
committer | Scott Shumate | 2020-05-16 21:41:06 -0500 |
commit | 6fb1e3de0e09ea4a21643890aea738f6689ede27 (patch) | |
tree | c15ac36b7392c37dc6c1cd695290c33159f8fb5e | |
download | aur-hid-sony-ds3usb-dkms.tar.gz |
Initial commit
-rw-r--r-- | .SRCINFO | 23 | ||||
-rw-r--r-- | .gitignore | 5 | ||||
-rw-r--r-- | Makefile | 7 | ||||
-rw-r--r-- | PKGBUILD | 48 | ||||
-rw-r--r-- | hid-sony-blacklist.modprobe | 1 | ||||
-rw-r--r-- | hid-sony-ds3usb-dkms.dkms | 7 | ||||
-rw-r--r-- | hid-sony-ds3usb.patch | 37 |
7 files changed, 128 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..3c4c7aa39916 --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,23 @@ +pkgbase = hid-sony-ds3usb-dkms + pkgdesc = The hid_sony kernel module with a patch to fix buttons on Sony DualShock 3 USB adapters + pkgver = 5.6.13 + pkgrel = 1 + url = https://www.spinics.net/lists/linux-input/msg67472.html + arch = x86_64 + license = GPL2 + depends = dkms + source = hid-sony.c::https://git.archlinux.org/linux.git/plain/drivers/hid/hid-sony.c?h=v5.6.13-arch1 + source = hid-ids.h::https://git.archlinux.org/linux.git/plain/drivers/hid/hid-ids.h?h=v5.6.13-arch1 + source = Makefile + source = hid-sony-ds3usb.patch + source = hid-sony-ds3usb-dkms.dkms + source = hid-sony-blacklist.modprobe + sha256sums = 509b6d7d4fc33fdaa4efd971de93965e6864f50dc6fb8aa89ae67a36f75fc845 + sha256sums = 162932261317e712cc344f5947af96c0bdff33adacade895e2e694df87330121 + sha256sums = 96cab0ae36a9d7a8ab01aa7d5a20890981f7f5836328b1d35eaf54ec6bb6b208 + sha256sums = 089fbfb629f77cbe71bf424ce79e59dd3c851ca90404935d5983608f26eede12 + sha256sums = 04a25acef8059630188ebbf398115c87bf27f97a8e37ce9a10d1d30387800610 + sha256sums = f4ab0b6941e353e861007a0bb6c468b4a7d027c56d530056fa686ad837616635 + +pkgname = hid-sony-ds3usb-dkms + diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000000..a01814dc0fa1 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +src +pkg +hid-sony.c +hid-ids.h +hid-sony-ds3usb-dkms-*.pkg.tar.xz diff --git a/Makefile b/Makefile new file mode 100644 index 000000000000..2f35086cf415 --- /dev/null +++ b/Makefile @@ -0,0 +1,7 @@ +obj-m = hid-sony-ds3usb.o + +KVERSION = $(shell uname -r) +all: + make -C /lib/modules/$(KVERSION)/build V=1 M=$(PWD) modules +clean: + test ! -d /lib/modules/$(KVERSION) || make -C /lib/modules/$(KVERSION)/build V=1 M=$(PWD) clean diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..17556357a0e6 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,48 @@ +# Maintainer: Scott Shumate <scott(at)shumatech(dot)com> + +_pkgbase='hid-sony-ds3usb' +pkgname=${_pkgbase}-dkms +pkgver=5.6.13 +pkgrel=1 +pkgdesc="The hid_sony kernel module with a patch to fix buttons on Sony DualShock 3 USB adapters" +_srctag=v${pkgver}-arch1 +url='https://www.spinics.net/lists/linux-input/msg67472.html' +license=('GPL2') +arch=('x86_64') +depends=('dkms') +source=("hid-sony.c::https://git.archlinux.org/linux.git/plain/drivers/hid/hid-sony.c?h=${_srctag}" + "hid-ids.h::https://git.archlinux.org/linux.git/plain/drivers/hid/hid-ids.h?h=${_srctag}" + "Makefile" + "hid-sony-ds3usb.patch" + "hid-sony-ds3usb-dkms.dkms" + "hid-sony-blacklist.modprobe") +sha256sums=('509b6d7d4fc33fdaa4efd971de93965e6864f50dc6fb8aa89ae67a36f75fc845' + '162932261317e712cc344f5947af96c0bdff33adacade895e2e694df87330121' + '96cab0ae36a9d7a8ab01aa7d5a20890981f7f5836328b1d35eaf54ec6bb6b208' + '089fbfb629f77cbe71bf424ce79e59dd3c851ca90404935d5983608f26eede12' + '04a25acef8059630188ebbf398115c87bf27f97a8e37ce9a10d1d30387800610' + 'f4ab0b6941e353e861007a0bb6c468b4a7d027c56d530056fa686ad837616635') + +prepare(){ + local workdir="${srcdir}/workdir" + mkdir -p "${workdir}" + cp "${srcdir}/hid-sony.c" "${workdir}" + patch -d "${workdir}" -Np3 -i "${srcdir}/hid-sony-ds3usb.patch" +} + +package() { + local dest="${pkgdir}/usr/src/${_pkgbase}-${pkgver}" + install -d "${dest}" + install -m 644 -T "${srcdir}/workdir/hid-sony.c" "${dest}/${_pkgbase}.c" + install -m 644 -T "${srcdir}/hid-ids.h" "${dest}/hid-ids.h" + install -m 644 -T "${srcdir}/Makefile" "${dest}/Makefile" + install -m 644 -T "${srcdir}/hid-sony-ds3usb-dkms.dkms" "${dest}/dkms.conf" + + sed -e "s/@_PKGBASE@/${_pkgbase}/" \ + -e "s/@PKGVER@/${pkgver}/" \ + -i "${pkgdir}/usr/src/${_pkgbase}-${pkgver}/dkms.conf" + + # Blacklist the original hid_sony module + install -dm755 "${pkgdir}/usr/lib/modprobe.d" + install -Dm644 "${srcdir}/hid-sony-blacklist.modprobe" "${pkgdir}/usr/lib/modprobe.d/hid-sony-blacklist.conf" +} diff --git a/hid-sony-blacklist.modprobe b/hid-sony-blacklist.modprobe new file mode 100644 index 000000000000..e6910aafcbbd --- /dev/null +++ b/hid-sony-blacklist.modprobe @@ -0,0 +1 @@ +blacklist hid_sony diff --git a/hid-sony-ds3usb-dkms.dkms b/hid-sony-ds3usb-dkms.dkms new file mode 100644 index 000000000000..8abb6f27d87d --- /dev/null +++ b/hid-sony-ds3usb-dkms.dkms @@ -0,0 +1,7 @@ +PACKAGE_NAME="@_PKGBASE@" +PACKAGE_VERSION="@PKGVER@" +MAKE[0]="make KVERSION=$kernelver" +CLEAN="make clean" +BUILT_MODULE_NAME[0]="@_PKGBASE@" +DEST_MODULE_LOCATION[0]="/kernel/drivers/hid" +AUTOINSTALL="yes" diff --git a/hid-sony-ds3usb.patch b/hid-sony-ds3usb.patch new file mode 100644 index 000000000000..76371dc5b6ea --- /dev/null +++ b/hid-sony-ds3usb.patch @@ -0,0 +1,37 @@ +diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c +index 4c6ed6ef31f1..50c1d9cc6dab 100644 +--- a/drivers/hid/hid-sony.c ++++ b/drivers/hid/hid-sony.c +@@ -867,6 +867,23 @@ static u8 *sony_report_fixup(struct hid_device *hdev, u8 *rdesc, + if (sc->quirks & PS3REMOTE) + return ps3remote_fixup(hdev, rdesc, rsize); + ++ /* ++ * Some knock-off USB dongles incorrectly report their button count ++ * as 13 instead of 16 causing three non-functional buttons. ++ */ ++ if ((sc->quirks & SIXAXIS_CONTROLLER_USB) && *rsize >= 45 && ++ /* Report Count (13) */ ++ rdesc[23] == 0x95 && rdesc[24] == 0x0D && ++ /* Usage Maximum (13) */ ++ rdesc[37] == 0x29 && rdesc[38] == 0x0D && ++ /* Report Count (3) */ ++ rdesc[43] == 0x95 && rdesc[44] == 0x03) { ++ hid_info(hdev, "Fixing up USB dongle report descriptor\n"); ++ rdesc[24] = 0x10; ++ rdesc[38] = 0x10; ++ rdesc[44] = 0x00; ++ } ++ + return rdesc; + } + +@@ -3008,7 +3025,7 @@ static const struct hid_device_id sony_devices[] = { + MODULE_DEVICE_TABLE(hid, sony_devices); + + static struct hid_driver sony_driver = { +- .name = "sony", ++ .name = "sony-ds3usb", + .id_table = sony_devices, + .input_mapping = sony_mapping, + .input_configured = sony_input_configured, |