Using device name instead of ID for touchpad

* UDEV registers touch pad (e.g., Synaptic) with different IDs on
  reboots. Instead of hard-coding product/device IDs in config.h,
  use a string that appears in device name to identify it
This commit is contained in:
2024-04-14 11:39:45 -07:00
parent 51b2f68ba5
commit cc8f7fb99c
2 changed files with 22 additions and 28 deletions

View File

@@ -19,7 +19,8 @@ static const float fullscreen_bg[] = COLOR(0x121212ff);
#define TAGCOUNT (9)
/* control variables */
static int cfg_disable_touch_pad = 1;
static int cfg_disable_touchpad = 1;
static const char *cfg_touchpad_device_str = "Synaptic";
/* logging */
static int log_level = WLR_ERROR;
@@ -94,15 +95,6 @@ LIBINPUT_CONFIG_SEND_EVENTS_DISABLED_ON_EXTERNAL_MOUSE
*/
static const uint32_t send_events_mode = LIBINPUT_CONFIG_SEND_EVENTS_ENABLED;
/* Touch device information to filter touch events
* Use something like this to obtain info:
*
* root@host $ udevadm info --tree | grep -a5 Synaptic | grep -E "PRODUCT|NAME"
* │ │ ┆ E: PRODUCT=11/2(vendor)/7(product)/1b1
* │ │ ┆ E: NAME="SynPS/2 Synaptics TouchPad" */
static const uint32_t touch_device_vendor_id = 0x2;
static const uint32_t touch_device_product_id = 0x7;
/* You can choose between:
LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT
LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE