Package: spacenavd Version: 0.6-2 Severity: important Tags: patch Dear Maintainer,
running spacenavd from Debian did not grab my SpacePilot (046d:c625 Logitech, Inc. 3Dconnexion Space Pilot 3D Mouse). The problem was fixed upstream some time ago in trunk (svn commit 183/184). While at it backport all other fixes from trunk. Regards Benedikt Spranger -- System Information: Debian Release: buster/sid APT prefers unstable APT policy: (500, 'unstable') Architecture: amd64 (x86_64) Foreign Architectures: i386, arm64 Kernel: Linux 4.14.0-3-amd64 (SMP w/4 CPU cores) Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8), LANGUAGE=de_DE.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Init: sysvinit (via /sbin/init) LSM: AppArmor: enabled Versions of packages spacenavd depends on: ii libc6 2.26-6 ii libx11-6 2:1.6.4-3 ii lsb-base 9.20170808 spacenavd recommends no packages. spacenavd suggests no packages. -- no debconf information From 81c85dfd87f5e3dc02827f1ee9af581e4437195c Mon Sep 17 00:00:00 2001 From: Benedikt Spranger <b.spran...@linutronix.de> Date: Mon, 26 Feb 2018 15:53:27 +0100 Subject: [PATCH] Get all fixes from trunk Signed-off-by: Benedikt Spranger <b.spran...@linutronix.de> --- .../Better-example-spnavrc-descriptions.patch | 136 +++++++++++++++ ...he-missing-options-to-the-example-spnavrc.patch | 125 ++++++++++++++ ...to-skip-joystick-device-files-while-parsi.patch | 37 ++++ ...to-match-devices-with-the-new-3Dconnexion.patch | 42 +++++ ...ll-bug-in-device-detection-which-sometime.patch | 27 +++ ...-axis-remapping-before-checking-deadzones.patch | 91 ++++++++++ debian/patches/possible-fix-for-bug-9.patch | 28 +++ debian/patches/series | 8 + .../trying-to-remove-devices-from-Xinput.patch | 189 +++++++++++++++++++++ 9 files changed, 683 insertions(+) create mode 100644 debian/patches/Better-example-spnavrc-descriptions.patch create mode 100644 debian/patches/added-all-the-missing-options-to-the-example-spnavrc.patch create mode 100644 debian/patches/added-code-to-skip-joystick-device-files-while-parsi.patch create mode 100644 debian/patches/added-rule-to-match-devices-with-the-new-3Dconnexion.patch create mode 100644 debian/patches/fixed-a-small-bug-in-device-detection-which-sometime.patch create mode 100644 debian/patches/moved-axis-remapping-before-checking-deadzones.patch create mode 100644 debian/patches/possible-fix-for-bug-9.patch create mode 100644 debian/patches/trying-to-remove-devices-from-Xinput.patch diff --git a/debian/patches/Better-example-spnavrc-descriptions.patch b/debian/patches/Better-example-spnavrc-descriptions.patch new file mode 100644 index 0000000..abf2aee --- /dev/null +++ b/debian/patches/Better-example-spnavrc-descriptions.patch @@ -0,0 +1,136 @@ +From 984d45aa95833c5af5108ff50536be2787412f4d Mon Sep 17 00:00:00 2001 +From: jtsiomb <jtsiomb@ef983eb1-d774-4af8-acfd-baaf7b16a646> +Date: Thu, 12 Feb 2015 16:07:47 +0000 +Subject: [PATCH 10/14] - Better example-spnavrc descriptions - remove some + debugging printfs which where commited accidentally previously + +git-svn-id: svn://svn.code.sf.net/p/spacenav/code@189 ef983eb1-d774-4af8-acfd-baaf7b16a646 +--- + trunk/spacenavd/doc/example-spnavrc | 18 ++++++++++++++---- + trunk/spacenavd/src/cfgfile.c | 3 +-- + trunk/spacenavd/src/dev_usb_linux.c | 8 ++++---- + trunk/spacenavd/src/event.c | 8 +------- + 4 files changed, 20 insertions(+), 17 deletions(-) + +diff --git a/trunk/spacenavd/doc/example-spnavrc b/trunk/spacenavd/doc/example-spnavrc +index bbb87da..0f33b2c 100644 +--- a/doc/example-spnavrc ++++ b/doc/example-spnavrc +@@ -92,23 +92,33 @@ + + + # Device grab (USB) ++# + # When set to true (default): grab the USB device to prevent other programs + # (such as the X server) from also using it. + # ++# Grabbing the device ensures that other programs won't be able to use it without ++# talking to spacenavd. For instance some versions of Xorg will use the device to move ++# the mouse pointer if we don't grab it. ++# Set this to false if you want to use programs that try to talk to the device directly ++# such as google earth, then follow FAQ 11 http://spacenav.sourceforge.net/faq.html#faq11 ++# to force the X server to ignore the device ++# + #grab = true + + +-# Custom USB device +-# List of additional devices to use ++# List of additional USB devices to use (multiple devices can be listed) ++# + # example: + # device-id = 046d:c625 + + + # Repeat interval (milliseconds) +-# How often should spacenavd repeat the last event while out of the deadzone? ++# Non-deadzone events are repeated every so many milliseconds (-1 to disable). ++# + # You probably don't need this setting. Set it to something like 250 if you + # find that your apps stop moving the view while you hold the puck/ball at a + # fixed off-center position (like bottomed out on the vertical axis). +-# Set to -1 to disable it (default). ++# Might cause inadvertent continuous motion if the deadzone is too small for ++# the re-centering power of the device. + # + #repeat-interval = -1 +diff --git a/trunk/spacenavd/src/cfgfile.c b/trunk/spacenavd/src/cfgfile.c +index 75cb45a..4f6dbfe 100644 +--- a/src/cfgfile.c ++++ b/src/cfgfile.c +@@ -452,8 +452,7 @@ int write_cfg(const char *fname, struct cfg *cfg) + fprintf(fp, "#serial = /dev/ttyS0\n"); + } + +- fprintf(fp, "# custom list USB device ids to open if present\n"); +- fprintf(fp, "# (multiple entries can be listed)\n"); ++ fprintf(fp, "List of additional USB devices to use (multiple devices can be listed)"); + for(i=0; i<MAX_CUSTOM; i++) { + if(cfg->devid[i][0] != -1 && cfg->devid[i][1] != -1) { + fprintf(fp, "device-id = %x:%x\n", cfg->devid[i][0], cfg->devid[i][1]); +diff --git a/trunk/spacenavd/src/dev_usb_linux.c b/trunk/spacenavd/src/dev_usb_linux.c +index dfa4420..e52b2ac 100644 +--- a/src/dev_usb_linux.c ++++ b/src/dev_usb_linux.c +@@ -207,14 +207,14 @@ static int read_evdev(struct device *dev, struct dev_input *inp) + inp->type = INP_MOTION; + inp->idx = iev.code - REL_X; + inp->val = iev.value; +- printf("[%s] EV_REL(%d): %d\n", dev->name, inp->idx, iev.value); ++ /*printf("[%s] EV_REL(%d): %d\n", dev->name, inp->idx, iev.value);*/ + break; + + case EV_ABS: + inp->type = INP_MOTION; + inp->idx = iev.code - ABS_X; + inp->val = map_range(dev, inp->idx, iev.value); +- printf("[%s] EV_ABS(%d): %d (orig: %d)\n", dev->name, inp->idx, inp->val, iev.value); ++ /*printf("[%s] EV_ABS(%d): %d (orig: %d)\n", dev->name, inp->idx, inp->val, iev.value);*/ + break; + + case EV_KEY: +@@ -225,12 +225,12 @@ static int read_evdev(struct device *dev, struct dev_input *inp) + + case EV_SYN: + inp->type = INP_FLUSH; +- printf("[%s] EV_SYN\n", dev->name); ++ /*printf("[%s] EV_SYN\n", dev->name);*/ + break; + + default: + if(verbose) { +- printf("unexpected event: %d\n", iev.type); ++ printf("unhandled event: %d\n", iev.type); + } + return -1; + } +diff --git a/trunk/spacenavd/src/event.c b/trunk/spacenavd/src/event.c +index 27cebe5..5812779 100644 +--- a/src/event.c ++++ b/src/event.c +@@ -132,7 +132,6 @@ void process_input(struct device *dev, struct dev_input *inp) + inp->idx = cfg.map_axis[inp->idx]; + + if(abs(inp->val) < cfg.dead_threshold[inp->idx] ) { +- printf("clamping axis %d event with value %d in deadzone\n", inp->idx, inp->val); + inp->val = 0; + } + sign = cfg.invert[inp->idx] ? -1 : 1; +@@ -212,13 +211,8 @@ int in_deadzone(struct device *dev) + if((dev_ev = device_event_in_use(dev)) == NULL) + return -1; + for(i=0; i<6; i++) { +- int val = dev_ev->event.motion.data[i]; +- if(val != 0) { +- if(abs(val) < cfg.dead_threshold[i]) { +- printf("BUG %d on axis %d not in deadzone? (%d)\n", dev_ev->event.motion.data[i], i, cfg.dead_threshold[i]); +- } ++ if(dev_ev->event.motion.data[i] != 0) + return 0; +- } + } + return 1; + } +-- +2.16.1 + diff --git a/debian/patches/added-all-the-missing-options-to-the-example-spnavrc.patch b/debian/patches/added-all-the-missing-options-to-the-example-spnavrc.patch new file mode 100644 index 0000000..9cc5954 --- /dev/null +++ b/debian/patches/added-all-the-missing-options-to-the-example-spnavrc.patch @@ -0,0 +1,125 @@ +From 1d7f47640c3c09d4a2f5b6024c4742603c0283b4 Mon Sep 17 00:00:00 2001 +From: jtsiomb <jtsiomb@ef983eb1-d774-4af8-acfd-baaf7b16a646> +Date: Thu, 12 Feb 2015 02:19:25 +0000 +Subject: [PATCH 07/14] added all the missing options to the example-spnavrc + file + +git-svn-id: svn://svn.code.sf.net/p/spacenav/code@186 ef983eb1-d774-4af8-acfd-baaf7b16a646 +--- + trunk/spacenavd/doc/example-spnavrc | 73 ++++++++++++++++++++++++++++++++++++- + 1 file changed, 72 insertions(+), 1 deletion(-) + +diff --git a/trunk/spacenavd/doc/example-spnavrc b/trunk/spacenavd/doc/example-spnavrc +index 964b343..ca8e598 100644 +--- a/doc/example-spnavrc ++++ b/doc/example-spnavrc +@@ -9,34 +9,105 @@ + + + # Sensitivity is multiplied with every motion (1.0 normal). ++# + #sensitivity = 1.0 + +- + # Separate sensitivity for rotation and translation. ++# + #sensitivity-translation = 1.0 + #sensitivity-rotation = 1.0 + ++# Separate sensitivity for each roation and translation axis. ++# ++#sensitivity-translation-x = 1.0 ++#sensitivity-translation-y = 1.0 ++#sensitivity-translation-z = 1.0 ++#sensitivity-rotation-x = 1.0 ++#sensitivity-rotation-y = 1.0 ++#sensitivity-rotation-z = 1.0 ++ + + # Dead zone; any motion less than this number is discarded as noise. ++# + #dead-zone = 2 + ++# Separate dead-zone for each rotation and translation axis. ++# ++#dead-zone-translation-x = 2 ++#dead-zone-translation-y = 2 ++#dead-zone-translation-z = 2 ++#dead-zone-rotation-x = 2 ++#dead-zone-rotation-y = 2 ++#dead-zone-rotation-z = 2 ++ + + # Selectively invert translation and rotation axes. Valid values are + # combinations of the letters x, y, and z. ++# + #invert-rot = yz + #invert-trans = yz + + + # Swap Y and Z axes ++# + #swap-yz = false + + ++# Axis remapping (zero-based) ++# ++#axismap0 = 0 ++#axismap1 = 1 ++#... ++#axismapN = N (N < 64) ++ ++ ++# Button remapping (zero-based) ++# ++#bnmap0 = 0 ++#bnmap1 = 1 ++#... ++#bnmapN = N (N < 64) ++ ++ ++# Map buttons to keyboard keys (experimental) ++# By default no such mappings are active. Use the following syntax: ++# kbmapN = <keysym> ++# where N is the button number (zero-based), and <keysym> is a keysym name from ++# /usr/include/X11/keysymdef.h, without the leading XK_ ++# Example: ++# kbmap0 = Escape ++ ++ + # Serial device + # Set this only if you have a serial device, and make sure you specify the + # correct device file. If you do set this option, any USB devices will be + # ignored! ++# + #serial = /dev/ttyS0 + + + # Enable/disable LED light (for devices that have one). ++# + #led = on ++ ++ ++# Device grab (USB) ++# When set to true (default): grab the USB device to prevent other programs ++# (such as the X server) from also using it. ++# ++#grab = true ++ ++ ++# Custom USB device ++# List of additional devices to use ++# example: ++# device-id = 046d:c625 ++ ++ ++# Repeat interval (milliseconds) ++# How often should spacenavd repeat the last event while out of the deadzone? ++# You probably don't need this setting. Set it to something like 250 if you ++# find that your apps stop moving the view while you hold the puck/ball at a ++# fixed off-center position (like bottomed out on the vertical axis). ++# ++#repeat-interval = 0 +-- +2.16.1 + diff --git a/debian/patches/added-code-to-skip-joystick-device-files-while-parsi.patch b/debian/patches/added-code-to-skip-joystick-device-files-while-parsi.patch new file mode 100644 index 0000000..aa3706e --- /dev/null +++ b/debian/patches/added-code-to-skip-joystick-device-files-while-parsi.patch @@ -0,0 +1,37 @@ +From 2826f730d9f91513e4f64a081bd77ea55cc0138c Mon Sep 17 00:00:00 2001 +From: jtsiomb <jtsiomb@ef983eb1-d774-4af8-acfd-baaf7b16a646> +Date: Sat, 11 Oct 2014 05:07:58 +0000 +Subject: [PATCH 04/14] added code to skip joystick device files while parsing + /proc/bus/input/devices + +git-svn-id: svn://svn.code.sf.net/p/spacenav/code@183 ef983eb1-d774-4af8-acfd-baaf7b16a646 +--- + trunk/spacenavd/src/dev_usb_linux.c | 9 +++++++-- + 1 file changed, 7 insertions(+), 2 deletions(-) + +diff --git a/trunk/spacenavd/src/dev_usb_linux.c b/trunk/spacenavd/src/dev_usb_linux.c +index 30db579..5f4baad 100644 +--- a/src/dev_usb_linux.c ++++ b/src/dev_usb_linux.c +@@ -342,11 +342,16 @@ struct usb_device_info *find_usb_devices(int (*match)(const struct usb_device_in + case 'H': + keyptr = strstr(cur_line, "Handlers="); + if(keyptr) { +- char *devfile, *valptr = keyptr + strlen("Handlers="); ++ char *devfile = 0, *valptr = keyptr + strlen("Handlers="); + static const char *prefix = "/dev/input/"; + + int idx = 0; +- while((devfile = strtok(idx ? 0 : valptr, " \t\v\n\r"))) { ++ while((devfile = strtok(devfile ? 0 : valptr, " \t\v\n\r"))) { ++ if(strstr(devfile, "js") == devfile) { ++ /* ignore joystick device files, can't use them */ ++ continue; ++ } ++ + if(!(devinfo.devfiles[idx] = malloc(strlen(devfile) + strlen(prefix) + 1))) { + perror("failed to allocate device filename buffer"); + continue; +-- +2.16.1 + diff --git a/debian/patches/added-rule-to-match-devices-with-the-new-3Dconnexion.patch b/debian/patches/added-rule-to-match-devices-with-the-new-3Dconnexion.patch new file mode 100644 index 0000000..9934a78 --- /dev/null +++ b/debian/patches/added-rule-to-match-devices-with-the-new-3Dconnexion.patch @@ -0,0 +1,42 @@ +From 104a4951d5b1a9aa47f94e94aa90d770c355ee22 Mon Sep 17 00:00:00 2001 +From: jtsiomb <jtsiomb@ef983eb1-d774-4af8-acfd-baaf7b16a646> +Date: Fri, 13 Mar 2015 21:14:57 +0000 +Subject: [PATCH 11/14] added rule to match devices with the new 3Dconnexion + vendor id (0x256f) + +git-svn-id: svn://svn.code.sf.net/p/spacenav/code@190 ef983eb1-d774-4af8-acfd-baaf7b16a646 +--- + trunk/spacenavd/src/dev.c | 9 ++++++++- + 1 file changed, 8 insertions(+), 1 deletion(-) + +diff --git a/trunk/spacenavd/src/dev.c b/trunk/spacenavd/src/dev.c +index 8628b25..fff501b 100644 +--- a/src/dev.c ++++ b/src/dev.c +@@ -188,6 +188,8 @@ struct device *get_devices(void) + return dev_list; + } + ++#define VENDOR_3DCONNEXION 0x256f ++ + static int devid_list[][2] = { + /* 3Dconnexion devices */ + {0x46d, 0xc603}, /* spacemouse plus XT */ +@@ -215,8 +217,13 @@ static int match_usbdev(const struct usb_device_info *devinfo) + return 1; + } + +- /* match any device in the devid_list */ + if(devinfo->vendorid != -1 && devinfo->productid != -1) { ++ /* match any device with the new 3Dconnexion device id */ ++ if(devinfo->vendorid == VENDOR_3DCONNEXION) { ++ return 1; ++ } ++ ++ /* match any device in the devid_list */ + for(i=0; devid_list[i][0] > 0; i++) { + if(devinfo->vendorid == devid_list[i][0] && devinfo->productid == devid_list[i][1]) { + return 1; +-- +2.16.1 + diff --git a/debian/patches/fixed-a-small-bug-in-device-detection-which-sometime.patch b/debian/patches/fixed-a-small-bug-in-device-detection-which-sometime.patch new file mode 100644 index 0000000..ee8a23c --- /dev/null +++ b/debian/patches/fixed-a-small-bug-in-device-detection-which-sometime.patch @@ -0,0 +1,27 @@ +From 164a6e7d496d17e0c40ee54a41a61a8231e24c28 Mon Sep 17 00:00:00 2001 +From: jtsiomb <jtsiomb@ef983eb1-d774-4af8-acfd-baaf7b16a646> +Date: Sun, 5 Apr 2015 23:23:15 +0000 +Subject: [PATCH 12/14] fixed a small bug in device detection which sometimes + skipped a single character during parsing + +git-svn-id: svn://svn.code.sf.net/p/spacenav/code@191 ef983eb1-d774-4af8-acfd-baaf7b16a646 +--- + trunk/spacenavd/src/dev_usb_linux.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/trunk/spacenavd/src/dev_usb_linux.c b/trunk/spacenavd/src/dev_usb_linux.c +index e52b2ac..4b46d5a 100644 +--- a/src/dev_usb_linux.c ++++ b/src/dev_usb_linux.c +@@ -293,7 +293,7 @@ struct usb_device_info *find_usb_devices(int (*match)(const struct usb_device_in + if(next_section == NULL) { + /* move last (partial) section to start of buf */ + /* sizeof(buf) - 1 because the last one is '\0' */ +- buf_used = (buf + sizeof(buf) - 1) - section_start; ++ buf_used = strlen(section_start); + memmove(buf, section_start, buf_used); + buf[buf_used] = '\0'; + /* point to end of last section and calc remaining space in buf */ +-- +2.16.1 + diff --git a/debian/patches/moved-axis-remapping-before-checking-deadzones.patch b/debian/patches/moved-axis-remapping-before-checking-deadzones.patch new file mode 100644 index 0000000..5bd4349 --- /dev/null +++ b/debian/patches/moved-axis-remapping-before-checking-deadzones.patch @@ -0,0 +1,91 @@ +From 71dd396b30f88285ea7823e125288ecd7b9b1567 Mon Sep 17 00:00:00 2001 +From: jtsiomb <jtsiomb@ef983eb1-d774-4af8-acfd-baaf7b16a646> +Date: Thu, 12 Feb 2015 15:35:56 +0000 +Subject: [PATCH 09/14] moved axis remapping before checking deadzones + +git-svn-id: svn://svn.code.sf.net/p/spacenav/code@188 ef983eb1-d774-4af8-acfd-baaf7b16a646 +--- + trunk/spacenavd/doc/example-spnavrc | 3 ++- + trunk/spacenavd/src/dev_usb_linux.c | 6 +++--- + trunk/spacenavd/src/event.c | 12 +++++++++--- + 3 files changed, 14 insertions(+), 7 deletions(-) + +diff --git a/trunk/spacenavd/doc/example-spnavrc b/trunk/spacenavd/doc/example-spnavrc +index ca8e598..bbb87da 100644 +--- a/doc/example-spnavrc ++++ b/doc/example-spnavrc +@@ -109,5 +109,6 @@ + # You probably don't need this setting. Set it to something like 250 if you + # find that your apps stop moving the view while you hold the puck/ball at a + # fixed off-center position (like bottomed out on the vertical axis). ++# Set to -1 to disable it (default). + # +-#repeat-interval = 0 ++#repeat-interval = -1 +diff --git a/trunk/spacenavd/src/dev_usb_linux.c b/trunk/spacenavd/src/dev_usb_linux.c +index ad1262a..dfa4420 100644 +--- a/src/dev_usb_linux.c ++++ b/src/dev_usb_linux.c +@@ -207,14 +207,14 @@ static int read_evdev(struct device *dev, struct dev_input *inp) + inp->type = INP_MOTION; + inp->idx = iev.code - REL_X; + inp->val = iev.value; +- /*printf("[%s] EV_REL(%d): %d\n", dev->name, inp->idx, iev.value);*/ ++ printf("[%s] EV_REL(%d): %d\n", dev->name, inp->idx, iev.value); + break; + + case EV_ABS: + inp->type = INP_MOTION; + inp->idx = iev.code - ABS_X; + inp->val = map_range(dev, inp->idx, iev.value); +- /*printf("[%s] EV_ABS(%d): %d (orig: %d)\n", dev->name, inp->idx, inp->val, iev.value);*/ ++ printf("[%s] EV_ABS(%d): %d (orig: %d)\n", dev->name, inp->idx, inp->val, iev.value); + break; + + case EV_KEY: +@@ -225,7 +225,7 @@ static int read_evdev(struct device *dev, struct dev_input *inp) + + case EV_SYN: + inp->type = INP_FLUSH; +- /*printf("[%s] EV_SYN\n", dev->name);*/ ++ printf("[%s] EV_SYN\n", dev->name); + break; + + default: +diff --git a/trunk/spacenavd/src/event.c b/trunk/spacenavd/src/event.c +index 6ed9875..27cebe5 100644 +--- a/src/event.c ++++ b/src/event.c +@@ -129,11 +129,12 @@ void process_input(struct device *dev, struct dev_input *inp) + + switch(inp->type) { + case INP_MOTION: ++ inp->idx = cfg.map_axis[inp->idx]; ++ + if(abs(inp->val) < cfg.dead_threshold[inp->idx] ) { ++ printf("clamping axis %d event with value %d in deadzone\n", inp->idx, inp->val); + inp->val = 0; + } +- +- inp->idx = cfg.map_axis[inp->idx]; + sign = cfg.invert[inp->idx] ? -1 : 1; + + inp->val = (int)((float)inp->val * cfg.sensitivity * (inp->idx < 3 ? cfg.sens_trans[inp->idx] : cfg.sens_rot[inp->idx - 3])); +@@ -211,8 +212,13 @@ int in_deadzone(struct device *dev) + if((dev_ev = device_event_in_use(dev)) == NULL) + return -1; + for(i=0; i<6; i++) { +- if(dev_ev->event.motion.data[i] != 0) ++ int val = dev_ev->event.motion.data[i]; ++ if(val != 0) { ++ if(abs(val) < cfg.dead_threshold[i]) { ++ printf("BUG %d on axis %d not in deadzone? (%d)\n", dev_ev->event.motion.data[i], i, cfg.dead_threshold[i]); ++ } + return 0; ++ } + } + return 1; + } +-- +2.16.1 + diff --git a/debian/patches/possible-fix-for-bug-9.patch b/debian/patches/possible-fix-for-bug-9.patch new file mode 100644 index 0000000..d642788 --- /dev/null +++ b/debian/patches/possible-fix-for-bug-9.patch @@ -0,0 +1,28 @@ +From 62e208f35aab905cf6230806b6af78b2e0f21f3b Mon Sep 17 00:00:00 2001 +From: jtsiomb <jtsiomb@ef983eb1-d774-4af8-acfd-baaf7b16a646> +Date: Fri, 9 Jan 2015 11:09:34 +0000 +Subject: [PATCH 05/14] possible fix for bug #9 + +git-svn-id: svn://svn.code.sf.net/p/spacenav/code@184 ef983eb1-d774-4af8-acfd-baaf7b16a646 +--- + trunk/spacenavd/src/dev_usb_linux.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/trunk/spacenavd/src/dev_usb_linux.c b/trunk/spacenavd/src/dev_usb_linux.c +index 5f4baad..6d1dac3 100644 +--- a/src/dev_usb_linux.c ++++ b/src/dev_usb_linux.c +@@ -347,8 +347,8 @@ struct usb_device_info *find_usb_devices(int (*match)(const struct usb_device_in + + int idx = 0; + while((devfile = strtok(devfile ? 0 : valptr, " \t\v\n\r"))) { +- if(strstr(devfile, "js") == devfile) { +- /* ignore joystick device files, can't use them */ ++ if(strstr(devfile, "event") != devfile) { ++ /* ignore everything which isn't an event interface device */ + continue; + } + +-- +2.16.1 + diff --git a/debian/patches/series b/debian/patches/series index 3633806..564fb30 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1,3 +1,11 @@ add-buildflags-to-makefile.patch run.patch reproducible-build.patch +added-code-to-skip-joystick-device-files-while-parsi.patch +possible-fix-for-bug-9.patch +added-all-the-missing-options-to-the-example-spnavrc.patch +trying-to-remove-devices-from-Xinput.patch +moved-axis-remapping-before-checking-deadzones.patch +Better-example-spnavrc-descriptions.patch +added-rule-to-match-devices-with-the-new-3Dconnexion.patch +fixed-a-small-bug-in-device-detection-which-sometime.patch diff --git a/debian/patches/trying-to-remove-devices-from-Xinput.patch b/debian/patches/trying-to-remove-devices-from-Xinput.patch new file mode 100644 index 0000000..c178de3 --- /dev/null +++ b/debian/patches/trying-to-remove-devices-from-Xinput.patch @@ -0,0 +1,189 @@ +From d7aa33dda9a478dda973d647d3719953ee73ab88 Mon Sep 17 00:00:00 2001 +From: jtsiomb <jtsiomb@ef983eb1-d774-4af8-acfd-baaf7b16a646> +Date: Thu, 12 Feb 2015 04:17:13 +0000 +Subject: [PATCH 08/14] trying to remove devices from Xinput + +git-svn-id: svn://svn.code.sf.net/p/spacenav/code@187 ef983eb1-d774-4af8-acfd-baaf7b16a646 +--- + trunk/spacenavd/configure | 7 +++++- + trunk/spacenavd/src/dev.c | 3 +++ + trunk/spacenavd/src/dev.h | 2 +- + trunk/spacenavd/src/dev_usb_linux.c | 3 +++ + trunk/spacenavd/src/proto_x11.c | 44 +++++++++++++++++++++++++++++++++++++ + trunk/spacenavd/src/proto_x11.h | 2 ++ + 6 files changed, 59 insertions(+), 2 deletions(-) + +diff --git a/trunk/spacenavd/configure b/trunk/spacenavd/configure +index 2795a3c..ce6b1c4 100755 +--- a/configure ++++ b/configure +@@ -28,7 +28,7 @@ test_kver() { + check_header() { + echo "#include <$1>" >.chkhdr.c + if cpp .chkhdr.c >/dev/null 2>&1; then +- echo "#define HAVE_`echo $1 | tr '[:lower:]' '[:upper:]' | sed 's/\./_/g'`" ++ echo "#define HAVE_`basename $1 | tr '[:lower:]' '[:upper:]' | sed 's/\./_/g'`" + fi + rm -f .chkhdr.c + } +@@ -39,6 +39,7 @@ OPT=yes + DBG=yes + X11=yes + HOTPLUG=yes ++XINPUT=yes + VER=`head -1 README | sed 's/^.*- //'` + + if echo $VER | grep '$Rev' >/dev/null; then +@@ -140,6 +141,9 @@ fi + + if [ "$X11" = 'yes' ]; then + echo 'xlib = -L/usr/X11/lib -lX11' >>Makefile ++ if [ -n "`check_header X11/extensions/XInput2.h 2>&1`" ]; then ++ echo 'xlib += -lXi' >>Makefile ++ fi + fi + + if [ -n "$add_cflags" ]; then +@@ -170,6 +174,7 @@ echo >>src/config.h + + # check for alloca.h + check_header alloca.h >>src/config.h ++check_header X11/extensions/XInput2.h >>src/config.h + + echo >>src/config.h + echo '#endif /* CONFIG_H_ */' >>src/config.h +diff --git a/trunk/spacenavd/src/dev.c b/trunk/spacenavd/src/dev.c +index 7fbfc02..8628b25 100644 +--- a/src/dev.c ++++ b/src/dev.c +@@ -25,6 +25,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. + #include "dev_serial.h" + #include "event.h" /* remove pending events upon device removal */ + #include "spnavd.h" ++#include "proto_x11.h" + + static struct device *add_device(void); + static struct device *dev_path_in_use(char const * dev_path); +@@ -86,6 +87,8 @@ int init_devices(void) + fprintf(stderr, "failed to find any supported devices\n"); + return -1; + } ++ ++ drop_xinput(); + return 0; + } + +diff --git a/trunk/spacenavd/src/dev.h b/trunk/spacenavd/src/dev.h +index f7ef691..8bf68b4 100644 +--- a/src/dev.h ++++ b/src/dev.h +@@ -39,7 +39,7 @@ struct device { + int (*read)(struct device*, struct dev_input*); + void (*set_led)(struct device*, int); + +- struct device *next; ++ struct device *next; + }; + + int init_devices(void); +diff --git a/trunk/spacenavd/src/dev_usb_linux.c b/trunk/spacenavd/src/dev_usb_linux.c +index 6d1dac3..ad1262a 100644 +--- a/src/dev_usb_linux.c ++++ b/src/dev_usb_linux.c +@@ -229,6 +229,9 @@ static int read_evdev(struct device *dev, struct dev_input *inp) + break; + + default: ++ if(verbose) { ++ printf("unexpected event: %d\n", iev.type); ++ } + return -1; + } + } +diff --git a/trunk/spacenavd/src/proto_x11.c b/trunk/spacenavd/src/proto_x11.c +index a338ff8..86ebc6f 100644 +--- a/src/proto_x11.c ++++ b/src/proto_x11.c +@@ -35,9 +35,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. + #include "proto_x11.h" + #include "client.h" + #include "spnavd.h" ++#include "dev.h" + #include "xdetect.h" + #include "kbemu.h" + ++#ifdef HAVE_XINPUT2_H ++#include <X11/Xatom.h> ++#include <X11/extensions/XInput2.h> ++#endif ++ + + enum cmd_msg { + CMD_NONE, +@@ -168,6 +174,8 @@ int init_x11(void) + kbemu_set_display(dpy); + + xdet_stop(); /* stop X server detection if it was running */ ++ ++ drop_xinput(); + return 0; + } + +@@ -346,6 +354,42 @@ void remove_client_window(Window win) + } + } + ++void drop_xinput(void) ++{ ++#ifdef HAVE_XINPUT2_H ++ XIDeviceInfo *xidevs; ++ int i, num_devs; ++ static Atom atom_enabled; ++ ++ if(!dpy) return; ++ ++ if(!atom_enabled) { ++ atom_enabled = XInternAtom(dpy, "Device Enabled", False); ++ } ++ ++ if(!(xidevs = XIQueryDevice(dpy, XIAllDevices, &num_devs))) { ++ fprintf(stderr, "failed to query XInput2 devices\n"); ++ return; ++ } ++ ++ for(i=0; i<num_devs; i++) { ++ struct device *dev = get_devices(); ++ while(dev) { ++ if(strcmp(dev->name, xidevs[i].name) == 0 && xidevs[i].enabled) { ++ unsigned char zero = 0; ++ printf("Removing device \"%s\" from X server\n", dev->name); ++ ++ XIChangeProperty(dpy, xidevs[i].deviceid, atom_enabled, XA_INTEGER, 8, PropModeReplace, &zero, 1); ++ break; ++ } ++ dev = dev->next; ++ } ++ } ++ XIFreeDeviceInfo(xidevs); ++ ++#endif /* HAVE_XINPUT2_H */ ++} ++ + + /* X11 error handler */ + static int xerr(Display *dpy, XErrorEvent *err) +diff --git a/trunk/spacenavd/src/proto_x11.h b/trunk/spacenavd/src/proto_x11.h +index 6b78361..49881e5 100644 +--- a/src/proto_x11.h ++++ b/src/proto_x11.h +@@ -37,5 +37,7 @@ int handle_xevents(fd_set *rset); + void set_client_window(Window win); + void remove_client_window(Window win); + ++void drop_xinput(void); ++ + + #endif /* PROTO_X11_H_ */ +-- +2.16.1 + -- 2.16.2