donniebreve / touchcursor-linux

TouchCursor style keyboard remapping for Linux.
GNU General Public License v2.0
133 stars 28 forks source link

Won't find Keyboard if it has a : in the name #24

Closed robinxan closed 4 years ago

robinxan commented 4 years ago

Hi, touchcursor won't find my Keyboard.

I: Bus=0003 Vendor=1b1c Product=1b11 Version=0308
N: Name="ckb1: Corsair K95 RGB Gaming Keyboard vKB"
P: Phys=
S: Sysfs=/devices/virtual/input/input35
U: Uniq=
H: Handlers=sysrq kbd event20 rfkill leds 
B: PROP=0
B: EV=120003

If i comment out the following it works fine.

diff --git a/src/config.c b/src/config.c
index a7487ef..27fb369 100644
--- a/src/config.c
+++ b/src/config.c
@@ -54,14 +54,14 @@ void findDeviceEvent(char* deviceConfigValue)

     char* deviceName = deviceConfigValue;
     int deviceNumber = 1;
-    if (strstr(deviceConfigValue, ":"))
-    {
-        char* tokens = deviceConfigValue;
-        char* token = strsep(&tokens, ":");
-        deviceName = token;
-        token = strsep(&tokens, ":");
-        deviceNumber = atoi(token);
-    }
+    // if (strstr(deviceConfigValue, ":"))
+    // {
+    //     char* tokens = deviceConfigValue;
+    //     char* token = strsep(&tokens, ":");
+    //     deviceName = token;
+    //     token = strsep(&tokens, ":");
+    //     deviceNumber = atoi(token);
+    // }

     char* devicesFilePath = "/proc/bus/input/devices";
     FILE* devicesFile = fopen(devicesFilePath, "r");

Probably needs some form of escaping or another symbol for skipping devices.

donniebreve commented 4 years ago

This should be fixed. If you are able, please pull down the latest version and confirm. Thanks!

robinxan commented 4 years ago

Yes works out of the box now. Thanks!