# Touch Panel Support



## Phil Davies (May 16, 2022)

I have recently started exploring the possibilities of BSD. I am having trouble getting a eGalax touch screen to work. I have exhausted all google searches and now reaching out to the BSD community for help finding a solution. I am running a basic X-Server and have  the initial touch event activating the menu. However, the mouse drag, window selection, web button press etc and any function normally associate with a touch screen is not working. I have chromium running and cannot navigate with button presses,

The 'evtest' shows that my touch btn event is registered, as shown below. What am I missing?


```
Available devices:
/dev/input/event0:      System mouse
/dev/input/event1:      System keyboard multiplexer
/dev/input/event2:      Power Button
/dev/input/event3:      USB Keyboard
/dev/input/event4:      Logitech USB Receiver, class 0/0, rev 2.00/29.01, addr 3
/dev/input/event5:      eGalax Inc. eGalaxTouch EXC3000-0638-43.00.00, class 0/0, rev 1.10/38.00, addr
/dev/input/event6:      Logitech USB Receiver, class 0/0, rev 2.00/29.01, addr 3
Select the device event number [0-6]: 5
Input driver version is 1.0.1
Input device ID: bus 0x3 vendor 0xeef product 0xc000 version 0x0
Input device name: "eGalax Inc. eGalaxTouch EXC3000-0638-43.00.00, class 0/0, rev 1.10/38.00, addr "
Supported events:
  Event type 0 (EV_SYN)
  Event type 1 (EV_KEY)
    Event code 272 (BTN_LEFT)
    Event code 273 (BTN_RIGHT)
    Event code 274 (BTN_MIDDLE)
  Event type 2 (EV_REL)
Properties:
  Property type 0 (INPUT_PROP_POINTER)
Testing ... (interrupt to exit)
Event: time 1652699058.720614, type 1 (EV_KEY), code 272 (BTN_LEFT), value 1
Event: time 1652699058.720614, -------------- SYN_REPORT ------------
Event: time 1652699058.807607, type 1 (EV_KEY), code 272 (BTN_LEFT), value 0
```

My Xorg.0.log also shows that the touch controller is registered.


```
[    51.095] (II) config/udev: Adding input device eGalax Inc. eGalaxTouch EXC3000-0638-43.00.00 (/dev/input/event5)
[    51.095] (**) eGalax Inc. eGalaxTouch EXC3000-0638-43.00.00: Applying InputClass "evdev pointer catchall"
[    51.095] (**) eGalax Inc. eGalaxTouch EXC3000-0638-43.00.00: Applying InputClass "libinput pointer catchall"
[    51.095] (II) Using input driver 'libinput' for 'eGalax Inc. eGalaxTouch EXC3000-0638-43.00.00'
[    51.095] (**) eGalax Inc. eGalaxTouch EXC3000-0638-43.00.00: always reports core events
[    51.095] (**) Option "Device" "/dev/input/event5"
[    51.095] (**) Option "_source" "server/udev"
[    51.101] (II) event5  - eGalax Inc. eGalaxTouch EXC3000-0638-43.00.00, class 0/0, rev 1.10/38.00, addr : is tagged by udev as: Mouse
[    51.105] (II) event5  - eGalax Inc. eGalaxTouch EXC3000-0638-43.00.00, class 0/0, rev 1.10/38.00, addr : device is a pointer
[    51.109] (II) event5  - eGalax Inc. eGalaxTouch EXC3000-0638-43.00.00, class 0/0, rev 1.10/38.00, addr : device removed
[    51.109] (**) Option "config_info" "udev:/dev/input/event5"
[    51.109] (II) XINPUT: Adding extended input device "eGalax Inc. eGalaxTouch EXC3000-0638-43.00.00" (type: MOUSE, id 11)
[    51.109] (**) Option "AccelerationScheme" "none"
[    51.109] (**) eGalax Inc. eGalaxTouch EXC3000-0638-43.00.00: (accel) selected scheme none/0
[    51.109] (**) eGalax Inc. eGalaxTouch EXC3000-0638-43.00.00: (accel) acceleration factor: 2.000
[    51.109] (**) eGalax Inc. eGalaxTouch EXC3000-0638-43.00.00: (accel) acceleration threshold: 4
[    51.115] (II) event5  - eGalax Inc. eGalaxTouch EXC3000-0638-43.00.00, class 0/0, rev 1.10/38.00, addr : is tagged by udev as: Mouse
[    51.119] (II) event5  - eGalax Inc. eGalaxTouch EXC3000-0638-43.00.00, class 0/0, rev 1.10/38.00, addr : device is a pointer
```


