summaryrefslogtreecommitdiff
path: root/app-misc/ckb/files
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2019-05-18 00:10:51 +0100
committerV3n3RiX <venerix@redcorelinux.org>2019-05-18 00:10:51 +0100
commiteccb70a7f91b2d22582587f26d1a28bb31408b45 (patch)
tree3223e1fd54201bcf4ebecac6fbe87361cbe643e2 /app-misc/ckb/files
parenta2810985afabcc31d3eace5e61d8ea25b852ba17 (diff)
gentoo resync : 18.05.2019
Diffstat (limited to 'app-misc/ckb/files')
-rw-r--r--app-misc/ckb/files/ckb-0.4.0-modprobe.patch72
1 files changed, 72 insertions, 0 deletions
diff --git a/app-misc/ckb/files/ckb-0.4.0-modprobe.patch b/app-misc/ckb/files/ckb-0.4.0-modprobe.patch
new file mode 100644
index 000000000000..31dc3303b328
--- /dev/null
+++ b/app-misc/ckb/files/ckb-0.4.0-modprobe.patch
@@ -0,0 +1,72 @@
+---
+ src/daemon/input_linux.c | 21 ++++++++++++++-------
+ src/gui/mainwindow.cpp | 14 ++++++++------
+ 2 files changed, 22 insertions(+), 13 deletions(-)
+
+diff --git a/src/daemon/input_linux.c b/src/daemon/input_linux.c
+index 0391243e..8489f5b5 100644
+--- a/src/daemon/input_linux.c
++++ b/src/daemon/input_linux.c
+@@ -55,13 +55,20 @@ int uinputopen(struct uinput_user_dev* indev, int mouse){
+ ///
+ /// Some tips on using [uinput_user_dev in](http://thiemonge.org/getting-started-with-uinput)
+ int os_inputopen(usbdevice* kb){
+- /// First check whether the uinput module is loaded by the kernel.
+- ///
+- // Load the uinput module (if it's not loaded already)
+- if(system("modprobe uinput") != 0) {
+- ckb_fatal("Failed to load uinput module\n");
+- return 1;
++ /// Let's see if uinput is already available
++ int fd = open("/dev/uinput", O_RDWR);
++ if(fd < 0){
++ fd = open("/dev/input/uinput", O_RDWR);
++ }
++
++ // If not available, load the module
++ if(fd < 0){
++ if(system("modprobe uinput") != 0) {
++ ckb_fatal("Failed to load uinput module\n");
++ return 1;
++ }
+ }
++ close(fd);
+
+ if(IS_SINGLE_EP(kb)) {
+ kb->uinput_kb = 0;
+@@ -79,7 +86,7 @@ int os_inputopen(usbdevice* kb){
+ indev.id.product = kb->product;
+ indev.id.version = kb->fwversion;
+ // Open keyboard
+- int fd = uinputopen(&indev, 0);
++ fd = uinputopen(&indev, 0);
+ kb->uinput_kb = fd;
+ if(fd <= 0)
+ return 0;
+diff --git a/src/gui/mainwindow.cpp b/src/gui/mainwindow.cpp
+index 968764e7..1eb95bda 100644
+--- a/src/gui/mainwindow.cpp
++++ b/src/gui/mainwindow.cpp
+@@ -282,14 +282,16 @@ void MainWindow::updateVersion(){
+ if(kextstatOut.isEmpty())
+ daemonWarning.append(tr("<br /><b>Warning:</b> System Extension by \"Fumihiko Takayama\" is not allowed in Security & Privacy. Please allow it and then unplug and replug your devices."));
+ #elif defined(Q_OS_LINUX)
+- QProcess modprobe;
+- modprobe.start("modprobe", QStringList("uinput"));
++ if(!(QFileInfo("/dev/uinput").exists() || QFileInfo("/dev/input/uinput").exists())){
++ QProcess modprobe;
++ modprobe.start("modprobe", QStringList("uinput"));
+
+- if(!modprobe.waitForFinished())
+- qDebug() << "Modprobe error";
++ if(!modprobe.waitForFinished())
++ qDebug() << "Modprobe error";
+
+- if(modprobe.exitCode())
+- daemonWarning.append(tr("<br /><b>Warning:</b> The uinput module could not be loaded. If this issue persists after rebooting, compile a kernel with CONFIG_INPUT_UINPUT=y."));
++ if(modprobe.exitCode())
++ daemonWarning.append(tr("<br /><b>Warning:</b> The uinput module could not be loaded. If this issue persists after rebooting, compile a kernel with CONFIG_INPUT_UINPUT=y."));
++ }
+ #endif
+ settingsWidget->setStatus(tr("No devices connected") + daemonWarning);
+ }