Configuration

clohr
2012-03-07
2013-04-26
  • clohr
    clohr
    2012-03-07

    Hi,

    One of the criticism of the Sentelic linux driver is that the touchpad cannot be configured via classical X11 features (xinput tools & co.)
    The end-user needs root privileges to setup its preferences.
    (more precisely one needs write access to /sys/devices/platform/i8042/serio1/fags )

    A first workaround could be to set up the config tool "fspc" as a suid-root app.
    It is not a desirable for security reasons (first: every connected user could reconfigure the touchpad, even if it is not the X11 user; and then: any remaining bug whithin an suid-root app is the open door to root exploit).

    I propose another workaround.
    First let's perform some "chown" while opening the X11 session,  then restore everything at closure.
    More concretly with gdm3:
    1) Edit   /etc/gdm3/PostLogin/Default

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    #!/bin/bash
    #
    # FSPPS/2 Sentelic FingerSensingPad
    # Before session, gives user access to the driver
    for DRV_BASE in /sys/devices/platform/i8042/serio* ; do
      if grep -q Sentelic "${DRV_BASE}/ver" ; then
        for PARAM in flags vscroll hscroll accel ; do
          if [ -f "${DRV_BASE}/${PARAM}" ] ; then
            chown ${USER}. "${DRV_BASE}/${PARAM}"
          fi
        done
      fi
    done
    exit 0
    

    2) Edit   /etc/gdm3/PostSession/Default

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    #!/bin/bash
    #
    # FSPPS/2 Sentelic FingerSensingPad
    # After session, gives it back to root
    for DRV_BASE in /sys/devices/platform/i8042/serio* ; do
      if grep -q Sentelic "${DRV_BASE}/ver" ; then
        for PARAM in flags vscroll hscroll accel ; do
          if [ -f "${DRV_BASE}/${PARAM}" ] ; then
            chown root. "${DRV_BASE}/${PARAM}"
          fi
        done
      fi
    done
    exit 0
    

    Doing so, the X11 user can setup its preferences during its session.

    Next step is to make persistent preferences.
    To do that I propose to use an hook provided by gnome-control-center (if you use a gnome environment). This feature is not very well documented. Look at source code of gnome-control-center.

    gnome-control-center-3.2.2/panels/mouse/gsd-input-helper.c
    (..)
    #define INPUT_DEVICES_SCHEMA "org.gnome.settings-daemon.peripherals.input-devices"
    #define KEY_HOTPLUG_COMMAND  "hotplug-command"
    (..)
    /* Run a custom command on device presence events. Parameters passed into
    * the custom command are:
    * command -t  -i <device ID> <device name>
    * Type 'added' and 'removed' signal 'device added' and 'device removed',
    * respectively. Type 'present' signals 'device present at
    * gnome-settings-daemon init'.
    *
    * The script is expected to run synchronously, and an exit value
    * of "1" means that no other settings will be applied to this
    * particular device.
    *
    * More options may be added in the future.

    So, the user can write a shell script, for instance  "~/.local/share/input-devices.hotplug" :

    1
    2
    3
    4
    5
    6
    7
    #!/bin/bash
    if [ "$1" == "-t added" -o "$1" == "-t present" ]; then
      if [ "$3" == "FSPPS/2 Sentelic FingerSensingPad" ]; then
        fspc -t -l ${HOME}/.fspc/fspc.ini
      fi
    fi
    exit 0
    

    Install your script with:

    $ gsettings set \
       org.gnome.settings-daemon.peripherals.input-devices \
       hotplug-command ${HOME]/.local/share/input-devices.hotplug
    

    That's all folks !
    Enjoy