<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="../assets/xml/rss.xsl" media="all"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Knowledge Base (Posts about xinput)</title><link>https://bgstack15.ddns.net/blog/</link><description></description><atom:link href="https://bgstack15.ddns.net/blog/categories/xinput.xml" rel="self" type="application/rss+xml"></atom:link><language>en</language><copyright>Contents © 2022 &lt;a href="mailto:bgstack15@gmail.com"&gt;bgstack15&lt;/a&gt; 
&lt;a rel="license" href="https://creativecommons.org/licenses/by-sa/4.0/"&gt;
&lt;img alt="Creative Commons License BY-SA"
style="border-width:0; margin-bottom:12px;"
src="https://bgstack15.ddns.net/.images/l_by-sa_4.0_88x31.png"&gt;&lt;/a&gt;</copyright><lastBuildDate>Fri, 08 Jul 2022 13:00:31 GMT</lastBuildDate><generator>Nikola (getnikola.com)</generator><docs>http://blogs.law.harvard.edu/tech/rss</docs><item><title>Disable gamepad input as mouse input</title><link>https://bgstack15.ddns.net/blog/posts/2022/07/08/disable-gamepad-input-asmouse-input/</link><dc:creator>bgstack15</dc:creator><description>&lt;p&gt;I added an answer to AskUbuntu, based on a different &lt;a href="https://askubuntu.com/a/1198200"&gt;answer&lt;/a&gt;. Here is a small function that easily enables/disables using the features provided by package &lt;code&gt;xserver-xorg-input-joystick&lt;/code&gt;.&lt;/p&gt;
&lt;div class="code"&gt;&lt;pre class="code literal-block"&gt;jsinput() {
    # Insert your controller name here, as seen from `xinput --list`.
    _c="$( xinput --list --id-only 'Logic3 Controller' )"
    # Default is off, unless you pass "yes" or similar as first parameter.
    _mode="0" ; echo "&lt;span class="cp"&gt;${&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="cp"&gt;}&lt;/span&gt;" | grep -qiE '\&lt;span class="err"&gt;&amp;lt;&lt;/span&gt;(yes|1|y|on)\&amp;gt;' &lt;span class="err"&gt;&amp;amp;&amp;amp;&lt;/span&gt; _mode=1
    # Find ids of these property names, and then tell each one to go to the mode chosen in the previous line.
    xinput list-props "&lt;span class="cp"&gt;${&lt;/span&gt;&lt;span class="n"&gt;_c&lt;/span&gt;&lt;span class="cp"&gt;}&lt;/span&gt;" | sed -n -r -e '/Generate (Mouse|Key)/{s/.*\(([0-9]+)\).*/\1/;p}' | xargs -I@ xinput set-prop "&lt;span class="cp"&gt;${&lt;/span&gt;&lt;span class="n"&gt;_c&lt;/span&gt;&lt;span class="cp"&gt;}&lt;/span&gt;" @ "&lt;span class="cp"&gt;${&lt;/span&gt;&lt;span class="n"&gt;_mode&lt;/span&gt;&lt;span class="cp"&gt;}&lt;/span&gt;"
}
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;If you stick this in your &lt;code&gt;~/.bashrc&lt;/code&gt; you could then run &lt;code&gt;jsinput&lt;/code&gt; to disable this controller as mouse input. To turn on mouse input you could then simply run &lt;code&gt;jsinput 1&lt;/code&gt; or &lt;code&gt;jsinput on&lt;/code&gt;.&lt;/p&gt;</description><category>gamepad</category><category>joystick</category><category>xinput</category><guid>https://bgstack15.ddns.net/blog/posts/2022/07/08/disable-gamepad-input-asmouse-input/</guid><pubDate>Fri, 08 Jul 2022 12:59:29 GMT</pubDate></item></channel></rss>