# Issues with my touchpad | Xiaomi notebook pro



## Deckard (Apr 26, 2019)

Hello,

I'm back to the FreeBSD community, and I reinstalled it (bye Linux for now). I managed to establish the Wi-Fi connection and get Xorg working.
However, I've got an issue with my touchpad, it doesn't seem to work. I searched through the forum, through the Wiki, and I always find the same informations/configurations which doesn't seem to work in my case.
The touchpad doesn't work in the tty, doesn't work in X.org.

I've read this wiki page : https://wiki.freebsd.org/SynapticsTouchpad
I've read several posts on this forum, which talk about different configurations in those files : 
- /etc/sysctl.conf :

```
kern.randompid=1
vfs.zfs.min_auto_ashift=12
hw.psm.synaptics.vscroll_hor_area=1300
hw.psm.trackpoint.sensitivity=205
hw.psm.trackpoint.upper_plateau=105
```

- /etc/rc.conf :

```
clear_tmp_enable="YES"
hostname="mybsd"
wlans_iwm0="wlan0"
ifconfig_wlan0="WPA DHCP"
sshd_enable="NO"
ntpd_enable="YES"
powerd_enable="YES"
# Set dumpdev to "AUTO" to enable crash dumps, "NO" to disable
dumpdev="AUTO"
zfs_enable="YES"
dbus_enable="NO"
hald_enable="NO"
gdm_enable="YES"
#webcamd_enable="YES"
kld_list="/boot/modules/i915kms.ko"
moused_enable="YES"
```
- /boot/loader.conf :

```
kern.vty=vt
aesni_load="YES"
geom_eli_load="YES"
kern.geom.label.disk_ident.enable="0"
kern.geom.label.gptid.enable="0"
zfs_load="YES"
snd_driver_load="YES"
kld_list="/boot/modules/i915kms.ko"
hw.psm.synaptics_support="1"
```
my first concerns is : is my touchpad even recognized ? I'm not sure about how to check that, cause it doesn't seem to use a PCI bus. And if it is recognized, how to make it work ? Does someone have a xiaomi laptop and have a BSD version on it ?

