# My touchpad is completely undetectable by 10.3-STABLE and 11-CURRENT



## Oleg_NYC (May 11, 2016)

I have a strange issue. I own this particular laptop: http://www.newegg.com/Product/Product.aspx?Item=N82E16834298945 and FreeBSD 10.3-STABLE, 11-CURRENT and 10.3-RELEASE don't recognize this touchpad. It's not even recognizable as a generic PS/2 mouse. No matter how many suggestions I followed (such as putting hw.psm.synaptics_support="1" in loader.conf or modifying xorg.conf), this touchpad remains completely undetectable on either X or the console by the versions of FreeBSD that I mentioned above. These versions of FreeBSD never created a psm0 device in the /dev directory. However, FreeBSD 9.3-RELEASE did detect this touchpad as a generic PS/2 mouse! When I typed 
	
	



```
dmesg | grep psm
```
 after loading 9.3-RELEASE, I got this: 
	
	



```
psm0: <PS/2 Mouse> irq 12 on atkbdc0
psm0: [GIANT-LOCKED]
psm0: model Generic PS/2 mouse, device ID 0
```
 . Then I am able to use the touchpad after executing the moused command. So, please explain to me what I can do to get rid of this issue on 11-CURRENT or 10.3-STABLE. All I want is for one of these versions to recognize this touchpad as a generic PS/2 mouse.


----------



## shepper (May 12, 2016)

I would start by trying to determine if you have a Synaptics or Elantech or ALPS touchpad.  sysutils/dmidecode may be of some help.  Alternatively, the touchpad make/model may be in Dell's documentation or possibly found via Windows drivers.  Some touchpads need firmware, so the next step would be verify the correct firmware is installed.

I would then post the make/model in this thread.  Some web searches with "FreeBSD" and the touchpad model might also help.


----------



## Oleg_NYC (May 12, 2016)

The OpenBSD kernel (ver. 5.9) recognizes it as a synaptics touchpad. Various web pages also seem to suggest it's a synaptics touchpad. I can't find any info about what model it is.


----------



## shepper (May 12, 2016)

There is a touchpad howto Thread 54872 based on recent FreeBSD versions.  The author installed two packages I did not see mentioned in your first post, generated and xorg.conf and had some problems if moused was enable.  Should be worth trying.


----------



## Oleg_NYC (May 12, 2016)

Well, the author of that thread assumes that /dev/psm0 actually exists (in his xorg.conf he mentions Option  "Device" "/dev/psm0"); however, as I said in my first post, 10.x-stable and 11-current always failed to create /dev/psm0 on my laptop.
But this situation seems ridiculous. FreeBSD 9.3-RELEASE can detect this touchpad. OpenBSD 5.9 can also detect it (it detects it as a Synaptics clickpad, firmware 8.1). Various Linux distros can detect it too. Yet 10.x-stable and 11-current utterly fail to detect it in any shape or form.


----------



## tingo (May 12, 2016)

Then you should report the problem, by opening a Bug Report. If you include enough information showing that FreeBSD 9.3 can detect the touchpad, and later releases can not, it should be fairly easy to convince any interested developers that the bug is real.


----------



## Oleg_NYC (May 13, 2016)

I created a bug report. Let's hope that some kind soul will take a look at it and do something about this issue.


----------



## tingo (May 14, 2016)

If you post the number of the Bug Report (or a link) in this thread it will get a bit more exposure, too.


----------



## Oleg_NYC (May 14, 2016)

Here it is: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=209473 . I am not sure this is the proper way to create a report, given the fact that I left things there such as code and /code, file and /file.


----------



## Oleg_NYC (May 18, 2016)

adding 
	
	



```
hint.psm.0.flags
```
 to device.hints doesn't help me at all. "0x1000", "0x3000", or "0x2000" values don't fix the problem at all. What dramatic change happened between 9.3-RELEASE and 10.0-RELEASE that it caused FreeBSD to stubbornly refuse to recognize my touchpad even as a basic PS/2 mouse?


----------



## Oleg_NYC (May 20, 2016)

I booted the kernel in the verbose mode, typed `dmesg | grep psm` , and got this output: 
	
	



```
psm0: unable to allocate IRQ
```
  After googling, I found this: https://lists.freebsd.org/pipermail/freebsd-stable/2015-February/081757.html . According to what that person wrote, this problem can happen because of a buggy BIOS bytecode. He wrote about the steps that he had taken in order to resolve this issue, but I don't know anything about the ASL language. He mentioned PS2M, so let me show you some of the asl code that I obtained after dumping DSDT tables from memory:


