# SDL: Add envvar to disable touchpads independently

**URL:** <https://discourse.libsdl.org/t/sdl-add-envvar-to-disable-touchpads-independently/32773>\
**Category:** SDL Commits\
**Created:** [September 11, 2021, 2:50am UTC](https://discourse.libsdl.org/t/sdl-add-envvar-to-disable-touchpads-independently/32773 "2021-09-11T02:50:09Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![SDLPushPostBot](https://discourse.libsdl.org/user_avatar/discourse.libsdl.org/sdlpushpostbot/32/4370_2.png) [@SDLPushPostBot](https://discourse.libsdl.org/u/SDLPushPostBot)\
**Post date:** [September 11, 2021, 2:50am UTC](https://discourse.libsdl.org/t/sdl-add-envvar-to-disable-touchpads-independently/32773/1 "2021-09-11T02:50:09Z")

</div>

> <https://github.com/libsdl-org/SDL/commit/058c4d36b24a5739553209dc00c4fb61abde4f2f>

```diff
From 058c4d36b24a5739553209dc00c4fb61abde4f2f Mon Sep 17 00:00:00 2001
From: Jaylon Gowie <[EMAIL REDACTED]>
Date: Fri, 10 Sep 2021 20:55:49 -0500
Subject: [PATCH] Add envvar to disable touchpads independently

---
 src/video/vita/SDL_vitatouch.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/video/vita/SDL_vitatouch.c b/src/video/vita/SDL_vitatouch.c
index 810120b0b2..51684f593b 100644
--- a/src/video/vita/SDL_vitatouch.c
+++ b/src/video/vita/SDL_vitatouch.c
@@ -42,9 +42,15 @@ struct{
     float range;
 } force_info[SCE_TOUCH_PORT_MAX_NUM];
 
+char* disableFrontPoll = NULL;
+char* disableBackPoll = NULL;
+
 void 
 VITA_InitTouch(void)
 {
+ disableFrontPoll = SDL_getenv("VITA_DISABLE_TOUCH_FRONT");
+ disableBackPoll = SDL_getenv("VITA_DISABLE_TOUCH_BACK");
+
     sceTouchSetSamplingState(SCE_TOUCH_PORT_FRONT, SCE_TOUCH_SAMPLING_STATE_START);
     sceTouchSetSamplingState(SCE_TOUCH_PORT_BACK, SCE_TOUCH_SAMPLING_STATE_START);
     sceTouchEnableTouchForce(SCE_TOUCH_PORT_FRONT);
@@ -87,6 +93,10 @@ VITA_PollTouch(void)
     memcpy(touch_old, touch, sizeof(touch_old));
 
     for(port = 0; port < SCE_TOUCH_PORT_MAX_NUM; port++) {
+ / **Skip polling of Touch Device if environment variable is set** /
+ if (((port == 0) && disableFrontPoll) || ((port == 1) && disableBackPoll)) {
+ continue;
+ }
         sceTouchPeek(port, &touch[port], 1);
         if (touch[port].reportNum > 0) {
             for (int i = 0; i < touch[port].reportNum; i++)

```
