BYD trackpad detected as PS/2 mouse

Bug #1424293 reported by VJ Patel on 2015-02-22
54
This bug affects 8 people
Affects Status Importance Assigned to Milestone
linux (Ubuntu)
Medium
Unassigned

Bug Description

In 14.04.2, I expected to be able to use as touchpad with two finger vertical/horizontal scrolling. Currently only able to use plainly. The exact device is this: http://bydit.com/doce/products/microelectronics/2474.html

I: Bus=0011 Vendor=0002 Product=0005 Version=0000
N: Name="ImPS/2 Generic Wheel Mouse"
P: Phys=isa0060/serio1/input0
S: Sysfs=/devices/platform/i8042/serio1/input/input7
U: Uniq=
H: Handlers=mouse0 event10
B: PROP=0
B: EV=7
B: KEY=70000 0 0 0 0
B: REL=103

Output of xinput --list
⎡ Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ ImPS/2 Generic Wheel Mouse id=12 [slave pointer (2)]
⎣ Virtual core keyboard id=3 [master keyboard (2)]
    ↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)]
    ↳ Power Button id=6 [slave keyboard (3)]
    ↳ Video Bus id=7 [slave keyboard (3)]
    ↳ Power Button id=8 [slave keyboard (3)]
    ↳ Sleep Button id=9 [slave keyboard (3)]
    ↳ USB 2.0 Camera id=10 [slave keyboard (3)]
    ↳ AT Translated Set 2 keyboard id=11 [slave keyboard (3)]

---
ApportVersion: 2.17.2-0ubuntu1.1
Architecture: amd64
AudioDevicesInUse:
 USER PID ACCESS COMMAND
 /dev/snd/controlC1: vjftw 1362 F.... pulseaudio
CurrentDesktop: Unity
DistroRelease: Ubuntu 15.04
HibernationDevice: RESUME=UUID=d58116d7-f5eb-4b3c-b986-a9a29b608880
InstallationDate: Installed on 2015-04-25 (28 days ago)
InstallationMedia: Ubuntu 15.04 "Vivid Vervet" - Release amd64 (20150422)
Lsusb:
 Bus 003 Device 002: ID 8087:8001 Intel Corp.
 Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
 Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
 Bus 001 Device 002: ID 058f:3821 Alcor Micro Corp.
 Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
MachineType: Intel Corporation SharkBay Platform
Package: linux (not installed)
ProcFB: 0 inteldrmfb
ProcKernelCmdLine: BOOT_IMAGE=/boot/vmlinuz-3.19.0-18-generic.efi.signed root=UUID=cd943b28-f170-4ce9-b836-18c395f1df6d ro quiet splash vt.handoff=7
ProcVersionSignature: Ubuntu 3.19.0-18.18-generic 3.19.6
RelatedPackageVersions:
 linux-restricted-modules-3.19.0-18-generic N/A
 linux-backports-modules-3.19.0-18-generic N/A
 linux-firmware 1.143.1
RfKill:
 0: phy0: Wireless LAN
  Soft blocked: no
  Hard blocked: no
Tags: vivid
UdevLog: Error: [Errno 2] No such file or directory: '/var/log/udev'
Uname: Linux 3.19.0-18-generic x86_64
UpgradeStatus: No upgrade log present (probably fresh install)
UserGroups: adm cdrom dip docker lpadmin plugdev sambashare sudo
_MarkForUpload: True
dmi.bios.date: 02/03/2015
dmi.bios.vendor: American Megatrends Inc.
dmi.bios.version: 5.6.5
dmi.board.asset.tag: Base Board Asset Tag
dmi.board.name: WhiteTip Mountain1 Fab2
dmi.board.vendor: Topstar
dmi.board.version: Fab2
dmi.chassis.asset.tag: To Be Filled By O.E.M.
dmi.chassis.type: 9
dmi.chassis.vendor: To Be Filled By O.E.M.
dmi.chassis.version: To Be Filled By O.E.M.
dmi.modalias: dmi:bvnAmericanMegatrendsInc.:bvr5.6.5:bd02/03/2015:svnIntelCorporation:pnSharkBayPlatform:pvr0.1:rvnTopstar:rnWhiteTipMountain1Fab2:rvrFab2:cvnToBeFilledByO.E.M.:ct9:cvrToBeFilledByO.E.M.:
dmi.product.name: SharkBay Platform
dmi.product.version: 0.1
dmi.sys.vendor: Intel Corporation

VJ Patel (meetthevj) on 2015-02-22
description: updated
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in linux-lts-utopic (Ubuntu):
status: New → Confirmed
Chris Diamand (chuis) wrote :

Using the technique here: http://blog.forshee.me/2011/11/touchpad-protocol-reverse-engineering.html (with Qemu - I couldn't get it to work under VBox), I have obtained a trace of the interaction between Windows driver and touchpad on Windows 7 with all features working (two finger scrolling, pinch-to-zoom, etc).

