From owner-freebsd-x11@freebsd.org Sat Dec 5 13:45:48 2020 Return-Path: Delivered-To: freebsd-x11@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CD3D447BB6A for ; Sat, 5 Dec 2020 13:45:48 +0000 (UTC) (envelope-from vladimir@kondratyev.su) Received: from corp.infotel.ru (corp.infotel.ru [195.170.219.3]) by mx1.freebsd.org (Postfix) with ESMTP id 4Cp9nl6b3Bz3l3d for ; Sat, 5 Dec 2020 13:45:47 +0000 (UTC) (envelope-from vladimir@kondratyev.su) Received: from corp (corp.infotel.ru [195.170.219.3]) by corp.infotel.ru (Postfix) with ESMTP id CB51E1579BF for ; Sat, 5 Dec 2020 16:45:36 +0300 (MSK) X-Virus-Scanned: amavisd-new at corp.infotel.ru Received: from corp.infotel.ru ([195.170.219.3]) by corp (corp.infotel.ru [195.170.219.3]) (amavisd-new, port 10024) with ESMTP id H7ul8MkK3auZ for ; Sat, 5 Dec 2020 16:45:32 +0300 (MSK) Received: from mail.cicgroup.ru (unknown [195.170.219.74]) by corp.infotel.ru (Postfix) with ESMTP id AAA2B1579AB for ; Sat, 5 Dec 2020 16:45:32 +0300 (MSK) Received: from mail.cicgroup.ru (localhost [127.0.0.1]) by mail.cicgroup.ru (Postfix) with ESMTP id 67C7A42211F for ; Sat, 5 Dec 2020 16:41:47 +0300 (MSK) X-Virus-Scanned: amavisd-new at cicgroup.ru Received: from mail.cicgroup.ru ([127.0.0.1]) by mail.cicgroup.ru (mail.cicgroup.ru [127.0.0.1]) (amavisd-new, port 10024) with SMTP id OiNFvaAcsTRv for ; Sat, 5 Dec 2020 16:41:40 +0300 (MSK) Received: from [192.168.0.30] (gateway [10.0.2.2]) by mail.cicgroup.ru (Postfix) with ESMTPA id 484A542211C for ; Sat, 5 Dec 2020 16:41:40 +0300 (MSK) Subject: Re: Xorg (latest from ports) and no mouse movement To: freebsd-x11@freebsd.org References: <20201205114354.GA3814@c720-r342378> <20201205115850.GA4689@c720-r342378> From: Vladimir Kondratyev Message-ID: <56a68baa-fec7-6610-5d24-6159b75927ab@kondratyev.su> Date: Sat, 5 Dec 2020 16:45:00 +0300 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:78.0) Gecko/20100101 Thunderbird/78.5.0 MIME-Version: 1.0 In-Reply-To: <20201205115850.GA4689@c720-r342378> Content-Type: multipart/mixed; boundary="------------1F490AF5C816E028D4892FF6" Content-Language: en-US X-Rspamd-Queue-Id: 4Cp9nl6b3Bz3l3d X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=none (mx1.freebsd.org: domain of vladimir@kondratyev.su has no SPF policy when checking 195.170.219.3) smtp.mailfrom=vladimir@kondratyev.su X-Spamd-Result: default: False [0.00 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; RCVD_COUNT_FIVE(0.00)[6]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; FROM_HAS_DN(0.00)[]; RBL_DBL_DONT_QUERY_IPS(0.00)[195.170.219.3:from]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[multipart/mixed,text/plain,text/x-patch]; PREVIOUSLY_DELIVERED(0.00)[freebsd-x11@freebsd.org]; TO_DN_NONE(0.00)[]; HAS_ATTACHMENT(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; SPAMHAUS_ZRD(0.00)[195.170.219.3:from:127.0.2.255]; DMARC_NA(0.00)[kondratyev.su]; AUTH_NA(1.00)[]; NEURAL_SPAM_SHORT(1.00)[1.000]; R_SPF_NA(0.00)[no SPF record]; RCVD_NO_TLS_LAST(0.10)[]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:+]; ASN(0.00)[asn:8299, ipnet:195.170.192.0/19, country:RU]; MID_RHS_MATCH_FROM(0.00)[]; MAILMAN_DEST(0.00)[freebsd-x11] X-BeenThere: freebsd-x11@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: X11 on FreeBSD -- maintaining and support List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Dec 2020 13:45:48 -0000 This is a multi-part message in MIME format. --------------1F490AF5C816E028D4892FF6 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 05.12.2020 14:58, Matthias Apitz wrote: > El d=C3=ADa s=C3=A1bado, diciembre 05, 2020 a las 12:43:54p. m. +0100, = Matthias Apitz escribi=C3=B3: >=20 >> >> Hello, >> >> I'm setting up a new system on amd64 CURRENT (r368166) with ports from >> November 30, compiled all with poudriere. >> >> The Xorg is started with 'startx' and .xserverrc has: >> >> exec X -retro -logverbose 6 >> >> and .xinitrc says only (to simplify the problem): >> >> xterm -fn 10x20 >> >> X11 comes up, starts the xterm but no mouse movement is working. >> >> Without X11 the mouse moves fine by the moused as: >> >> /usr/sbin/moused -p /dev/cyapa0 -t ps/2 >> >> About the mouse the Xorg log has: >=20 > Additional information: attaching an USB mouse works fine, i.e. the > problem is only with the touchpad. >=20 > matthias >=20 >> root@c720-r368166:~ # grep mouse /var/log/Xorg.0.log >> [ 6260.470] (II) config/udev: Adding input device System mouse (/dev/= input/event0) >> [ 6260.470] (**) System mouse: Applying InputClass "evdev pointer cat= chall" >> [ 6260.470] (**) System mouse: Applying InputClass "libinput pointer = catchall" >> [ 6260.474] (II) Using input driver 'libinput' for 'System mouse' >> [ 6260.474] Option "name" "System mouse" >> [ 6260.475] (**) System mouse: always reports core events >> [ 6260.479] (II) event0 - System mouse: is tagged by udev as: Mouse >> [ 6260.479] (II) event0 - System mouse: device is a pointer >> [ 6260.480] (II) event0 - System mouse: device removed >> [ 6260.480] (II) XINPUT: Adding extended input device "System mouse" = (type: MOUSE, id 6) >> [ 6260.481] (**) System mouse: (accel) selected scheme none/0 >> [ 6260.481] (**) System mouse: (accel) acceleration factor: 2.000 >> [ 6260.481] (**) System mouse: (accel) acceleration threshold: 4 >> [ 6260.482] (II) event0 - System mouse: is tagged by udev as: Mouse >> [ 6260.482] (II) event0 - System mouse: device is a pointer >> [ 6278.765] (II) event0 - System mouse: device removed >> >> What is missing? >> Try attached untested patch. --------------1F490AF5C816E028D4892FF6 Content-Type: text/x-patch; charset=UTF-8; name="cyapa.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="cyapa.patch" diff --git a/sys/dev/cyapa/cyapa.c b/sys/dev/cyapa/cyapa.c index 293d68e9abdc..ca9f3d5b602d 100644 --- a/sys/dev/cyapa/cyapa.c +++ b/sys/dev/cyapa/cyapa.c @@ -99,6 +99,8 @@ __FBSDID("$FreeBSD$"); * below) the other two. */ +#include "opt_evdev.h" + #include #include #include @@ -126,6 +128,11 @@ __FBSDID("$FreeBSD$"); #include #include +#ifdef EVDEV_SUPPORT +#include +#include +#endif + #include "iicbus_if.h" #include "bus_if.h" #include "device_if.h" @@ -153,6 +160,9 @@ struct cyapa_softc { struct selinfo selinfo; struct mtx mutex; struct intr_config_hook intr_hook; +#ifdef EVDEV_SUPPORT + struct evdev_dev *evdev; +#endif int cap_resx; int cap_resy; @@ -561,8 +571,46 @@ cyapa_attach(device_t dev) sc->intr_hook.ich_func = cyapa_start; sc->intr_hook.ich_arg = sc->dev; +#ifdef EVDEV_SUPPORT + sc->evdev = evdev_alloc(); + evdev_set_name(sc->evdev, device_get_desc(sc->dev)); + evdev_set_phys(sc->evdev, device_get_nameunit(sc->dev)); + evdev_set_id(sc->evdev, BUS_I2C, 0, 0, 1); + evdev_set_flag(sc->evdev, EVDEV_FLAG_MT_STCOMPAT); + evdev_set_flag(sc->evdev, EVDEV_FLAG_MT_AUTOREL); + + evdev_support_event(sc->evdev, EV_SYN); + evdev_support_event(sc->evdev, EV_ABS); + evdev_support_event(sc->evdev, EV_KEY); + evdev_support_prop(sc->evdev, INPUT_PROP_POINTER); + if (cap.buttons & CYAPA_FNGR_LEFT) + evdev_support_key(sc->evdev, BTN_LEFT); + if (cap.buttons & CYAPA_FNGR_RIGHT) + evdev_support_key(sc->evdev, BTN_RIGHT); + if (cap.buttons & CYAPA_FNGR_MIDDLE) + evdev_support_key(sc->evdev, BTN_MIDDLE); + if (CYAPA_FNGR_LEFT == (cap.buttons & + (CYAPA_FNGR_LEFT | CYAPA_FNGR_RIGHT | CYAPA_FNGR_MIDDLE))) + evdev_support_prop(sc->evdev, INPUT_PROP_BUTTONPAD); + + evdev_support_abs(sc->evdev, ABS_MT_SLOT, + 0, 0, CYAPA_MAX_MT - 1, 0, 0, 0); + evdev_support_abs(sc->evdev, ABS_MT_TRACKING_ID, 0, -1, 15, 0, 0, 0); + evdev_support_abs(sc->evdev, ABS_MT_POSITION_X, + 0, 0, sc->cap_resx, 0, 0, sc->cap_resx / sc->cap_phyx); + evdev_support_abs(sc->evdev, ABS_MT_POSITION_Y, + 0, 0, sc->cap_resy, 0, 0, sc->cap_resy / sc->cap_phyy); + evdev_support_abs(sc->evdev, ABS_MT_PRESSURE, 0, 0, 255, 0, 0, 0); + + if (evdev_register(sc->evdev) != 0) { + mtx_destroy(&sc->mutex); + return (ENOMEM); + } +#endif + /* Postpone start of the polling thread until sleep is available */ if (config_intrhook_establish(&sc->intr_hook) != 0) { + evdev_free(sc->evdev); mtx_destroy(&sc->mutex); return (ENOMEM); } @@ -596,6 +644,10 @@ cyapa_detach(device_t dev) seldrain(&sc->selinfo); knlist_destroy(&sc->selinfo.si_note); +#ifdef EVDEV_SUPPORT + evdev_free(sc->evdev); +#endif + mtx_destroy(&sc->mutex); return (0); @@ -1321,6 +1373,40 @@ cyapa_raw_input(struct cyapa_softc *sc, struct cyapa_regs *regs, int freq) nfingers); } +#ifdef EVDEV_SUPPORT + if (evdev_rcpt_mask & EVDEV_RCPT_HW_MOUSE) { + for (i = 0; i < nfingers; ++i) { + int32_t slot = evdev_get_mt_slot_by_tracking_id( + sc->evdev, regs->touch[i].id); + if (slot == -1) { + if (cyapa_debug) + printf("Slot overflow for i=%d\n", + regs->touch[i].id); + continue; + } + evdev_push_abs(sc->evdev, ABS_MT_SLOT, slot); + evdev_push_abs(sc->evdev, ABS_MT_TRACKING_ID, + regs->touch[i].id); + evdev_push_abs(sc->evdev, ABS_MT_POSITION_X, + CYAPA_TOUCH_X(regs, i)); + evdev_push_abs(sc->evdev, ABS_MT_POSITION_Y, + CYAPA_TOUCH_Y(regs, i)); + evdev_push_abs(sc->evdev, ABS_MT_PRESSURE, + CYAPA_TOUCH_P(regs, i)); + } + if (sc->cap_buttons & CYAPA_FNGR_LEFT) + evdev_push_key(sc->evdev, BTN_LEFT, + regs->fngr & CYAPA_FNGR_LEFT); + if (sc->cap_buttons & CYAPA_FNGR_RIGHT) + evdev_push_key(sc->evdev, BTN_RIGHT, + regs->fngr & CYAPA_FNGR_RIGHT); + if (sc->cap_buttons & CYAPA_FNGR_MIDDLE) + evdev_push_key(sc->evdev, BTN_MIDDLE, + regs->fngr & CYAPA_FNGR_MIDDLE); + evdev_sync(sc->evdev); + } +#endif + seen_thumb = 0; for (i = 0; i < afingers; ) { if (cyapa_debug) { diff --git a/sys/modules/i2c/cyapa/Makefile b/sys/modules/i2c/cyapa/Makefile index 0f5b3aa26561..817c5ba68777 100644 --- a/sys/modules/i2c/cyapa/Makefile +++ b/sys/modules/i2c/cyapa/Makefile @@ -2,6 +2,7 @@ .PATH: ${SRCTOP}/sys/dev/cyapa KMOD = cyapa -SRCS = cyapa.c device_if.h bus_if.h iicbus_if.h vnode_if.h +SRCS = cyapa.c device_if.h bus_if.h iicbus_if.h vnode_if.h \ + opt_evdev.h .include --------------1F490AF5C816E028D4892FF6--