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



## JibJabM (Feb 8, 2020)

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:

```
https://www.reddit.com/r/freebsd/comments/7hvxhr/whats_the_state_of_touchscreen_support_for/
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=183032
https://www.freebsd.org/cgi/man.cgi?query=egalax&sektion=4&manpath=freebsd-release-ports
https://www.freebsd.org/cgi/man.cgi?query=uep&sektion=4&n=1
https://lists.freebsd.org/pipermail/freebsd-current/2016-March/059882.html
https://thehackerdiary.wordpress.com/2017/04/21/exploring-devinput-1/
http://denkrobat.de/doku.php?id=touchscreen
```

Seems like everything is for FreeBSD 8... or at most 11. I've tried it all but am getting nowhere. Is there current data on the right way to get these working?

If I `cat /dev/input/event0` - 5, I can see keyboard input on event0, and mouse input on event1 (no touchscreen input though... I checked event1 just in case)... but nothing on event 2 - 5.
/dev/uep0 doesn't exist.
uep is not listed under `kldstat`.
If I `kldload uep` I get:
`kldload: can't load uep: module already loaded or in kernel`
so I assume its loaded in kernel directly
`dmesg | grep eGalax` gives me:

```
uep0: <eGalax Inc. USB TouchController, class 0/0, rev 1.10/1.00, addr 2> on usbus0
```
uhhh... Okay... so where the heck is that uep0? `locate uep0` reveals nuthin'.
`usbconfig` gives:

```
ugen0.1: <0x8086 XHCI root HUB> at usbus0, cfg=0 md=HOST spd=SUPER (5.0Gbps) pwr=SAVE (0mA)
ugen0.2: <Dell Dell Universal Receiver> at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON (100mA)
ugen0.3: <eGalax Inc. USB TouchController> at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON (100mA)
ugen0.4: <Generic USB3.0 Card Reader> at usbus0, cfg=0 md=HOST spd=SUPER (5.0Gbps) pwr=ON (224mA)
```

I tried to `cat /dev/ugen0.3` and got

```
cat: ugen0.3: Input/output error
```
If uep0 really does exist... how do I find it?

I'm honestly confused by wmt, webcamd, usbconfig and x11-drivers/xf86-input-evdev... Do some of these tools daisychain? It seems like wmt replaces webcamd and evdev?

Please help. I've been able to debug so much of FreeBSD on my own, but this one has me stumped.


----------



## ethan (Feb 8, 2020)

Hi there, I'v used webcamd and evdev (or libinput, both are tested) to get my egalax touchscreen to work. You can refer to my post https://forums.freebsd.org/threads/...fter-suspend-resume-with-webcamd-driver.73984

But I'm having the problem of touchscreen not working after suspend/resume.

Hope it helps.


----------



## SirDice (Feb 10, 2020)

JibJabM said:


> I am running FreeBSD 12.1 CURRENT


That's not possible. You either have 12.1-RELEASE, 12.1-STABLE or 13.0-CURRENT. 12.1-CURRENT does not exist.


----------



## JibJabM (Feb 10, 2020)

SirDice said:


> That's not possible. You either have 12.1-RELEASE, 12.1-STABLE or 13.0-CURRENT. 12.1-CURRENT does not exist.


You are quite right my friend. 12.1-RELEASE it is. Editing my post.


----------



## JibJabM (Feb 10, 2020)

ethen said:


> Hi there, I'v used webcamd and evdev (or libinput, both are tested) to get my egalax touchscreen to work. You can refer to my post https://forums.freebsd.org/threads/...fter-suspend-resume-with-webcamd-driver.73984



Oh! Thanks for the lead! What is this sorcery?  

