# Disabling touchscreen



## davidgurvich (Mar 18, 2021)

I've noticed something strange with a damaged touchscreen.  When I disable with "xinput --disable" it's only temporary.  Quickly changes to enabled within 20 seconds.  Is there a way to disable an input device for a session?

Update: Couldn't find a trivial way so moved the kernel module.  That works fine for my purposes but I'm sure there's some better way.


----------



## CuatroTorres (Mar 18, 2021)

You tried `--set-prop <device> "Device Enabled" 0` although it should be equivalent.

You're setting the right device or reactivating all devices after a wrong device. I'm just rambling without any concise information.
You can try disabling it in Xorg, not just for session, blacklisting, making a script or contacting the developer.


----------



## scottro (Mar 18, 2021)

I have a yoga2, which, on the main console, spits out a bunch of messages about the touchscreen. I can stop it by running
`usbconfig -d 0.4 power_off`

If it were always 0.4, I'd put it in /usr/local/etc/rc.d, but it varies, depending upon if I have the powercord on, a USB drive inserted, and so on. So I just made a little script, using -d 0.$ and then I can type elan.sh 4 or whichever USB is giving the problem. (I call it elan.sh because the garbage message is somethink like usb.4 <ELAN> something.

So if the touchscreen mentions a USB port in the message, I would try that usbconfig command. If it's always the same port, you could put it in cron with an @reboot, /etc/rc.local, or /usr/local/etc/rc.d/<command> which I think is preferred over /etc/rc.local which *might* be deprecated. But I'm not sure of that.  Anyway this all relies upon a USB port being mentioned in the error message. If it's not, I wasted your time and apologize for doing so.


----------



## davidgurvich (Mar 18, 2021)

When I use xinput --list-props I can see that the touchscreen was successfully disabled, Enabled=0, but shortly afterwards becomes Enabled=1.  Similarly, I can kdlunload the module but until I moved the .ko file it would auto reload.

I do see a message for usbgen referring to the touchscreen.  I'll look into that later.  Not sure that it's always the same number.  It's an elantouch.  

I also tried a sysctrl to disable hw.psm.elantouch_support but that doesn't seem to have any effect.  Not sure what this particular control does.


----------



## scottro (Mar 18, 2021)

The message I'm referring to is one that I see as it boots, and continues blocking the screen after it gets to login prompt

```
ugen0.4:  <ELAN Touchscreen> at usbus0
```

If you're getting something like that, then my solution might be of use. Otherwise, probably not.


----------



## davidgurvich (Mar 18, 2021)

I don't recall the exact number but very similar. I think ugen1.3.  I'll give it a try later.

UPDATE: "usbconfig -d 'device number' power_off" works. I'm guessing this number will stay the same until I start adding or removing usb devices.


----------



## scottro (Mar 18, 2021)

Excellent. Glad it helped. Like I said, rather than worrying about the number, I just have a little script, but with all the junk on the screen, I have to look at the keys as I log in, and then type elan.sh 4 (or whatever number is needed).


----------