I have attached:
- A patched version of hw/input/ps2.c which works with Qemu 2.2.0
- The trace that I recorded.

Chris Diamand (chuis) wrote :

Ok, so I've managed to write a kernel driver, as an extension to psmouse, which recognises the touchpad and puts it into gesture-enabled mode. Currently it recognises and uses vertical and horizontal two finger scrolling, and also knows about the other gestures (but I haven't got around to figuring out how they work with the input framework yet).

Check it out here:
$ git clone -b byd https://www.github.com/chrisdiamand/linux.git

The protocol is pretty simple - there's some ps2 init stuff, then a sequence of magic bytes which I intercepted from the windows driver. It returns 4 byte packets using the intellimouse protocol, except the last bit (scroll/Z) takes different values depending on the gesture.

Some issues remain though:
- It's not supported in xf86-input-synaptics yet. This means you can't control parameters with synclient. I think things like intertial scrolling are handled here too.

- Gesture recognition seems to be being done by the touchpad itself (firmware?) and not by the driver in the windows driver. Unfortunately it doesn't do a very good job of it.

Chris Diamand (chuis) wrote :

*previous comment continued.

Gesture recognition is done by the touchpad and not the driver, and it's not very good. I.e., it reports the gesture, not the finger positions, so we can't configure things like scroll threshold.

The way to improve this would be to somehow put it in 'absolute' mode, where it reports the actual finger positions. However, the windows driver doesn't do this, so finding out how to do it (if it's possible at all) would be difficult/impossible.

affects: linux-lts-utopic (Ubuntu) → linux (Ubuntu)
Changed in linux (Ubuntu):
importance: Undecided → Low
status: Confirmed → Incomplete

apport information

tags: added: apport-collected vivid
description: updated

apport information

apport information

apport information

apport information

apport information

apport information

VJ Patel (meetthevj) wrote :

Hi Christopher (penalvch),

I ran apport-collect 1417450 but it kept saying that I wasn't the owner so it could not collect. I'm assuming the number is the ID of the bug, so i have ran apport-collect 1424293 (the ID of this bug)

Is that all okay? Let me know if there's anything else I can do to help.

apport information

apport information

apport information

apport information

apport information

apport information

VJ Patel, could you please test the latest upstream kernel available from the very top line at the top of the page (the release names are irrelevant for testing, and please do not test the daily folder) following https://wiki.ubuntu.com/KernelMainlineBuilds ? It will allow additional upstream developers to examine the issue.