Since my eGalax doesn't have the same device name as yours, I tried the following...
`webcamd -l`
`Available device(s):
webcamd [-d ugen0.1] -N 0x8086-XHCI-root-HUB -S unknown -M 0
webcamd [-d ugen0.2] -N Dell-Dell-Universal-Receiver -S unknown -M 0
webcamd [-d ugen0.3] -N eGalax-Inc--USB-TouchController -S unknown -M 0
webcamd [-d ugen0.4] -N Generic-USB3-0-Card-Reader -S 000000001532 -M 0`
So I stripped the brackets, 
`webcamd -d ugen0.3 -N eGalax-Inc--USB-TouchController -S unknown -M 0`
`created /dev/input/event4
created /dev/input/event6`
ooooh... It took over my console... but if I open another SSH session and
`cat /dev/input/event4/`
IT'S ALIIIIIIIVVVEEE!!! I press on the touchscreen and I get input splattering all over the screen (just like event0 does for keyboard events, and event1 for mouse).
So I CTRL+Z to break the webcamd cmd and tried to run again with -B for background mode... But it says webcamd is already running for that device . I'm not sure how to kill/reset that, so I opted for the noob choice of restarting the computer. But that worked because -B works just fine now.
`webcamd -d ugen0.3 -N eGalax-Inc--USB-TouchController -S unknown -M 0 -B`
Not sure how I'm supposed to run this automatically on startup...
So I try to run xinit, which is configured only to run the program I want in full screen, and... no go... the touchscreen isn't controlling the cursor...
My research continues... but that's a good sign so far... I'll keep you guys updated (please give feedback if you can)


----------



## ethan (Feb 11, 2020)

Yep, it's webcamd that created event4 node. And you should set up your xorg.conf to use evdev driver to get your touchscreen perform like mouse. I guess it's evdev that is processing all the touch events (correct me if I'm wrong). But unfortunately in my case, only button 1 click event is emitted, meaning I can move the cursor around on the screen with finger and perform clicks. No matter how many fingers are on the screen, the cursor only follows the finger which lands on the screen first. Seems multitouch isn't working because there's only button 1 event. I'm on another computer, later I'm going to give you my xorg.conf setup. You should install xf86-input-evdev first, and btw, install evemu helps a lot. If you ever figure out how to make multitouch working, with which you probably can use more gestures like two finger scroll or something. I'm quite content with what I've got now.


----------



## ethan (Feb 11, 2020)

https://pastebin.com/t2JwH0QV 

xorg.conf, hope it helps. And refer to my post if you have touchscreen problem after suspend/resume. I've managed to find a work around. It's in my post reply.


----------



## JibJabM (Feb 11, 2020)

Okay, so I changed the Driver "egalax" to Driver "evdev" and touchscreen works perfectly now... I'm not sure if its full multitouch as I don't have a full windowing environment running to test... but if I do later, I'll let you know.

```
Section "ServerLayout"
        Identifier     "X.org Configured"
        Screen      0  "Screen0" 0 0
        InputDevice    "Mouse0" "CorePointer"
        InputDevice    "Keyboard0" "CoreKeyboard"
        InputDevice    "Touch0" "SendCoreEvents"
EndSection
Section "InputDevice"
        Identifier  "Touch0"
        Driver      "evdev"
        Option      "Device" "/dev/input/event4"
        Option      "Calibrate"
        Option      "ReverseY" "off"
EndSection
```

How did you get that webcamd daemon to load on boot?

It's nice to know the generic evdev driver worked for eGalax, because now I'm trying to get another computer with TSC-30 DMC touchscreen to work... if I run webcamd I see:

```
Available device(s):
webcamd [-d ugen0.1] -N 0x8086-XHCI-root-HUB -S unknown -M 0
webcamd [-d ugen0.2] -N vendor-0x0424-product-0x2514 -S unknown -M 0
webcamd [-d ugen0.3] -N TSC-30-DMC-product-0x03e8 -S unknown -M 0
webcamd [-d ugen0.4] -N Dell-Dell-Universal-Receiver -S unknown -M 0
webcamd [-d ugen0.5] -N Generic-USB3-0-Card-Reader -S 000000001532 -M 0
```
but if I run `webcamd -d ugen0.3 -N TSC-30-DMC-product-0x03e8 -S unknown -M 0` like I did for eGalax... I get

```
webcamd: Cannot find USB device
```
Say what now?! You just listed it ninny... I tried also ugen0.2, but that gave the same response.

Any ideas?


----------



## ethan (Feb 12, 2020)

To get webcamd load on boot, put `webcamd_enable="YES"` to rc.conf. And to automatically attach to your agalax device, you put `webcamd_0_flags="-N eGalax-Inc--eGalaxTouch-EXC3188-1515-09-00-00 -S unknown"` to rc.conf, as is shown in webcamd service script in /usr/local/etc/rc.d.

As per the other issue, first check `cuse` is loaded as module and give it a try again.


----------