```
Device (PS2M)

        {
            Method (_HID, 0, Serialized)  // _HID: Hardware ID
            {
                Name (_T_0, Zero)  // _T_x: Emitted by ASL Compiler
                If ((MODN == 0x05) && (BDID <= 0x02))
                {
                    While (One)
                    {
                        _T_0 = HIDN /* \HIDN */
                        If (_T_0 == One)
                        {
                            Return ("DLL0651")
                        }
                        ElseIf (_T_0 == 0x02)
                        {
                            Return ("DLL0652")
                        }
                        ElseIf (_T_0 == 0x03)
                        {
                            Return ("DLL0653")
                        }
                        Else
                        {
                            Return ("0000000")
                        }

                        Break
                    }
                }
                Else
                {
                    Return (0x09062E4F)
                }
            }

            Method (_CID, 0, NotSerialized)  // _CID: Compatible ID
            {
                If ((MODN == 0x05) && (BDID <= 0x02))
                {
                    Return (Package (0x02)
                    {
                        0x130FD041,
                        0xA906
                    })
                }
                Else
                {
                    Return (Package (0x03)
                    {
                        0x00062E4F,
                        0x02002E4F,
                        0x130FD041
                    })
                }
            }

            Method (_STA, 0, NotSerialized)  // _STA: Status
            {
                If ((OSTP != 0x81) || (MFGM != Zero))
                {
                    Return (0x0F)
                }
                Else
                {
                    Return (Zero)
                }
            }

            Name (CRS, ResourceTemplate ()
            {
                IRQNoFlags ()
                    {12}
            })
            Method (_CRS, 0, NotSerialized)  // _CRS: Current Resource Settings
            {
                Return (CRS) /* \_SB_.PCI0.LPCB.PS2M.CRS_ */
            }
        }

        Device (PS2K)
        {
            Name (_CID, EisaId ("PNP0303") /* IBM Enhanced Keyboard (101/102-key, PS/2 Mouse) */)  // _CID: Compatible ID
            Method (_HID, 0, Serialized)  // _HID: Hardware ID
            {
                Name (_T_0, Zero)  // _T_x: Emitted by ASL Compiler
                If (MIS3 == 0x81)
                {
                    While (One)
                    {
                        _T_0 = HIDN /* \HIDN */
                        If (_T_0 == One)
                        {
                            Return ("DLLK0651")
                        }
                        ElseIf (_T_0 == 0x02)
                        {
                            Return ("DLLK0652")
                        }
                        ElseIf (_T_0 == 0x03)
                        {
                            Return ("DLLK0653")
                        }
                        Else
                        {
                            Return ("00000000")
                        }

                        Break
                    }
                }
                Else
                {
                    Return (0x0303D041)
                }
            }

            Name (CRS, ResourceTemplate ()
            {
                IO (Decode16,
                    0x0060,             // Range Minimum
                    0x0060,             // Range Maximum
                    0x10,               // Alignment
                    0x01,               // Length
                    )
                IO (Decode16,
                    0x0064,             // Range Minimum
                    0x0064,             // Range Maximum
                    0x04,               // Alignment
                    0x01,               // Length
                    )
                IO (Decode16,
                    0x0062,             // Range Minimum
                    0x0062,             // Range Maximum
                    0x02,               // Alignment
                    0x01,               // Length
                    )
                IO (Decode16,
                    0x0066,             // Range Minimum
                    0x0066,             // Range Maximum
                    0x06,               // Alignment
                    0x01,               // Length
                    )
                IRQNoFlags ()
                    {1}
            })
            Method (_CRS, 0, NotSerialized)  // _CRS: Current Resource Settings
            {
                Return (CRS) /* \_SB_.PCI0.LPCB.PS2K.CRS_ */
            }

            Method (_REG, 2, NotSerialized)  // _REG: Region Availability
            {
                ^^^GFX0.CLID = One
            }
        }
    }
```

Do you see any bug in this code that I could fix in order to get rid of this problem? Please help.


----------



## lonestar (May 20, 2016)

oleglelchuk said:


> Well, the author of that thread assumes that /dev/psm0 actually exists (in his xorg.conf he mentions Option  "Device" "/dev/psm0"); however, as I said in my first post, 10.x-stable and 11-current always failed to create /dev/psm0 on my laptop.
> But this situation seems ridiculous. FreeBSD 9.3-RELEASE can detect this touchpad. OpenBSD 5.9 can also detect it (it detects it as a Synaptics clickpad, firmware 8.1). Various Linux distros can detect it too. Yet 10.x-stable and 11-current utterly fail to detect it in any shape or form.