If the test did not allow you to test to the issue (ex. you couldn't boot into the OS) please make a comment in your report about this, and continue to test the next most recent kernel version until you can test to the issue. Once you've tested the upstream kernel, please comment on which kernel version specifically you tested. If this bug is fixed in the mainline kernel, please add the following tags by clicking on the yellow circle with a black pencil icon, next to the word Tags, located at the bottom of the report description:
kernel-fixed-upstream
kernel-fixed-upstream-X.Y-rcZ

Where XY and Z are numbers corresponding to the kernel version.

If the mainline kernel does not fix this bug, please add the following tags:
kernel-bug-exists-upstream
kernel-bug-exists-upstream-X.Y-rcZ

Once testing of the upstream kernel is complete, please mark this bug's Status as Confirmed. Please let us know your results.

Thank you for your understanding.

description: updated
Changed in linux (Ubuntu):
importance: Low → Medium
VJ Patel (meetthevj) wrote :

Hi Christopher (penalvch),

I have installed this mainline kernel http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.1-rc4-unstable/

I was able to boot into the OS, check I was using the latest kernel (output of uname -a: Linux Ubuntudore 4.1.0-040100rc4-generic #201505181436 SMP Mon May 18 18:38:10 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux)

Unfortunately I was still unable to use two finger scrolling on the trackpad and didn't experience any change in the trackpad behaviour from the 3.19.0-18 kernel I was on before.

I'll add the tags and mark the status as confirmed now.

Changed in linux (Ubuntu):
status: Incomplete → Confirmed
tags: added: kernel-bug-exists-upstream kernel-bug-exists-upstream-4.1-rc4

VJ Patel, the issue you are reporting is an upstream one. Could you please report this problem to the appropriate mailing list (linux-input) by following the instructions verbatim at https://wiki.ubuntu.com/Bugs/Upstream/kernel ?

Please provide a direct URL to your e-mail to the mailing list once you have made it so that it may be tracked via http://vger.kernel.org/vger-lists.html . It can take a day for the new e-mail to show up in the respective archive.

Thank you for your understanding.

Changed in linux (Ubuntu):
status: Confirmed → Triaged
VJ Patel (meetthevj) wrote :

Hi Christopher (penalvch),

I think I have done all of that correctly.

Thank you for your help so far!

VJ Patel, if you have done all of that correctly, then you would have posted here a URL to your upstream e-mail to the linux-input mailing list.

VJ Patel (meetthevj) wrote :

Hi Christopher,

Sorry I think I'm waiting for the email to show up into the archive. I sent a plain text email in the format described you provided the link for to <email address hidden> and subscribed to the mailing list.

Is that correct?

VJ Patel (meetthevj) wrote :

Here is a URL to the email thread on the mailing list.

http://www.spinics.net/lists/linux-input/msg38810.html

Michel-Ekimia (michel.ekimia) wrote :

Thanks all for working on this touchpad that affect me a lot.

BYD said that their touch pad is compatible with linux, did anybody got in touch with them ?

Michel-Ekimia (michel.ekimia) wrote :

Impossible to find a contact for BYD other than by a chinese phone number....

I'm sure thay have the full needed code to include this touchpad.

Michel-Ekimia (michel.ekimia) wrote :

here is the pdf from BYD that might help

Yes BYD have been contacted. No reply :-(

Raedwulf (tcmreastwood-gmail) wrote :

I've just finished writing a driver for my BYD touchpad over the weekend. I'll need people to test it :)

Raedwulf (tcmreastwood-gmail) wrote :

I hadn't noticed that Chris Diamand had written a driver too - comparing it with my implementation!

Michel-Ekimia (michel.ekimia) wrote :

Thanks Raedwulf (tcmreastwood-gmail) , will try your driver today.

Raedwulf, I have a laptop with the BYD Trackpad and wanted to test your patch. I applied your changes to the ubuntu-wily kernel source but encountered the following error while rebuilding:

  CC [M] drivers/input/mouse/byd.o
/home/martin/Kernel/ubuntu-wily/drivers/input/mouse/byd.c:159:5: error: redefinition of ‘byd_init’
 int byd_init(struct psmouse *psmouse)
     ^
In file included from /home/martin/Kernel/ubuntu-wily/drivers/input/mouse/byd.c:33:0:
/home/martin/Kernel/ubuntu-wily/drivers/input/mouse/byd.h:23:19: note: previous definition of ‘byd_init’ was here
 static inline int byd_init(struct psmouse *psmouse)
                   ^
/home/martin/Kernel/ubuntu-wily/drivers/input/mouse/byd.c:284:5: error: redefinition of ‘byd_detect’
 int byd_detect(struct psmouse *psmouse, bool set_properties)
     ^
In file included from /home/martin/Kernel/ubuntu-wily/drivers/input/mouse/byd.c:33:0:
/home/martin/Kernel/ubuntu-wily/drivers/input/mouse/byd.h:18:19: note: previous definition of ‘byd_detect’ was here
 static inline int byd_detect(struct psmouse *psmouse,
                   ^
/home/martin/Kernel/ubuntu-wily/scripts/Makefile.build:258: recipe for target 'drivers/input/mouse/byd.o' failed
make[5]: *** [drivers/input/mouse/byd.o] Error 1
/home/martin/Kernel/ubuntu-wily/scripts/Makefile.build:403: recipe for target 'drivers/input/mouse' failed
make[4]: *** [drivers/input/mouse] Error 2
/home/martin/Kernel/ubuntu-wily/scripts/Makefile.build:403: recipe for target 'drivers/input' failed
make[3]: *** [drivers/input] Error 2

I'm building the kernel as per these instructions.

  * https://wiki.ubuntu.com/Kernel/BuildYourOwnKernel

Any chance you can shed some light on this please?

In byd.h I think `#ifdef CONFIG_MOUSE_BYD` should be `#ifdef CONFIG_MOUSE_PS2_BYD`.

I've submitted a pull request to Raedwulf's 'byd' branch.

  * https://github.com/raedwulf/linux/pull/1

I've successfully built the ubuntu-wily kernel with this driver added and can confirm that multi touch and gestures are working. I've also attached a diff for the ubuntu-wily kernel source.

  * git://kernel.ubuntu.com/ubuntu/ubuntu-precise.git

Ugh, the comment above should say:

  * git://kernel.ubuntu.com/ubuntu/ubuntu-wily.git

tags: added: patch
Michel-Ekimia (michel.ekimia) wrote :

Thanks Martin, Could you deliver this as DKMS package so we could use it on any distro/kernel ?

A kernel for 15.10, including this patch, is available for testing here:

  * https://launchpad.net/~flexiondotorg/+archive/ubuntu/kernel-stuff

Chris Diamand (chuis) wrote :

A driver for this has been added upstream - see Linux kernel commits 98ee377144935857d8ad5d7d70cdab1da4ede32e and 98ee377144935857d8ad5d7d70cdab1da4ede32e.

Changed in linux (Ubuntu):
status: Triaged → Fix Committed
Michel-Ekimia (michel.ekimia) wrote :

Chris , this a great thanks for everybody's work, but I guess we can say "Fixed" when it will land on Ubuntu 16.10 I guess ?

Chris Diamand (chuis) wrote :

Yep - I changed the bug status to "Fix committed" which I think makes the most sense - it's committed upstream but as you say won't be fixed properly in Ubuntu until they update to a newer kernel version (or backport it).

Michel-Ekimia (michel.ekimia) wrote :

Ok I thought "fixed commited" was meant for Ubuntu archive but you are right , this is for upstream . Thanks

Not Fix Committed as defined in https://wiki.ubuntu.com/Bugs/Status.

Changed in linux (Ubuntu):
status: Fix Committed → Triaged
tags: added: cherry-pick

@penalvch - I'm running this kernel, which I believe has your BYD patch included.

  * http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.6-rc7-yakkety/

dmesg tells me the following:

[ 2.379157] mousedev: PS/2 mouse device common for all mice
[ 238.400656] psmouse serio1: byd: Unrecognized Z: pkt = 09 00 00 ce
[ 238.400666] psmouse serio1: TouchPad at isa0060/serio1/input0 lost sync at byte 4
[ 238.420196] psmouse serio1: TouchPad at isa0060/serio1/input0 - driver resynced.

However, the BYD trackpad supports very few features. Multi finger touch is not recognised, multi finger swipe is not recognised. I cursious to understand why you didn't base the BYD patch you submitted to the kernel on this one the following?

  * https://github.com/raedwulf/linux/tree/byd

It has had several contributors and all features of the BYD trackpad work correctly.

Michel-Ekimia (michel.ekimia) wrote :

Just tested 4.8 on Ubuntu 16.04.2

Multitouch option is greyed out in setting and not working

dmesg seems to show that it is detected normally ( not the kind of errors like martin )

Michel-Ekimia (michel.ekimia) wrote :

Sadly it seems the touchpad BYD will even not be detected anymore in next 4.8 kernel ?

#1687256

Kai-Heng Feng (kaihengfeng) wrote :

$ sudo sh -c 'echo -n "byd" > /sys/bus/serio/devices/serio1/drvctl'

Does it work?

Kai-Heng Feng (kaihengfeng) wrote :

Please replace "drvctl" with "protocol" in last comment.

I've tested 17.04 and 17.10 and can confirmed that the BYD trackpad is not detected at all anymore. I've had some success using the DKMS version of the driver:

  * https://github.com/jayk/psmouse-bydfull-dkms

Kai-Heng Feng (kaihengfeng) wrote :

Hi guys,
Can you share your machine's vendor name and product name?

Manufacturer is Pcspecialist and product is Lafite laptop (2015)

Thanks for you help, can you advise how to apply this permanently please?

On 11/05/2017 15:00, Kai-Heng Feng wrote:
> Hi guys,
> Can you share your machine's vendor name and product name?
>

Kai-Heng Feng (kaihengfeng) wrote :

I am working on one, which will need to use DMI string to match the right machine. But the dmi string here is not branded. Can you ask the vendor to provide a new BIOS with distinguishable vendor/product name?

Michel-Ekimia (michel.ekimia) wrote :

Actually the factory is TopStar China and the model is U731.

As detection was disabled for good reason, the bast would be to have some config files to force detection only on machines where the user know that he needs this driver

Kai-Heng Feng (kaihengfeng) wrote :

Please try systemd here: http://people.canonical.com/~khfeng/lp1424293/
It's built for Xenial.

If it does not work, please attach `udevadm info -e`.

What detection was disabled and what was the good reason?

Chris Diamand (chuis) wrote :

Hi!

Automatic detection of BYD touchpads was sadly disabled at the end of last year. They can be still be used by forcing the protocol manually as described by Kai-Heng Feng above.

The reason for disabling detection was that the detection code generated false positives with normal PS/2 mice (meaning that some people's normal mice didn't work, because they were detected as BYD touchpads instead). This obviously isn't good.

I investigated using DMI data to restrict probing to only machines which have that touchpad. However, the values were too generic - see https://patchwork.kernel.org/patch/9423801/

The patch disabling probing is here: https://patchwork.kernel.org/patch/9424421/

Potential solutions are:
- Persuade OEMs shipping these touchpads to provide sensible DMI values
- Experiment with the driver to see if the touchpad will identify itself reliably *in a way which can't be interpreted as normal PS/2 commands by a PS/2 mouse*.

Regards,
Chris

Kai-Heng Feng (kaihengfeng) wrote :

So I made systemd-udevd in comment #59 has the ability to use byd psmouse protocol via hwdb.

To post a comment you must log in.