Bug 247417

Summary: fix to make touchpad work under freebsd 12.1
Product: Base System Reporter: Mc James <realmcjames>
Component: kernAssignee: freebsd-multimedia (Nobody) <multimedia>
Status: Open ---    
Severity: Affects Many People CC: lwhsu, wulf
Priority: ---    
Version: 12.1-RELEASE   
Hardware: amd64   
OS: Any   
Attachments:
Description Flags
xorg log file
none
another xorg log
none
another xorg log
none
another xorg log
none
psm.patch none

Description Mc James 2020-06-19 13:17:31 UTC
Created attachment 215779 [details]
xorg log file

Hello
with the change to udev in freebsd 12.1 and xorg/x11-server
I can't set the touchpad to work. at all
I managed to use libinput and edev as driver and both of them pick my Touch pad as Mouse.
No tap to click and no edge scrolling.

libinput WORKED UNDER FREEBSD 11. (tab to click worked)
 I have hal  and dbus installed and set startup configuration.
{xf86-input}-libinput/synaptics/evdev is installed.
configs are in /usr/local/etc/X11/xorg.conf.d
FreeBSD SJD 12.1-RELEASE FreeBSD 12.1-RELEASE r354233 GENERIC  amd64


hw.psm.synaptics_support="1" is in /boot/loader.conf