I saw a topic about a Xiaomi notebook air, and openbsd (https://jcs.org/2017/05/22/xiaomiair) and apparently it doesn't work. But thats' not the exact same configuration here.

PS : It worked on the several Linux distros I've tried.


----------



## tingo (Apr 26, 2019)

First you need to figure out how the touchpad is connected to your machine (electrically / logically, not physically). Many (most?) touchpads are usb connected, on FreeBSD you can figure that out with the `# usbconfig` command (the corresponding command in Linux is lsusb).
However, some touchpads are connected differently. If it is a PCI device, you can use `# pciconf -lv` to find it (Linux: lspci).
In rare cases, people has reported touchpads connected to another bus - these might not be supported in FreeBSD at all.

One easy way to figure it out is to boot your favorite Linux from a "live" USB memory stick and figure it out there, then you know what to look for in FreeBSD.


----------



## Deckard (Apr 26, 2019)

Hello !

Thank you for this answer !
Here is the result of usbconfig :

```
ugen0.1: <0x8086 XHCI root HUB> at usbus0, cfg=0 md=HOST spd=SUPER (5.0Gbps) pwr=SAVE (0mA)
ugen0.2: <vendor 0x8087 product 0x0a2b> at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON (100mA)
ugen0.3: <SunplusIT Inc XiaoMi USB 2.0 Webcam> at usbus0, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON (500mA)
ugen0.4: <Generic USB2.0-CRW> at usbus0, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON (500mA)
ugen0.5: <ELAN ELAN:Fingerprint> at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON (100mA)
ugen0.6: <Logitech USB Receiver> at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON (98mA)
```
It sees the fingerprint of the touchpad, but I don't really know if it sees the touchpad. I see the webcam, fingerprint, key dongle for my mouse, but I don't know what are the rest of them. I'm gonna take a look through the web.

I'm gonna put in attachment the result of my pciconf -lv because it's a bit verbous, and same, I'm gonna search through the web to get more informations. I'm gonna try the usb live stick in the afternoon to see how the Linux distros sees it.

Thanks ! I'll keep you updated.

UPDATE :

Still no information, I searched through my Linux distro, still no way to see if that's a PCI or USB bus device. It gives the same informations than FreeBSD. I think for now I'm gonna use my USB mouse. I'll keep searching during the week and I'll keep you in touch.

It seems to be a proprietary port, I think we can close the subject (ubuntu works with it cause it doesn't really care about free softwares).


----------



## Martin Paredes (May 22, 2019)

Try `dmesg | grep psm` or `dmesg | grep -i touch`


----------



## Deckard (May 22, 2019)

Hi there, thanks for the time you take to help !

Here is the result of the 2 commands :

```
deckard@mybsd:~ % dmesg |grep psm
psm0: <PS/2 Mouse> irq 12 on atkbdc0
psm0: [GIANT-LOCKED]
psm0: model Generic PS/2 mouse, device ID 0

deckard@mybsd:~ % dmesg |grep -i touch
deckard@mybsd:~ %
```
It seems that it sees only my USB-Mouse


----------



## Martin Paredes (May 22, 2019)

Deckard said:


> It seems that it sees only my USB-Mouse



No, psm(4) is a PS/2 mouse, ums(4) is a USB mouse

For me, your tochpad is a PS/2 device, to enable it, modify /etc/rc.conf


```
moused_enable="YES"
moused_type="ps/2"
moused_port="/dev/psm0"
```

At least it should work in the console with that modification

Edited: corrected my typo.


----------



## SirDice (May 22, 2019)

Just `moused_enable="YES"` should be enough (note that you have `moused_enabled` which is wrong; typo?), `moused_type` is set to "auto" by default and `moused_port` is already set to /dev/psm0 so no need to set explicitly.


----------



## Deckard (May 22, 2019)

Hi Martin Paredes, 

I made the modification in my /etc/rc.conf file, it doesn't work :/.
I've always seen the mouse pointer on the screen, even in the console mode, I just can't move it.


SirDice,
Nope, nothing's working, even with moused_enable. 

I have absoluetly no idea now


----------



## Martin Paredes (May 22, 2019)

Login as root in the console (Ctrl+Alt+F1) or a text terminal, kill the process of moused `killall moused`

Run `moused -df -t auto -p /dev/psm0`

This way you can check what moused(8) is receiving from psm(4), use the touchpad, click the buttons, use scroll.


----------



## Deckard (May 23, 2019)

Hi Martin,

I killed the process with the command, it worked like expected, my USB-Mouse doesn't work anymore, however, when I typed "moused -df -t auto -p /dev/psm0", here is the result : "moused: unable to open /dev/psm0: Device busy"


----------



## SirDice (May 23, 2019)

Make sure you kill the correct moused(8), there's one being automatically loaded for your USB mouse. There should be a second one attached to /dev/psm0. The error; "device busy", indicates there's already something attached to the device. My guess is that Xorg took hold of it. Stop Xorg, drop back to the shell first. The mouse should work on the console and Xorg will automatically pick that up as a 'sysmouse'.


----------



## Deckard (May 23, 2019)

You're right SirDice, Xorg was using this bus.

here is the result of my new try :
doas moused -df -t auto -p /dev/psm0
moused: proto params: f8 80 00 00 8 00 ff
moused: port: /dev/psm0 interface: ps/2 type: sysmouse model : generic

and it doesn't end the stdin, I can type or C^c

However, the touchpad still doesn't do anything with this :
moused_enable="YES"
moused_type="ps/2"
moused_port="/dev/psm0"

still enabled.


----------



## SirDice (May 23, 2019)

Deckard said:


> and it doesn't end the stdin, I can type or C^c


That's correct, it's started in debug mode, that makes it easier to see what's happening and were things might go wrong. Leave it running and move the mouse, click things, etc. You should see some information being printed if the mouse is correctly identified.


----------



## Deckard (May 23, 2019)

I did it again, there is no message showed in the stdin when I click, I think it doesn't see it at all...


----------



## Martin Paredes (May 23, 2019)

Apparently the touchpad is not connected by PS/2, it is connected by I2C, check the following link

First draft HID over I2C support (Mouse only)


----------



## Deckard (May 24, 2019)

Thanks Martin, I'll take a look and keep you up to date !

EDIT :

I've tried these modifications :
"
I'm applied this patch to my FreeBSD 12 r338342 box on Dell Latitude 5290 and applied this configuration to rc.conf:
kld_list="/boot/modules/i915kms.ko /boot/modules/iichid.ko /boot/modules/acpi_iichid.ko"
moused_port="/dev/ims0"
Also I changed device for mouse driver in xorg.conf:
Option      "Device" "/dev/ims0
"

Nothing changed, my usb mouse still work fine, however, the touchpad still doesn't work..


----------



## Dorubah (Aug 12, 2019)

Hi. I have a Xiaomi Mi Air and under archlinux the touchpad is listed under USB category as "ELAN Microelectronics" device. I ran in the same problem as you, unable to make it work on FreeBSD, but working on Linux.

Reporting this in case it's still relevant.


----------



## Deckard (Oct 4, 2019)

Dorubah said:


> Hi. I have a Xiaomi Mi Air and under archlinux the touchpad is listed under USB category as "ELAN Microelectronics" device. I ran in the same problem as you, unable to make it work on FreeBSD, but working on Linux.
> 
> Reporting this in case it's still relevant.



Hi, sorry I've been pretty busy ! thanks for this answer ! Now at least we know it's using a USB Bus, now we just have to figure how to make it work !


----------