Hey there, this is the author of that how-to post. 

I can tell you that in order for me to use the synaptics touchpad features, I had to install xf86-input-synaptics and libsynaptics from ports, not packages. I'm not sure why, I didn't customize any build options at all. But ports worked while packages did not. 

I'm not sure what else to add that would be of use, but I would be happy to answer any specific questions to help if possible.


----------



## Oleg_NYC (May 20, 2016)

Thank you for offering your help, but I highly doubt that if I follow your how-to, I will get any results. You always had /dev/psm0 on your system which means you could always use your touchpad as a basic PS/2 mouse. In my case, I can't do it. If someone could tell me how to fix that asl code that I showed you here, I would appreciate it a lot.


----------



## shepper (May 20, 2016)

Two thoughts in regards to a buggy bios:
  1)  There is a bios update for that machine.
  2)  Does the bios have some options to assign the irq?  Can you disable any unused irq's like legacy usb support?
There was also a another thread where an input device would not configure unless a usb mouse was plugged in.


----------



## Oleg_NYC (May 20, 2016)

A while ago, I updated from BIOS version A08 to version A10 after downloading exe from this page: http://www.dell.com/support/home/us...-15-3542-laptop&languageCode=en&categoryId=BI . The BIOS doesn't have options such as legacy usb support.
 What do you mean when you say "an input device would not configure unless a usb mouse was plugged in"? Of course, when I plug in a USB mouse, it is recognized just fine, and I can immediately use it, but I want to be able to use the touchpad.


----------



## shepper (May 20, 2016)

oleglelchuk said:


> What do you mean when you say "an input device would not configure unless a usb mouse was plugged in"?


Thread 55817


----------



## Oleg_NYC (May 21, 2016)

I finally succeeded in getting this touchpad recognized as a basic PS/2 mouse! I did it by editing all the "Return" lines in the PS2K section of the asl code. For example, the line `Return ("DLLK0651")` was replaced with the line `Return ("")` . I compiled the asl file and made loader.conf aware of the resulting aml file. Finally, /dev/psm0 came into existence!
Of course, I have no idea if this hack can be considered good. The resulting aml file may have bugs. But the touchpad is working, so I am satisfied.


----------



## cpm@ (May 21, 2016)

Please, share your progress to bring more attention over this issue updating the PR 209473.


----------



## Oleg_NYC (May 21, 2016)

Done.


----------



## Oleg_NYC (May 25, 2016)

I should mention something here. Before I even started making any PS2K/PS2M-related changes to the decompiled code, I couldn't compile it back into the AML. I got a few compiler errors. So, I loaded a distro of Linux, dumped the DSDT tables from memory and for some mysterious reason, had a much easier time fixing all the errors in the code. Then I loaded FreeBSD 11 and applied the previously described PS2K/PS2M-related change to the file that I already fixed in the Linux environment. Everything was fine after reboot and /dev/psm0 was available. Then I thought to myself, "I shouldn't have the need to load Linux if I want to fix asl files." So, I executed `acpidump -d > my.asl` yet again, and started fixing the compiler errors (before even attempting to apply the PS2M/PS2K-related changes to the code). Well, I succeeded in fixing the errors this time (probably because I became more experienced). But after I applied to the file the PS2K-related change described in the previous post and rebooted, there was no /dev/psm0! Then I found this forum thread: http://www.tonymacx86.com/threads/ps2-not-working-after-installing-dsdt.53498 . I added the code shown in that thread to my asl file, compiled it, rebooted and /dev/psm0 became alive again. Now I am a bit puzzled. How is it even possible that I ended up with a slightly different asl file on Linux? Aren't the Linux commands `cat /sys/firmware/acpi/tables/DSDT > my.aml` and `iasl -d my.aml` supposed to be equivalent to the FreeBSD command `acpidump -d > my.asl`? The BIOS bytecode obtained from memory is the same no matter what OS you are running, and both the distro of Linux and FreeBSD 11 had the same version of iasl installed. Yet those `Return ("")` fixes applied to the Linux file caused FreeBSD to create /dev/psm0, while they did nothing to FreeBSD's own asl file. As mentioned, http://www.tonymacx86.com/threads/ps2-not-working-after-installing-dsdt.53498 is what actually helped me with FreeBSD's own asl file.
This is some weird stuff.


----------