with libinput driver and device driver in xorg.cond.d as /dev/input/event* I get mouse with no tap to click from my touchpad but if I specifically mention /dev/input/event3 then nothing changes from the touchpad problem and still we have the mouse as a touchpad but then any keyboard let it be the laptop keyboard or any usb external keyboard then arrow key don't work.
from froum post mentioning the tip "Remove" the driver from the config file" then evdev would pickup my input devices but again no touchpad but a mouse instead of touchpad. (no tap to click)
if I put libinput as driver in conf file inside /usr/local/etc/X11/xorg.conf.d/
and use /dev/input/event* for driver in Section InputClass then I get libinput as my driver but the libinput settings won't get applied as in
https://forums.freebsd.org/threads/issues-with-libinput-xorg-isnt-following-my-libinput-conf-file-but-is-loading-libinput.72187/
Comment 1 Mc James 2020-06-19 13:18:23 UTC
Created attachment 215781 [details]
another xorg log
Comment 2 Mc James 2020-06-19 13:18:55 UTC
Created attachment 215782 [details]
another xorg log
Comment 3 Mc James 2020-06-19 13:19:21 UTC
Created attachment 215783 [details]
another xorg log
Comment 4 Andriy Gapon freebsd_committer freebsd_triage 2020-06-19 14:36:33 UTC
What's sysctl kern.evdev.rcpt_mask set to?
kern.evdev.rcpt_mask: Who is receiving events: bit0 - sysmouse, bit1 - kbdmux, bit2 - mouse hardware, bit3 - keyboard hardware
Comment 5 Mc James 2020-06-19 17:17:03 UTC
(In reply to Andriy Gapon from comment #4)
kern.evdev.rcpt_mask: 3
and I didn't get your second question. where/how could i find the answer that you're looking for?
tnx
Comment 6 Andriy Gapon freebsd_committer freebsd_triage 2020-06-19 22:02:25 UTC
(In reply to Mc James from comment #5)
It was not a question, it was the sysctl's description.
You probably want Xorg to get events from the hardware, not from sysmouse (which is just a special mouse protocol).
Comment 7 Mc James 2020-06-20 15:47:23 UTC
hello;
then what do you suggest I should do.
I pasted the Xorg logs of my each attempts. I think the info you need is in there.
my question is this?:
Why my touchpad just being translated to mouse.
the other thing that I found out was tapping on touchpad while inside firefox just do as back. it bring the web page one page backward.
Thanks
Comment 8 Vladimir Kondratyev freebsd_committer freebsd_triage 2020-06-21 20:02:06 UTC
(In reply to Mc James from comment #7)
> Why my touchpad just being translated to mouse.

According to xorg.log provided, your touchpad is ALPS rather than Synaptics. It has no native support in FreeBSD, only generic mouse mode is available.

If you think it worked better before 1.20/evdev than you can try to manually state /dev/psm0 as input device for x11-drivers/xf86-input-mouse driver. Or recompile kernel with EVDEV_SUPPORT option disabled. Latter should trigger old input device auto-configuration behavior for both DEVD and UDEV Xorg backends.
Comment 9 Mc James 2020-06-21 23:25:09 UTC
(In reply to Vladimir Kondratyev from comment #8)
Hello;
Is that the only way? compiling the kernel
WHat happened from version 11 to 12 that we lost all support for this touchpad.
besides this touchpad works under all BSD flavours available.
OPEN/NET/DragonFly....
Comment 10 Vladimir Kondratyev freebsd_committer freebsd_triage 2020-06-22 08:09:39 UTC
(In reply to Mc James from comment #9)
> Is that the only way? compiling the kernel

No it is not the only way. It is just a way to replace libinput with x11-drivers/xf86-input-mouse back not touching any configuration files.

Other way is add following snippet to xorg.conf:

Section "InputClass"
       Identifier              "PS/2 mouse"
       MatchDevicePath         "/dev/psm*"
       Driver                  "mouse"
EndSection

Section "InputClass"
       Identifier              "libinput PS/2 mouse"
       MatchDevicePath         "/dev/input/event3"
       Option                  "Ignore" "true"
EndSection

> WHat happened from version 11 to 12 that we lost
> all support for this touchpad. besides this touchpad
> works under all BSD flavours available.
> OPEN/NET/DragonFly....

We switched to libinput which does not implement required quirk (mapping 4-th mouse button to tap event)
Comment 11 Vladimir Kondratyev freebsd_committer freebsd_triage 2020-06-22 12:07:53 UTC
(In reply to Mc James from comment #9)
You can try to map 4-th button to left button on xorg level with following command (not tested):

$ xinput set-button-map device 1 2 3 1
Comment 12 Mc James 2020-06-22 19:23:39 UTC
(In reply to Vladimir Kondratyev from comment #11)
I would test this and report back.
but I have another question. would this model of touchpad get support under this new regime?
or FreeBSD purposefully phase such devices out.
thanks
Comment 13 Vladimir Kondratyev freebsd_committer freebsd_triage 2020-06-22 20:42:50 UTC
(In reply to Mc James from comment #12)
> I would test this and report back.
> but I have another question. would this model of touchpad
> get support under this new regime?

What do you mean by "support"? 11-RELEASE "mouse with tap detection" - like? That is what I am trying to do now. If something of what I proposed helps, I'll try to add quirk to kernel driver to enable tap support automatically. If not, we can dump PS/2 bytestream to find out "what is up?"

If you mean full-blown absolute mode driver, than answer is "most probably no". I have to have a physical access to laptop to write and debug such a driver. Really things are worse as there are 9! different versions of ALPS PS/2 touchpad protocol and it is not clear which ones are major or minor.

> or FreeBSD purposefully phase such devices out.

Such devices are phased out by history rather than by FreeBSD. Their worst property is that they are not supported good enough by Windows. MS precision touchpad specs includes only USB and I2C devices, not PS/2, that is why new laptops do not contain PS/2 touchpads. That means that chances that someone who is motivated enough to write an absolute-mode driver for such a rare device will get a sample of it are relatively low.
But, that does not mean that FreeBSD wants to let it rot.
Comment 14 Mc James 2020-06-25 22:14:58 UTC
here is the excerpt from Xorg.0.log after what you suggested I put that conf file in /usr/local/etc/X11/xorg.conf.d/10-input.conf 
I couldn't get the desired result at the moment touchpad not even moving the cursor.

[   617.952] (**) System mouse: (accel) acceleration threshold: 4                                                                    |
[   617.953] (II) config/udev: Adding input device System keyboard multiplexer (/dev/input/event1)                                   |
[   617.953] (**) System keyboard multiplexer: Applying InputClass "evdev keyboard catchall"                                         |
[   617.953] (II) Using input driver 'evdev' for 'System keyboard multiplexer'                                                       |
[   617.953] (**) System keyboard multiplexer: always reports core events                                                            |
[   617.953] (**) evdev: System keyboard multiplexer: Device: "/dev/input/event1"                                                    |
[   617.953] (--) evdev: System keyboard multiplexer: Vendor 0 Product 0                                                             |
[   617.953] (--) evdev: System keyboard multiplexer: Found keys                                                                     |
[   617.953] (II) evdev: System keyboard multiplexer: Configuring as keyboard                                                        |
[   617.953] (**) Option "config_info" "udev:/dev/input/event1"                                                                      |
[   617.953] (II) XINPUT: Adding extended input device "System keyboard multiplexer" (type: KEYBOARD, id 7)                          |
[   617.953] (**) Option "xkb_rules" "evdev"                                                                                         |
[   617.991] (II) config/udev: Adding input device AT keyboard (/dev/input/event2)                                                   |
[   617.991] (**) AT keyboard: Applying InputClass "evdev keyboard catchall"                                                         |
[   617.991] (II) Using input driver 'evdev' for 'AT keyboard'                                                                       |
[   617.991] (**) AT keyboard: always reports core events                                                                            |
[   617.991] (**) evdev: AT keyboard: Device: "/dev/input/event2"                                                                    |
[   617.991] (--) evdev: AT keyboard: Vendor 0x1 Product 0x1                                                                         |
[   617.991] (--) evdev: AT keyboard: Found keys                                                                                     |
[   617.991] (II) evdev: AT keyboard: Configuring as keyboard                                                                        |
[   617.991] (**) Option "config_info" "udev:/dev/input/event2"                                                                      |
[   617.991] (II) XINPUT: Adding extended input device "AT keyboard" (type: KEYBOARD, id 8)                                          |
[   617.991] (**) Option "xkb_rules" "evdev"                                                                                         |
[   617.992] (II) config/udev: Adding input device GlidePoint (/dev/input/event3)                                                    |
[   617.992] (**) GlidePoint: Ignoring device from InputClass "libinput PS/2 mouse"                                                  |
[   617.992] (II) config/udev: Adding input device vendor 0x13ba Barcode Reader (/dev/input/event4)                                  |
[   617.992] (**) vendor 0x13ba Barcode Reader: Applying InputClass "evdev keyboard catchall"                                        |
[   617.992] (II) Using input driver 'evdev' for 'vendor 0x13ba Barcode Reader'                                                      |
[   617.992] (**) vendor 0x13ba Barcode Reader: always reports core events                                                           |
[   617.992] (**) evdev: vendor 0x13ba Barcode Reader: Device: "/dev/input/event4"                                                   |
[   617.992] (--) evdev: vendor 0x13ba Barcode Reader: Vendor 0x13ba Product 0x18                                                    |
[   617.992] (--) evdev: vendor 0x13ba Barcode Reader: Found keys                                                                    |
[   617.992] (II) evdev: vendor 0x13ba Barcode Reader: Configuring as keyboard                                                       |
[   617.992] (**) Option "config_info" "udev:/dev/input/event4"                                                                      |
[   617.992] (II) XINPUT: Adding extended input device "vendor 0x13ba Barcode Reader" (type: KEYBOARD, id 9)                         |
[   617.992] (**) Option "xkb_rules" "evdev"                                                                                         |
[   617.993] (II) config/udev: Adding input device SIGMACHIP USB Keyboard (/dev/input/event5)                                        |
[   617.993] (**) SIGMACHIP USB Keyboard: Applying InputClass "evdev keyboard catchall"                                              |
[   617.993] (II) Using input driver 'evdev' for 'SIGMACHIP USB Keyboard'  



as you can see still being picked up by libinput.
Comment 15 Vladimir Kondratyev freebsd_committer freebsd_triage 2020-06-26 15:14:48 UTC
Created attachment 215962 [details]
psm.patch

(In reply to Mc James from comment #14)
> as you can see still being picked up by libinput.
It is ignored by libinput now but is not picked by xf86-input-mouse for some reasons. Ensure you have x11-drivers/xf86-input-mouse installed and try explicitly character device with following lines:

Section "InputClass"
        Identifier              "PS/2 mouse"
        Option                  "Protocol" "auto"
        Option                  "Device" "/dev/psm0"
        Driver                  "mouse"
EndSection

Section "InputClass"
        Identifier              "ignore evdev interface of PS/2 mouse"
        MatchDevicePath         "/dev/input/event3"
        Option                  "Ignore" "true"
EndSection

You can test enclosed patch too. It maps tap to left button by kernel driver means and requires kernel recompiling. No Xorg config changes required in this case so it could be a better way. Old Xorg.conf changes should be backed out.
Comment 16 Mc James 2020-07-01 21:06:52 UTC
(In reply to Vladimir Kondratyev from comment #15)
I didn't test the patch. but the xorg config you gave stopped everything
even the usb keyboard and mouse won't work.
Comment 17 Vladimir Kondratyev freebsd_committer freebsd_triage 2020-07-01 21:56:06 UTC
What is 'pkg info xorg-server' output on your system?
Comment 18 Mc James 2020-07-02 01:02:29 UTC
(In reply to Vladimir Kondratyev from comment #17)
Architecture   : FreeBSD:12:amd64
Prefix         : /usr/local
Categories     : x11-servers
Licenses       : MIT
Maintainer     : x11@FreeBSD.org
WWW            : http://www.freedesktop.org/Software/xorg
Comment        : X.Org X server and related programs
Options        :
        DEVD           : off
        SUID           : on
        UDEV           : on
Shared Libs required:
        libgbm.so.1
        libxshmfence.so.1
        libGL.so.1
        libdrm.so.2
        libpciaccess.so.0
        libpixman-1.so.0
        libXdmcp.so.6
        libudev.so.0
        libXau.so.6
        libepoxy.so.0
        libunwind.so.8
        libXfont2.so.2
Shared Libs provided:
        libvgahw.so
        libint10.so
        libexa.so
        libshadow.so
        libvbe.so
        libfbdevhw.so
        libshadowfb.so
        libglamoregl.so
        libwfb.so
        libglx.so
        libfb.so
Annotations    :
        FreeBSD_version: 1201000
        cpe            : cpe:2.3:a:x.org:xorg-server:1.20.8:::::freebsd12:x64:2
        repo_type      : binary
        repository     : FreeBSD
Flat size      : 4.78MiB
Description    :
This package contains the X.Org X server and some associated programs.

WWW: http://www.freedesktop.org/Software/xorg
Comment 19 Vladimir Kondratyev freebsd_committer freebsd_triage 2020-07-03 21:43:08 UTC
(In reply to Mc James from comment #18)

> Options        :
>        DEVD           : off
>        SUID           : on
>        UDEV           : on

It appears that UDEV auto-configuration backend disables "mouse" driver when  
"AutoAddDevices" option is enabled so we have to turn it off.

Following snippet forces Xorg on my laptop to nearly pre-evdev behavior so you can try it too. It works for me even without keyboard section: 


Section "ServerFlags"
        Option          "AutoAddDevices" "false"
EndSection

Section "InputDevice"
        Identifier      "PS/2 mouse"
        Option          "CorePointer"
        Option          "Protocol" "auto"
        Option          "Device" "/dev/psm0"
        Driver          "mouse"
EndSection

Section "InputDevice"
        Identifier      "System mouse"
        Option          "Protocol" "auto"
        Option          "Device" "/dev/sysmouse"
        Driver          "mouse"
        Option          "AutoServerLayout" "true"
EndSection

P.S. moused should NOT be enabled in /etc/rc.conf.
Comment 20 Mark Linimon freebsd_committer freebsd_triage 2021-05-11 15:09:41 UTC
^Triage: assign to correct mailing list.
^Triage: remove the "patch" keywork, as it is now inferred from the attachment metadata.