----------



## Phishfry (May 16, 2022)

Have you tried writing a xorg file for it? Can you move the cursor?








						Touchscreen support
					

I would like to buy a small monitor with touchscreen feature, e.g. this one or this one (non-affiliate Amazon links). Since I haven’t used a touchscreen with FreeBSD before, I have a few questions …  Does FreeBSD support the touchscreen feature of monitors like the ones above? (Apparently it’s...




					forums.freebsd.org


----------



## Phishfry (May 16, 2022)

There is a config to use for testing here (see below):








						eGalax Touchscreen on Debian 11, libinput playing with me
					

So maybe a rather esoteric problem, but I’ll post what I’m experiencing.  I have a Debian 11 system that I upgraded from Debian 9.  I got the latest driver from eGalax (eGalaxTouch Linux Driver - specifically https://www.eeti.com/touch_driver/Linux/20220318/eGTouch_v2.5.10703.L-x.tar.gz) and am...




					forum.level1techs.com
				




You should focus on a libinput conf file on FreeBSD.
The driver is working fine. You have input. Now you just need to point Xorg to the right settings.

/usr/local/etc/X11/xorg.conf.d/52-egalax-virtual-libinput.conf

```
Section "InputClass"
    Identifier "eGalax touch class"
    MatchProduct "eGalax Inc.|Touchkit|eGalax_eMPIA Technology Inc."
    MatchDevicePath "/dev/input/event*"
    Driver "void"
    Option "Ignore"
EndSection

Section "InputClass"
    Identifier "eGalax mouse class"
    MatchProduct "eGalax Inc.|Touchkit|eGalax_eMPIA Technology Inc.|eGalaxTouch Virtual Device"
    MatchDevicePath "/dev/input/mouse*"
    Driver "void"
    Option "Ignore"
EndSection

Section "InputClass"
    Identifier "eGalax joystick class"
    MatchProduct "eGalax Inc.|Touchkit|eGalaxTouch Virtual Device"
    MatchDevicePath "/dev/input/js*"
    Driver "void"
    Option "Ignore"
EndSection

Section "InputClass"
    Identifier "eGalax virtual class"
    MatchProduct "eGalaxTouch Virtual Device"
    MatchDevicePath "/dev/input/event*"
    Driver "libinput"
EndSection
```


----------



## Phishfry (May 16, 2022)

Phil Davies said:


> I am having trouble getting a eGalax touch screen to work.


Can you tell me if you are loading anything for this?
There is an eGalax driver but I am not sure if yours is coming up automatically or if you are loading the uep(4) driver.
You only showed a snippet of dmesg but I don't see what driver is loading. Do you see wmt0 device? hmt0 ? uep0 ?


----------



## Phishfry (May 16, 2022)

The eGalax conf file I snipped above is just for testing. I don't know if that virtual interface stuff works on FreeBSD.
We use libinput from the same source so it should.
You are going to need some level of X11 conf for touch to work.
For me all it took was 30-tap.conf but I am using the wmt0 driver. My tap is still not right but I have a starting point.
Double tap not working.

But you might need to try both of these. A touch screen config and tap config.

There is also this sysctl that seems to be involved in exposing devices.
sysctl kern.evdev.rcpt_mask=3
sysctl kern.evdev.rcpt_mask=6
Defaults to 12

From what I gander you want to try some of these. I did not need to.


----------



## Phil Davies (May 17, 2022)

Phishfry said:


> Can you tell me if you are loading anything for this?
> There is an eGalax driver but I am not sure if yours is coming up automatically or if you are loading the uep(4) driver.
> You only showed a snippet of dmesg but I don't see what driver is loading. Do you see wmt0 device? hmt0 ? uep0 ?


Thank you for helping. I must admit I'm struggling to make sense of this. 

I have installed a fresh FreeBSD 12.3-RELEASE r371126 GENERIC to remove any corruption. 
I have also received input from EETI and I have since found that the event test I did above is not providing the correct events.   

I think I should be seeing the X-Y positioning data. By adding wmt_load="YES" to loader.conf I can see see what looks to be the correct supported events, see below, and the wmt driver has loaded.


```
wmt0 on uhub1
wmt0: <eGalax Inc. eGalaxTouch EXC3000-0638-43.00.00, class 0/0, rev 1.10/38.00, addr 3> on usbus0
wmt0: 16 contacts and []. Report range [0:0] - [4095:4095]
```


```
No device specified, trying to scan all of /dev/input/event*
Available devices:
/dev/input/event0:      System mouse
/dev/input/event1:      System keyboard multiplexer
/dev/input/event2:      Sleep Button
/dev/input/event3:      eGalax Inc. eGalaxTouch EXC3000-0638-43.00.00, class 0/0, rev 1.10/38.00, addr
/dev/input/event4:      Logitech USB Receiver, class 0/0, rev 2.00/29.01, addr 4
/dev/input/event5:      USB Keyboard
/dev/input/event6:      Logitech USB Receiver, class 0/0, rev 2.00/29.01, addr 4
Select the device event number [0-6]: 3
Input driver version is 1.0.1
Input device ID: bus 0x3 vendor 0xeef product 0xc000 version 0x0
Input device name: "eGalax Inc. eGalaxTouch EXC3000-0638-43.00.00, class 0/0, rev 1.10/38.00, addr "
Supported events:
  Event type 0 (EV_SYN)
  Event type 1 (EV_KEY)
    Event code 330 (BTN_TOUCH)
  Event type 3 (EV_ABS)
    Event code 0 (ABS_X)
      Value      0
      Min        0
      Max     4095
      Resolution       9
    Event code 1 (ABS_Y)
      Value      0
      Min        0
      Max     4095
      Resolution      17
    Event code 47 (ABS_MT_SLOT)
      Value      0
      Min        0
      Max        9
    Event code 53 (ABS_MT_POSITION_X)
      Value      0
      Min        0
      Max     4095
      Resolution       9
    Event code 54 (ABS_MT_POSITION_Y)
      Value      0
      Min        0
      Max     4095
      Resolution      17
    Event code 57 (ABS_MT_TRACKING_ID)
      Value      0
      Min        0
      Max       31
```

However the evtest captures no events when the screen is touched. 

Prior to this a ums0 driver was loading, see below, and providing mouse touch events as previously posted.


```
ums0 on uhub1
ums0: <eGalax Inc. eGalaxTouch EXC3000-0638-43.00.00, class 0/0, rev 1.10/38.00, addr 3> on usbus0
ums1 on uhub1
```

This isn't straightforward.


----------



## Phishfry (May 17, 2022)

Phil Davies said:


> This isn't straightforward.


Yes I have been failing at this for a while. I have a lot of Dell Tablets I think will work.

I am working up the chain. Started with Visix, 10 inch, Got cursor and then stuck.
Moved to FTR Touch. A real old touch screen display. Found it needed tap.conf.
Bingo. Single tap working.
I will say I did not need to load the wmt driver. It was loaded automatically.
I am not sure you should be forcing it.
I say go back to original setup and add a tap.conf and mess with the sysctls.


----------



## Phishfry (May 17, 2022)

A couple of notes.
Here is the fab that Mr Wulf started to get libinput going.





						⚙ D6998 input event interface implementation
					






					reviews.freebsd.org
				




I read one place that xf86-input-evdev in not required.
Only libinput is needed and it is built by default with Xorg.

If you look at the manual for libinput(4) it gives you a protoype.

```
Section "InputDevice"
     Identifier "devname"
     Driver    "libinput"
     Option    "Device"   "devpath"
     ...
     EndSection
```

Now lets compare that to what I scraped together:

/usr/local/etc/X11/xorg.conf.d/10-touch.conf I renamed my config.

```
Section "InputClass"
Identifier "touchpad"
Driver "libinput"
  MatchIsTouchpad "on"
  Option "Tapping" "on"
  Option "NaturalScrolling" "on"
  Option "ClickMethod" "clickfinger"
EndSection
```

You have to tell Xorg to use libinput driver for the touchpad. Create the above file and see what happens.
This is bare minimum.


----------



## Phishfry (May 17, 2022)

Did you find this forum post? It has working configuration:








						Trying to get eGalax or DMC TSC-30 touchscreens to work in FreeBSD
					

I am running FreeBSD 12.1-RELEASE off a USB drive that I can jump between two computers flawlessly. One with an eGalax touchscreen and another with a TSC-30 DMC. I have been through about everything a Google search will feed me, including...




					forums.freebsd.org
				




It looks like evdev is used.


----------



## Phishfry (May 18, 2022)

Well Good News. I decided to move on to next challenge.
IEI 7" Touch Screen








						AFL3-W07A-BT panel pc | IEI industrial computer
					

Smart Home Best Choice The AFL3-W07A-BT Panel PC is your best choice for the smart home solution. You can control over your entire home from the Finger-Friendly Design touch screen. It can be surface-mounted on a wall, rear panel-mount, desk-mount, and the compact size at 7” can be placed almost...




					www.ieiworld.com
				




Look what the touch screen controller uses:

```
ugen0.3: <eGalax Inc. eGalaxTouch EXC3132-2123-06.00.00> at usbus0
igb0: link state changed to UP
ums0 on uhub0
ums0: <eGalax Inc. eGalaxTouch EXC3132-2123-06.00.00, class 0/0, rev 1.10/23.01, addr 2> on usbus0
```

I found a nice datasheet for mine EXC3132. It uses i2C so it might use the hmt driver.

The EXC3000 appears to be i2C as well.
So for testing you might want to try `kldload hmt`
See if any devices get registered.


----------



## Phil Davies (May 18, 2022)

Thanks for your help and guidance. Yes good news that you too have a similar eGalax solution.

Also, good news for me. I now have a working eGalax touchscreen, although I still need to figure out how to configure to start on boot. The major breakthrough came with webcamd. 

Running webcamd -l gave me

```
Available device(s):
webcamd [-d ugen0.1] -N 0x8086-XHCI-root-HUB -S unknown -M 0
webcamd [-d ugen0.2] -N vendor-0x0424-product-0x4604 -S unknown -M 0
webcamd [-d ugen0.3] -N Realtek-USB-10-100-1000-LAN -S 000001 -M 0
webcamd [-d ugen0.5] -N vendor-0x0424-Bridge-device -S unknown -M 0
webcamd [-d ugen0.6] -N Logitech-USB-Keyboard -S unknown -M 0
webcamd [-d ugen0.7] -N Logitech-USB-Receiver -S unknown -M 0
webcamd [-d ugen0.4] -N eGalax-Inc--eGalaxTouch-EXC3000-0638-43-00-00 -S unknown -M 0
```

running ```webcamd -d ugen0.4 -N eGalax-Inc--eGalaxTouch-EXC3000-0638-43-00-00 -S unknown -M 0``` created the events

```
webcamd 2874 - - Attached to ugen0.4[0]
webcamd 2874 - - Creating /dev/input/event3
webcamd 2874 - - Creating /dev/input/event4
webcamd 2874 - - Creating /dev/input/js0
```

I now have a touch and pointer device registered.

```
Device:           eGalax Inc. eGalaxTouch EXC3000-0638-43.00.00
Kernel:           /dev/input/event3
Group:            4
Seat:             seat0, default
Size:             410x228mm
Capabilities:     touch
Tap-to-click:     n/a
Tap-and-drag:     n/a
Tap drag lock:    n/a
Left-handed:      n/a
Nat.scrolling:    n/a
Middle emulation: n/a
Calibration:      identity matrix
Scroll methods:   none
Click methods:    none
Disable-w-typing: n/a
Accel profiles:   n/a
Rotation:         n/a

Device:           eGalax Inc. eGalaxTouch EXC3000-0638-43.00.00 UNKNOWN
Kernel:           /dev/input/event4
Group:            5
Seat:             seat0, default
Capabilities:     pointer
Tap-to-click:     n/a
Tap-and-drag:     n/a
Tap drag lock:    n/a
Left-handed:      disabled
Nat.scrolling:    disabled
Middle emulation: n/a
Calibration:      identity matrix
Scroll methods:   none
Click methods:    none
Disable-w-typing: n/a
Accel profiles:   n/a
Rotation:         n/a
```

I was then able to capture the event3 touch and move events with evtest

The final part was trial and error with Xorg.conf to enable the touch device to work with X-Windows.


----------

