summaryrefslogtreecommitdiffstats
path: root/RaspberryPITVHDMI
diff options
context:
space:
mode:
Diffstat (limited to 'RaspberryPITVHDMI')
-rw-r--r--RaspberryPITVHDMI1606
1 files changed, 1606 insertions, 0 deletions
diff --git a/RaspberryPITVHDMI b/RaspberryPITVHDMI
new file mode 100644
index 0000000..0bd659a
--- /dev/null
+++ b/RaspberryPITVHDMI
@@ -0,0 +1,1606 @@
+<!DOCTYPE html>
+<html class="desktop-view not-mobile-device text-size-normal anon no-touch discourse-no-touch" lang="en"><head>
+<meta http-equiv="content-type" content="text/html; charset=UTF-8">
+<meta charset="utf-8">
+<title>Controlling Raspberry PI with TV Remote, using HDMI CEC - Tips, Tricks and Tutorials / Raspberry Pi - Ubuntu MATE Community</title>
+<meta name="description" content="Hello everyone.
+
+Description: I wrote a script that connects to HDMI CEC ( cec-client needed ) and listens for TV Remote key presses. Based on the keys pressed / released (or auto-released; holding down certain keys for&amp;hellip;">
+<meta name="discourse_theme_ids" content="7">
+<meta name="discourse_current_homepage" content="categories">
+<meta name="generator" content="Discourse 2.3.1 - https://github.com/discourse/discourse version 5b91182985d70dea991ef82eeae120cac0bef935">
+<link rel="icon" type="image/png" href="https://ubuntu-mate.community/uploads/default/optimized/1X/e75ff172b5be659c48d264a448a3707f524f48f9_2_32x32.ico">
+<link rel="apple-touch-icon" type="image/png" href="https://ubuntu-mate.community/uploads/default/optimized/2X/1/14ea399f69eb3d52e32df958dbc6b6ed0d691eea_2_180x180.png">
+<meta name="theme-color" content="#87a556">
+<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, user-scalable=yes, viewport-fit=cover">
+<link rel="canonical" href="https://ubuntu-mate.community/t/controlling-raspberry-pi-with-tv-remote-using-hdmi-cec/4250">
+<script type="application/ld+json">{"@context":"http://schema.org","@type":"WebSite","url":"https://ubuntu-mate.community","potentialAction":{"@type":"SearchAction","target":"https://ubuntu-mate.community/search?q={search_term_string}","query-input":"required name=search_term_string"}}</script>
+<link rel="search" type="application/opensearchdescription+xml" href="https://ubuntu-mate.community/opensearch.xml" title="Ubuntu MATE Community Search">
+<meta name="fragment" content="!">
+<link rel="preload" href="RaspberryPITVHDMI_archivos/en-a2096d7903ea9680a0ddd80943fb0530045088c839730119480af4c3d8.js" as="script">
+<script src="RaspberryPITVHDMI_archivos/en-a2096d7903ea9680a0ddd80943fb0530045088c839730119480af4c3d8.js"></script>
+<link rel="preload" href="RaspberryPITVHDMI_archivos/ember_jquery-0ae86c6a7527a99c2b9b8a11521273bd9cb4f7d41bc546df.js" as="script">
+<script src="RaspberryPITVHDMI_archivos/ember_jquery-0ae86c6a7527a99c2b9b8a11521273bd9cb4f7d41bc546df.js"></script>
+<link rel="preload" href="RaspberryPITVHDMI_archivos/preload-store-081120a9f8cb0871483b66a95e534ce8e81f97d19c8cef9.js" as="script">
+<script src="RaspberryPITVHDMI_archivos/preload-store-081120a9f8cb0871483b66a95e534ce8e81f97d19c8cef9.js"></script>
+<link rel="preload" href="RaspberryPITVHDMI_archivos/vendor-25f91d66eba869fbd399d751711e74544b6d60bf034a5350b61c6c.js" as="script">
+<script src="RaspberryPITVHDMI_archivos/vendor-25f91d66eba869fbd399d751711e74544b6d60bf034a5350b61c6c.js"></script>
+<link rel="preload" href="RaspberryPITVHDMI_archivos/pretty-text-bundle-b33ff981ecc4ae5cc254a569e9bde34f68337b177e.js" as="script">
+<script src="RaspberryPITVHDMI_archivos/pretty-text-bundle-b33ff981ecc4ae5cc254a569e9bde34f68337b177e.js"></script>
+<link rel="preload" href="RaspberryPITVHDMI_archivos/application-e820091e1a171524cdf20a1a5bea75eb18455293e45dc37f4.js" as="script">
+<script src="RaspberryPITVHDMI_archivos/application-e820091e1a171524cdf20a1a5bea75eb18455293e45dc37f4.js"></script>
+<link rel="preload" href="RaspberryPITVHDMI_archivos/plugin-d3f2aabe1f4c66e75c9ad0d17efb33e5633e91ae4b556c155058c9.js" as="script">
+<script src="RaspberryPITVHDMI_archivos/plugin-d3f2aabe1f4c66e75c9ad0d17efb33e5633e91ae4b556c155058c9.js"></script>
+<link rel="preload" href="RaspberryPITVHDMI_archivos/plugin-third-party-01ba4719c80b6fe911b091a7c05124b64eeece964e.js" as="script">
+<script src="RaspberryPITVHDMI_archivos/plugin-third-party-01ba4719c80b6fe911b091a7c05124b64eeece964e.js"></script>
+<link href="RaspberryPITVHDMI_archivos/css.css" rel="stylesheet" type="text/css">
+<link rel="manifest" href="https://ubuntu-mate.community/manifest.webmanifest" crossorigin="use-credentials">
+
+<link href="RaspberryPITVHDMI_archivos/desktop_1_581866bb4050fdf1451a3946f2c02310c650f57b.css" media="all" rel="stylesheet" data-target="desktop" data-theme-id="7">
+<link href="RaspberryPITVHDMI_archivos/desktop_theme_7_c7a073874a27ebdc0acb6535652305a0edb8a061.css" media="all" rel="stylesheet" data-target="desktop_theme" data-theme-id="7">
+<link rel="alternate" type="application/rss+xml" title="RSS feed of 'Controlling Raspberry PI with TV Remote, using HDMI CEC'" href="https://ubuntu-mate.community/t/controlling-raspberry-pi-with-tv-remote-using-hdmi-cec/4250.rss">
+<meta property="og:site_name" content="Ubuntu MATE Community">
+<meta name="twitter:card" content="summary">
+<meta name="twitter:image" content="https://ubuntu-mate.community/uploads/default/optimized/2X/e/e00e46bb720d634bb6a2ba84cad84c05078fd391_2_401x500.png">
+<meta property="og:image" content="https://ubuntu-mate.community/uploads/default/optimized/2X/e/e00e46bb720d634bb6a2ba84cad84c05078fd391_2_401x500.png">
+<meta property="og:url" content="https://ubuntu-mate.community/t/controlling-raspberry-pi-with-tv-remote-using-hdmi-cec/4250">
+<meta name="twitter:url" content="https://ubuntu-mate.community/t/controlling-raspberry-pi-with-tv-remote-using-hdmi-cec/4250">
+<meta property="og:title" content="Controlling Raspberry PI with TV Remote, using HDMI CEC">
+<meta name="twitter:title" content="Controlling Raspberry PI with TV Remote, using HDMI CEC">
+<meta property="og:description" content="Hello everyone. Description: I wrote a script that connects to HDMI CEC ( cec-client needed ) and listens for TV Remote key presses. Based on the keys pressed / released (or auto-released; holding down certain keys for too long makes them auto-release) different actions are executed. Some examples: write letters and numbers using 0-9 keys (simulating 3x4 keypad phones - key &quot;2&quot; switches between a-b-c-2, key 9 switches between w-x-y-z-9) ( xdotool needed ) move mouse cursor using up/down/left...">
+<meta name="twitter:description" content="Hello everyone. Description: I wrote a script that connects to HDMI CEC ( cec-client needed ) and listens for TV Remote key presses. Based on the keys pressed / released (or auto-released; holding down certain keys for too long makes them auto-release) different actions are executed. Some examples: write letters and numbers using 0-9 keys (simulating 3x4 keypad phones - key &quot;2&quot; switches between a-b-c-2, key 9 switches between w-x-y-z-9) ( xdotool needed ) move mouse cursor using up/down/left...">
+<meta name="twitter:label1" value="Reading time">
+<meta name="twitter:data1" value="6 mins 🕑">
+<meta name="twitter:label2" value="Likes">
+<meta name="twitter:data2" value="3 ❤">
+<meta property="article:published_time" content="2016-08-11T01:40:52+00:00">
+<meta property="og:ignore_canonical" content="true">
+<script type="application/ld+json">{"@context":"http://schema.org","@type":"QAPage","name":"Controlling Raspberry PI with TV Remote, using HDMI CEC","mainEntity":{"@type":"Question","name":"Controlling Raspberry PI with TV Remote, using HDMI CEC","text":"Hello everyone. \nDescription: \nI wrote a script that connects to HDMI CEC ( cec-client needed ) and listens for TV Remote key presses. Based on the keys pressed / released (or auto-released; holding down certain keys for too long makes them auto-release) different actions are executed. Some examples&hellip;","upvoteCount":3,"answerCount":0,"dateCreated":"2016-03-10T10:14:41.253Z","author":{"@type":"Person","name":"Simon Murgelj"}}}</script>
+<meta id="data-discourse-setup" data-base-url="https://ubuntu-mate.community" data-base-uri="" data-environment="production" data-letter-avatar-version="5_7a34611334577356ea98a4f98ad61bf8" data-markdown-it-url="/assets/markdown-it-bundle-f79d9db8b5c7812b862fd0c3379d87d67d6b4ce5cda50a66cb1a50482793ce50.js" data-service-worker-url="service-worker-83e47e9f07bb77a5c8146b30ee8c7761c0ce036d70528cd57da81981879b70f7.js" data-default-locale="en" data-asset-version="19904fa7ecf0ca6bfb3659c05e68538b" data-disable-custom-css="false" data-highlight-js-path="/highlight-js/ubuntu-mate.community/bd34dee19ab76bc4f22cba22a34edbdab790a807.js" data-svg-sprite-path="/svg-sprite/ubuntu-mate.community/svg-7-a49ad7255a63371eebe293cc86311573fb927cfb.js">
+<script src="RaspberryPITVHDMI_archivos/svg-7-a49ad7255a63371eebe293cc86311573fb927cfb.js"></script><style id="image-sizing-hack">#reply-control .d-editor-preview img:not(.thumbnail), .cooked img:not(.thumbnail) {max-width:690px;max-height:500px;}</style><script src="RaspberryPITVHDMI_archivos/jquery.js"></script><script src="RaspberryPITVHDMI_archivos/bd34dee19ab76bc4f22cba22a34edbdab790a807.js"></script></head>
+<body class="archetype-regular category-tips-tricks-and-tutorials-raspberry-pi-tips docked">
+
+<div id="top-navbar">
+<div id="top-navbar-links" class="wrap">
+<a href="https://ubuntu-mate.org/" title="Ubuntu MATE Website">Website</a>
+<a href="https://ubuntu-mate.org/download" title="Download Ubuntu MATE">Download</a>
+<a href="https://bugs.launchpad.net/ubuntu-mate" title="Report bugs via Launchpad">Bug Tracker</a>
+<a href="https://ubuntu-mate.org/irc/" title="Chat with other Ubuntu MATE users">IRC</a>
+<a href="https://ubuntu-mate.boutique/" title="Buy mechandise and other branded items">Shop</a>
+<a href="https://ubuntu-mate.community/wiki" title="View the index of wiki topics and guides">Wiki</a>
+<a href="https://ubuntu-mate.org/donate/" title="Contribute back and support the project financially">Donate</a>
+</div>
+</div>
+<section id="main" class="ember-application">
+<div class="ember-view" id="ember4"><span id="ember5" class="ember-view"><!----></span>
+<div id="ember6" class="ember-view"><header class="d-header clearfix" style=""><div class="wrap"><div class="contents clearfix">
+ <div class="title"><a href="https://ubuntu-mate.community/" data-auto-route="true"><img src="RaspberryPITVHDMI_archivos/0c41b826d1c81f42e55160501605d3c96ded0ae1.png" alt="Ubuntu MATE Community" id="site-logo" class="logo-small" width="36"></a></div>
+ <div class="extra-info-wrapper"><div class="extra-info two-rows"><div class="title-wrapper"><h1><div class="topic-statuses"></div><a class="widget-link topic-link" href="https://ubuntu-mate.community/t/controlling-raspberry-pi-with-tv-remote-using-hdmi-cec/4250" title="" data-topic-id="4250"><span>Controlling Raspberry PI with TV Remote, using HDMI CEC</span></a></h1><div class="categories-wrapper"><a class="badge-wrapper bullet" href="https://ubuntu-mate.community/c/tips-tricks-and-tutorials"><span class="badge-category-bg" style="background-color: #A6748F;"></span><span data-drop-close="true" class="badge-category clear-badge" title="If you have a tutorial, how to or other useful tips to share about Ubuntu MATE, then fit them in to one of these subcategories:"><span class="category-name">Tips, Tricks and Tutorials</span></span></a><a class="badge-wrapper bullet" href="https://ubuntu-mate.community/c/tips-tricks-and-tutorials/raspberry-pi-tips"><span class="badge-category-parent-bg" style="background-color: #A6748F;"></span><span class="badge-category-bg" style="background-color: #C6043C;"></span><span data-drop-close="true" class="badge-category clear-badge" title="Topics sharing tips and tricks specifically for the Raspberry Pi port."><span class="category-name">Raspberry Pi</span></span></a></div></div></div></div>
+ <div class="panel clearfix"><span class="header-buttons"><button class="widget-button btn btn-primary btn-small login-button btn-icon-text"><svg class="fa d-icon d-icon-user svg-icon svg-node" aria-hidden="true"><use xlink:href="#user"></use></svg><span class="d-button-label">Log In</span></button></span><ul role="navigation" class="icons d-header-icons"><li class="header-dropdown-toggle"><a href="https://ubuntu-mate.community/search" data-auto-route="true" title="search topics, posts, users, or categories" aria-label="search topics, posts, users, or categories" id="search-button" class="icon btn-flat"><svg class="fa d-icon d-icon-search svg-icon svg-node" aria-hidden="true"><use xlink:href="#search"></use></svg></a></li><li class="header-dropdown-toggle"><a href="" data-auto-route="true" title="go to another topic list or category" aria-label="go to another topic list or category" id="toggle-hamburger-menu" class="icon btn-flat"><svg class="fa d-icon d-icon-bars svg-icon svg-node" aria-hidden="true"><use xlink:href="#bars"></use></svg></a></li></ul></div>
+ </div></div></header></div>
+
+<span id="ember7" class="ember-view"><!----></span>
+
+<div id="main-outlet" class="wrap">
+ <span id="ember8" class="ember-view"><!----></span>
+ <div class="container">
+ <div id="ember9" class="ember-view"></div>
+ <div id="ember10" class="controls ember-view"><!----></div>
+ <div id="ember11" class="ember-view"></div>
+ <div id="ember12" class="hidden create-topics-notice ember-view"><!----></div>
+ <span id="ember13" class="ember-view"><!----></span>
+ </div>
+ <div id="ember14" class="regular category-tips-tricks-and-tutorials-raspberry-pi-tips ember-view"> <div id="ember15" class="ember-view"></div>
+ <div class="container">
+ <div id="ember16" class="ember-view"><!----></div>
+ </div>
+
+<!---->
+ <span id="ember17" class="ember-view"><!----></span>
+
+<div id="topic-title" class="ember-view"><div class="container">
+ <div class="title-wrapper">
+ <h1 data-topic-id="4250">
+ <a>
+ <span class="private-message-glyph"><svg class="fa d-icon d-icon-envelope svg-icon svg-string" xmlns="http://www.w3.org/2000/svg"><use xlink:href="#envelope"></use></svg></span>
+ </a>
+
+ <div id="ember18" class="topic-statuses ember-view"></div>
+ <a href="https://ubuntu-mate.community/t/controlling-raspberry-pi-with-tv-remote-using-hdmi-cec/4250" class="fancy-title" data-ember-action="" data-ember-action-19="19">
+ Controlling Raspberry PI with TV Remote, using HDMI CEC
+ </a>
+
+<!----> </h1>
+
+ <div id="ember20" class="topic-category ember-view"> <a class="badge-wrapper bullet" href="https://ubuntu-mate.community/c/tips-tricks-and-tutorials"><span class="badge-category-bg" style="background-color: #A6748F;"></span><span data-drop-close="true" class="badge-category clear-badge" title="If you have a tutorial, how to or other useful tips to share about Ubuntu MATE, then fit them in to one of these subcategories:"><span class="category-name">Tips, Tricks and Tutorials</span></span></a>
+ <a class="badge-wrapper bullet" href="https://ubuntu-mate.community/c/tips-tricks-and-tutorials/raspberry-pi-tips"><span class="badge-category-bg" style="background-color: #C6043C;"></span><span data-drop-close="true" class="badge-category clear-badge" title="Topics sharing tips and tricks specifically for the Raspberry Pi port."><span class="category-name">Raspberry Pi</span></span></a>
+<div class="topic-header-extra">
+ <div class="list-tags">
+ <!---->
+ </div>
+ <!---->
+</div>
+
+<span id="ember21" class="ember-view"><!----></span>
+</div>
+
+ </div>
+ <span id="ember22" class="ember-view"><!----></span>
+</div>
+</div>
+
+ <div class="container posts">
+ <div class="selected-posts hidden">
+ <p><span id="ember23" class="ember-view">You have selected <b>0</b> posts.</span></p>
+
+ <p><a class="select-all" href="" data-ember-action="" data-ember-action-24="24">select all</a></p>
+
+<!---->
+<!---->
+<!---->
+<!---->
+<!---->
+<p class="cancel"><a href="" data-ember-action="" data-ember-action-25="25">cancel selecting</a></p>
+
+ </div>
+
+<div id="ember26" class="ember-view"><!---->
+ <div id="ember66" class="ember-view"><div class="timeline-container" style="top: 90px"><div class="topic-timeline"><div class="timeline-controls"></div><div class="timeline-scrollarea-wrapper"><div class="timeline-date-wrapper"><a class="widget-link start-date" title="Mar 2016"><span class="d-label">Mar 2016</span></a></div><div style="height: 300px" class="timeline-scrollarea"><div style="height: 210.6779814401748px" class="timeline-padding"></div><div style="height: 50px" class="timeline-scroller"><div class="timeline-handle"></div><div class="timeline-scroller-content"><div class="timeline-replies">4 / 4</div><div class="timeline-ago">Apr 2018</div></div></div><div style="height: 39.32201855982521px" class="timeline-padding"></div></div><div class="timeline-date-wrapper"><a class="widget-link now-date" title="Apr 2018"><span class="d-label">Apr 2018</span></a></div></div><div class="timeline-footer-controls"></div></div></div></div>
+
+</div>
+ <div class="row">
+ <section class="topic-area" id="topic" data-topic-id="4250">
+
+ <div class="posts-wrapper">
+ <div id="ember27" class="loading-container ember-view">
+</div>
+
+ <span id="ember28" class="ember-view"><!----></span>
+
+ <div id="ember29" class="ember-view"><div class="post-stream"><div class="topic-post clearfix topic-owner wiki regular"><article id="post_1" data-post-id="15031" data-topic-id="4250" data-user-id="2055" class="boxed onscreen-post" style=""><a href="" class="tabLoc"></a><div class="row"><div class="topic-avatar"><a class="trigger-user-card main-avatar" href="https://ubuntu-mate.community/u/GizmoXomziG" data-user-card="GizmoXomziG"><img alt="" src="RaspberryPITVHDMI_archivos/2566_2_002.jpg" title="Simon Murgelj" class="avatar" width="45" height="45"></a><div class="poster-avatar-extra"></div></div><div class="topic-body clearfix"><div class="topic-meta-data"><div class="names trigger-user-card"><span class="first username"><a href="https://ubuntu-mate.community/u/GizmoXomziG" data-user-card="GizmoXomziG">GizmoXomziG</a></span></div><div class="post-infos"><div class="post-info edits"><a class="wiki" title="post last edited on 10 Aug 2016 21:40" href="#">3 <svg class="fa d-icon d-icon-pencil-square-o svg-icon svg-node" aria-hidden="true"><use xlink:href="#far-edit"></use></svg></a></div><div class="post-info post-date"><a class="post-date last-wiki-edit" href="https://ubuntu-mate.community/t/controlling-raspberry-pi-with-tv-remote-using-hdmi-cec/4250" data-share-url="/t/controlling-raspberry-pi-with-tv-remote-using-hdmi-cec/4250" data-post-number="1"><span title="10 Aug 2016 21:40" data-time="1470879652037" data-format="tiny" class="relative-date">Aug '16</span></a></div><div class="read-state read" title="Post is unread"><svg class="fa d-icon d-icon-circle svg-icon svg-node" aria-hidden="true"><use xlink:href="#circle"></use></svg></div></div></div><div class="regular contents"><div class="cooked"><p>Hello everyone.</p>
+<p><strong>Description:</strong><br>
+I wrote a script that connects to HDMI CEC ( cec-client needed ) and
+listens for TV Remote key presses. Based on the keys pressed / released
+(or auto-released; holding down certain keys for too long makes them
+auto-release) different actions are executed. Some examples:</p>
+<ul>
+<li>write letters and numbers using 0-9 keys (simulating 3x4 keypad
+phones - key "2" switches between a-b-c-2, key 9 switches between
+w-x-y-z-9) ( xdotool needed )</li>
+<li>move mouse cursor using up/down/left/right (the longer you hold the
+key down, the faster it goes) and click (enter = left click; channels
+list = right click) ( xdotool needed )</li>
+<li>opening web sites in chomium (red key for YouTube, green for Google, blue for incognito window)</li>
+</ul>
+<p>If you want to use firefox instead of chromium, replace "chromium" with "firefox" in the script below.<br>
+Alternatively, you can just install chromium:</p>
+<pre><code class="hljs">sudo apt-get install chromium-browser
+</code></pre>
+<p>See all the available keys below:</p>
+<p></p><div class="lightbox-wrapper"><a class="lightbox" href="https://ubuntu-mate.community/uploads/default/original/2X/e/e00e46bb720d634bb6a2ba84cad84c05078fd391.png" data-download-href="https://ubuntu-mate.community/uploads/default/e00e46bb720d634bb6a2ba84cad84c05078fd391" title="TVRemoteCECpng.png"><img src="RaspberryPITVHDMI_archivos/e00e46bb720d634bb6a2ba84cad84c05078fd391_2_401x500.png" class="d-lazyload" srcset="https://ubuntu-mate.community/uploads/default/optimized/2X/e/e00e46bb720d634bb6a2ba84cad84c05078fd391_2_401x500.png, https://ubuntu-mate.community/uploads/default/optimized/2X/e/e00e46bb720d634bb6a2ba84cad84c05078fd391_2_601x750.png 1.5x, https://ubuntu-mate.community/uploads/default/optimized/2X/e/e00e46bb720d634bb6a2ba84cad84c05078fd391_2_802x1000.png 2x" width="401" height="500"><div class="meta">
+<svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use xlink:href="#far-image"></use></svg><span class="filename">TVRemoteCECpng.png</span><span class="informations">828×1030 101 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use xlink:href="#discourse-expand"></use></svg>
+</div></a></div><p></p>
+<p>These are the keys supported by my TV Remote. You can modify the script for your TV Remote, see Modification below.</p>
+<p><strong>Installation:</strong><br>
+First you need to install cec-client and xdotool; using terminal:</p>
+<pre><code class="hljs">sudo apt-get install cec-client xdotool
+</code></pre>
+<p>Test if you can receive TV Remote button presses with cec-client; using terminal:</p>
+<pre><code class="hljs">cec-client
+</code></pre>
+<p>You should see some diagnostic messages. Press numeric keys (as they
+are most likely to be supported) on your TV Remote. Watch out for new
+lines, especially of this form:</p>
+<pre><code class="hljs markdown">something something <span class="hljs-strong">**key pressed: 8**</span> something something
+</code></pre>
+<p>If you see this kind of messages, then this should work for you.<br>
+If not, make sure you've got CEC enabled on your TV (see this <a href="http://kodi.wiki/view/CEC#Trade_names" rel="nofollow noopener">WIKI <span class="badge badge-notification clicks" title="99 clicks">99</span></a> for more info).<br>
+For my TV, pressing the Source button a couple of times helped (so it
+kind-of flips trough all the sources and circles back to the Raspberry
+Pi, detects CEC and connects to it).</p>
+<p>So, on to the script / installation:<br>
+Create the file cecremote.sh and mark it as executable; using terminal:</p>
+<pre><code class="hljs css"><span class="hljs-selector-tag">touch</span> <span class="hljs-selector-tag">cecremote</span><span class="hljs-selector-class">.sh</span>
+<span class="hljs-selector-tag">chmod</span> +<span class="hljs-selector-tag">x</span> <span class="hljs-selector-tag">cecremote</span><span class="hljs-selector-class">.sh</span>
+</code></pre>
+<p>Then open it; using terminal:</p>
+<pre><code class="hljs css"><span class="hljs-selector-tag">nano</span> <span class="hljs-selector-tag">cecremote</span><span class="hljs-selector-class">.sh</span>
+</code></pre>
+<p>Copy - paste this in the file:</p>
+<pre><code class="hljs bash"><span class="hljs-meta">#!/bin/bash</span>
+<span class="hljs-keyword">function</span> keychar {
+ parin1=<span class="hljs-variable">$1</span> <span class="hljs-comment">#first param; abc1</span>
+ parin2=<span class="hljs-variable">$2</span> <span class="hljs-comment">#second param; 0=a, 1=b, 2=c, 3=1, 4=a, ...</span>
+ parin2=$((parin2)) <span class="hljs-comment">#convert to numeric</span>
+ parin1len=<span class="hljs-variable">${#parin1}</span> <span class="hljs-comment">#length of parin1</span>
+ parin2pos=$((parin2 % parin1len)) <span class="hljs-comment">#position mod</span>
+ char=<span class="hljs-variable">${parin1:parin2pos:1}</span> <span class="hljs-comment">#char key to simulate</span>
+ <span class="hljs-keyword">if</span> [ <span class="hljs-string">"<span class="hljs-variable">$parin2</span>"</span> -gt 0 ]; <span class="hljs-keyword">then</span> <span class="hljs-comment">#if same key pressed multiple times, delete previous char; write a, delete a write b, delete b write c, ...</span>
+ xdotool key <span class="hljs-string">"BackSpace"</span>
+ <span class="hljs-keyword">fi</span>
+ <span class="hljs-comment">#special cases for xdotool ( X Keysyms )</span>
+ <span class="hljs-keyword">if</span> [ <span class="hljs-string">"<span class="hljs-variable">$char</span>"</span> = <span class="hljs-string">" "</span> ]; <span class="hljs-keyword">then</span> char=<span class="hljs-string">"space"</span>; <span class="hljs-keyword">fi</span>
+ <span class="hljs-keyword">if</span> [ <span class="hljs-string">"<span class="hljs-variable">$char</span>"</span> = <span class="hljs-string">"."</span> ]; <span class="hljs-keyword">then</span> char=<span class="hljs-string">"period"</span>; <span class="hljs-keyword">fi</span>
+ <span class="hljs-keyword">if</span> [ <span class="hljs-string">"<span class="hljs-variable">$char</span>"</span> = <span class="hljs-string">"-"</span> ]; <span class="hljs-keyword">then</span> char=<span class="hljs-string">"minus"</span>; <span class="hljs-keyword">fi</span>
+ xdotool key <span class="hljs-variable">$char</span>
+}
+datlastkey=$(date +%s%N)
+strlastkey=<span class="hljs-string">""</span>
+intkeychar=0
+intmsbetweenkeys=2000 <span class="hljs-comment">#two presses of a key sooner that this makes it delete previous key and write the next one (a-&gt;b-&gt;c-&gt;1-&gt;a-&gt;...)</span>
+intmousestartspeed=10 <span class="hljs-comment">#mouse starts moving at this speed (pixels per key press)</span>
+intmouseacc=10 <span class="hljs-comment">#added to the mouse speed for each key press (while holding down key, more key presses are sent from the remote)</span>
+intmousespeed=10
+
+<span class="hljs-keyword">while</span> <span class="hljs-built_in">read</span> oneline
+<span class="hljs-keyword">do</span>
+ keyline=$(<span class="hljs-built_in">echo</span> <span class="hljs-variable">$oneline</span> | grep <span class="hljs-string">" key "</span>)
+ <span class="hljs-comment">#echo $keyline --- debugAllLines</span>
+ <span class="hljs-keyword">if</span> [ -n <span class="hljs-string">"<span class="hljs-variable">$keyline</span>"</span> ]; <span class="hljs-keyword">then</span>
+ datnow=$(date +%s%N)
+ datdiff=$(((<span class="hljs-variable">$datnow</span> - <span class="hljs-variable">$datlastkey</span>) / 1000000)) <span class="hljs-comment">#bla bla key pressed: previous channel (123)</span>
+ strkey=$(grep -oP <span class="hljs-string">'(?&lt;=sed: ).*?(?= \()'</span> &lt;&lt;&lt; <span class="hljs-string">"<span class="hljs-variable">$keyline</span>"</span>) <span class="hljs-comment">#bla bla key pres--&gt;sed: &gt;&gt;previous channel&lt;&lt; (&lt;--123)</span>
+ strstat=$(grep -oP <span class="hljs-string">'(?&lt;=key ).*?(?=:)'</span> &lt;&lt;&lt; <span class="hljs-string">"<span class="hljs-variable">$keyline</span>"</span>) <span class="hljs-comment">#bla bla --&gt;key &gt;&gt;pressed&lt;&lt;:&lt;-- previous channel (123)</span>
+ strpressed=$(<span class="hljs-built_in">echo</span> <span class="hljs-variable">$strstat</span> | grep <span class="hljs-string">"pressed"</span>)
+ strreleased=$(<span class="hljs-built_in">echo</span> <span class="hljs-variable">$strstat</span> | grep <span class="hljs-string">"released"</span>)
+ <span class="hljs-keyword">if</span> [ -n <span class="hljs-string">"<span class="hljs-variable">$strpressed</span>"</span> ]; <span class="hljs-keyword">then</span>
+ <span class="hljs-comment">#echo $keyline --- debug</span>
+ <span class="hljs-keyword">if</span> [ <span class="hljs-string">"<span class="hljs-variable">$strkey</span>"</span> = <span class="hljs-string">"<span class="hljs-variable">$strlastkey</span>"</span> ] &amp;&amp; [ <span class="hljs-string">"<span class="hljs-variable">$datdiff</span>"</span> -lt <span class="hljs-string">"<span class="hljs-variable">$intmsbetweenkeys</span>"</span> ]; <span class="hljs-keyword">then</span>
+ intkeychar=$((intkeychar + 1)) <span class="hljs-comment">#same key pressed for a different char</span>
+ <span class="hljs-keyword">else</span>
+ intkeychar=0 <span class="hljs-comment">#different key / too far apart</span>
+ <span class="hljs-keyword">fi</span>
+ datlastkey=<span class="hljs-variable">$datnow</span>
+ strlastkey=<span class="hljs-variable">$strkey</span>
+ <span class="hljs-keyword">case</span> <span class="hljs-string">"<span class="hljs-variable">$strkey</span>"</span> <span class="hljs-keyword">in</span>
+ <span class="hljs-string">"1"</span>)
+ xdotool key <span class="hljs-string">"BackSpace"</span>
+ ;;
+ <span class="hljs-string">"2"</span>)
+ keychar <span class="hljs-string">"abc2"</span> intkeychar
+ ;;
+ <span class="hljs-string">"3"</span>)
+ keychar <span class="hljs-string">"def3"</span> intkeychar
+ ;;
+ <span class="hljs-string">"4"</span>)
+ keychar <span class="hljs-string">"ghi4"</span> intkeychar
+ ;;
+ <span class="hljs-string">"5"</span>)
+ keychar <span class="hljs-string">"jkl5"</span> intkeychar
+ ;;
+ <span class="hljs-string">"6"</span>)
+ keychar <span class="hljs-string">"mno6"</span> intkeychar
+ ;;
+ <span class="hljs-string">"7"</span>)
+ keychar <span class="hljs-string">"pqrs7"</span> intkeychar
+ ;;
+ <span class="hljs-string">"8"</span>)
+ keychar <span class="hljs-string">"tuv8"</span> intkeychar
+ ;;
+ <span class="hljs-string">"9"</span>)
+ keychar <span class="hljs-string">"wxyz9"</span> intkeychar
+ ;;
+ <span class="hljs-string">"0"</span>)
+ keychar <span class="hljs-string">" 0.-"</span> intkeychar
+ ;;
+ <span class="hljs-string">"previous channel"</span>)
+ xdotool key <span class="hljs-string">"Return"</span> <span class="hljs-comment">#Enter</span>
+ ;;
+ <span class="hljs-string">"channel up"</span>)
+ xdotool click 4 <span class="hljs-comment">#mouse scroll up</span>
+ ;;
+ <span class="hljs-string">"channel down"</span>)
+ xdotool click 5 <span class="hljs-comment">#mouse scroll down</span>
+ ;;
+ <span class="hljs-string">"channels list"</span>)
+ xdotool click 3 <span class="hljs-comment">#right mouse button click"</span>
+ ;;
+ <span class="hljs-string">"up"</span>)
+ intpixels=$((-1 * intmousespeed))
+ xdotool mousemove_relative -- 0 <span class="hljs-variable">$intpixels</span> <span class="hljs-comment">#move mouse up</span>
+ intmousespeed=$((intmousespeed + intmouseacc)) <span class="hljs-comment">#speed up</span>
+ ;;
+ <span class="hljs-string">"down"</span>)
+ intpixels=$(( 1 * intmousespeed))
+ xdotool mousemove_relative -- 0 <span class="hljs-variable">$intpixels</span> <span class="hljs-comment">#move mouse down</span>
+ intmousespeed=$((intmousespeed + intmouseacc)) <span class="hljs-comment">#speed up</span>
+ ;;
+ <span class="hljs-string">"left"</span>)
+ intpixels=$((-1 * intmousespeed))
+ xdotool mousemove_relative -- <span class="hljs-variable">$intpixels</span> 0 <span class="hljs-comment">#move mouse left</span>
+ intmousespeed=$((intmousespeed + intmouseacc)) <span class="hljs-comment">#speed up</span>
+ ;;
+ <span class="hljs-string">"right"</span>)
+ intpixels=$(( 1 * intmousespeed))
+ xdotool mousemove_relative -- <span class="hljs-variable">$intpixels</span> 0 <span class="hljs-comment">#move mouse right</span>
+ intmousespeed=$((intmousespeed + intmouseacc)) <span class="hljs-comment">#speed up</span>
+ ;;
+ <span class="hljs-string">"select"</span>)
+ xdotool click 1 <span class="hljs-comment">#left mouse button click</span>
+ ;;
+ <span class="hljs-string">"return"</span>)
+ xdotool key <span class="hljs-string">"Alt_L+Left"</span> <span class="hljs-comment">#WWW-Back</span>
+ ;;
+ <span class="hljs-string">"exit"</span>)
+ <span class="hljs-built_in">echo</span> Key Pressed: EXIT
+ ;;
+ <span class="hljs-string">"F2"</span>)
+ chromium-browser <span class="hljs-string">"https://www.youtube.com"</span> &amp;
+ ;;
+ <span class="hljs-string">"F3"</span>)
+ chromium-browser <span class="hljs-string">"https://www.google.com"</span> &amp;
+ ;;
+ <span class="hljs-string">"F4"</span>)
+ <span class="hljs-built_in">echo</span> Key Pressed: YELLOW C
+ ;;
+ <span class="hljs-string">"F1"</span>)
+ chromium-browser --incognito <span class="hljs-string">"https://www.google.com"</span> &amp;
+ ;;
+ <span class="hljs-string">"rewind"</span>)
+ <span class="hljs-built_in">echo</span> Key Pressed: REWIND
+ ;;
+ <span class="hljs-string">"pause"</span>)
+ <span class="hljs-built_in">echo</span> Key Pressed: PAUSE
+ ;;
+ <span class="hljs-string">"Fast forward"</span>)
+ <span class="hljs-built_in">echo</span> Key Pressed: FAST FORWARD
+ ;;
+ <span class="hljs-string">"play"</span>)
+ <span class="hljs-built_in">echo</span> Key Pressed: PLAY
+ ;;
+ <span class="hljs-string">"stop"</span>)
+ <span class="hljs-comment">## with my remote I only got "STOP" as key released (auto-released), not as key pressed; see below</span>
+ <span class="hljs-built_in">echo</span> Key Pressed: STOP
+ ;;
+ *)
+ <span class="hljs-built_in">echo</span> Unrecognized Key Pressed: <span class="hljs-variable">$strkey</span> ; CEC Line: <span class="hljs-variable">$keyline</span>
+ ;;
+
+ <span class="hljs-keyword">esac</span>
+ <span class="hljs-keyword">fi</span>
+ <span class="hljs-keyword">if</span> [ -n <span class="hljs-string">"<span class="hljs-variable">$strreleased</span>"</span> ]; <span class="hljs-keyword">then</span>
+ <span class="hljs-comment">#echo $keyline --- debug</span>
+ <span class="hljs-keyword">case</span> <span class="hljs-string">"<span class="hljs-variable">$strkey</span>"</span> <span class="hljs-keyword">in</span>
+ <span class="hljs-string">"stop"</span>)
+ <span class="hljs-built_in">echo</span> Key Released: STOP
+ ;;
+ <span class="hljs-string">"up"</span>)
+ intmousespeed=<span class="hljs-variable">$intmousestartspeed</span> <span class="hljs-comment">#reset mouse speed</span>
+ ;;
+ <span class="hljs-string">"down"</span>)
+ intmousespeed=<span class="hljs-variable">$intmousestartspeed</span> <span class="hljs-comment">#reset mouse speed</span>
+ ;;
+ <span class="hljs-string">"left"</span>)
+ intmousespeed=<span class="hljs-variable">$intmousestartspeed</span> <span class="hljs-comment">#reset mouse speed</span>
+ ;;
+ <span class="hljs-string">"right"</span>)
+ intmousespeed=<span class="hljs-variable">$intmousestartspeed</span> <span class="hljs-comment">#reset mouse speed</span>
+ ;;
+ <span class="hljs-keyword">esac</span>
+ <span class="hljs-keyword">fi</span>
+ <span class="hljs-keyword">fi</span>
+<span class="hljs-keyword">done</span>
+</code></pre>
+<p>Finally, save it; using nano in terminal:<br>
+press "Ctrl+X" to close the file, then "Y" to confirm saving, then "Enter" to save the file under the right file name</p>
+<p>Try executing it, using terminal:</p>
+<pre><code class="hljs">cec-client | ./cecremote.sh
+</code></pre>
+<p>At this point it should be working.<br>
+Point the TV Remote at the TV, press up/down/left/right and check if the mouse pointer is moving.<br>
+Press 9 44 2 8 7777 0 88 7 and it should write "whats up".</p>
+<p>The script doesn't output anything, except when it encounters a
+button press that it doesn't recognize, or it doesn't have a function
+set up for that button yet (play button being one of them).<br>
+If you want it to output all the messages it receives, find the line and uncomment it by deleting the # : <span class="hashtag">#echo</span> $keyline --- debugAllLines</p>
+<p>So, if everything works, exit the script in terminal: Press Ctrl+C</p>
+<p><strong>Run at startup:</strong><br>
+If you want to start this script every time the Raspberry starts, create
+ a new file called cecremotestart.sh and mark it as executable; using
+terminal:</p>
+<pre><code class="hljs css"><span class="hljs-selector-tag">touch</span> <span class="hljs-selector-tag">cecremotestart</span><span class="hljs-selector-class">.sh</span>
+<span class="hljs-selector-tag">chmod</span> +<span class="hljs-selector-tag">x</span> <span class="hljs-selector-tag">cecremotestart</span><span class="hljs-selector-class">.sh</span>
+</code></pre>
+<p>Then open it; using terminal:</p>
+<pre><code class="hljs css"><span class="hljs-selector-tag">nano</span> <span class="hljs-selector-tag">cecremotestart</span><span class="hljs-selector-class">.sh</span>
+</code></pre>
+<p>Copy - paste this in the file:</p>
+<pre><code class="hljs bash"><span class="hljs-meta">#!/bin/bash</span>
+cec-client | /home/raspberry/cecremote.sh <span class="hljs-comment">#&lt;-- change this according to your username / path to the script</span>
+</code></pre>
+<p>Finally, save it; using nano in terminal:<br>
+press "Ctrl+X" to close the file, then "Y" to confirm saving, then "Enter" to save the file under the right file name</p>
+<p>Then add this in the Startup Programs (Menu - System - Control Center
+ - Startup Programs; Add; Give it a name, and enter the path (or press
+Browse) of the script in the filesystem).</p>
+<p>Restart, try, report <img src="RaspberryPITVHDMI_archivos/slightly_smiling.png" title=":slightly_smiling:" class="emoji" alt=":slightly_smiling:"></p>
+<p><strong>Modification:</strong><br>
+If you want, you can edit the script to change or add the commands executed on certain button presses.<br>
+You can detect the additional buttons that CEC on your TV supports. Kill
+ the running cec-client, run the cec-client in the terminal, and watch
+for the output while you're pressing all the keys on your TV Remote;
+using terminal:</p>
+<pre><code class="hljs coffeescript">killall cec-client
+cec-client
+Ctrl+C <span class="hljs-keyword">when</span> you<span class="hljs-string">'re ready to stop
+</span></code></pre>
+<p>Edit the script, then execute the modified script by manually executing cecremotestart.sh; using terminal:</p>
+<pre><code class="hljs">./cecremotescript.sh
+Ctrl+C to stop
+</code></pre>
+<p>When you're satisfied, just restart your Raspberry PI.</p>
+<p>That's it from me - a simple and crude way to control your Raspberry
+PI with the TV Remote, for when you don't have the keyboard/mouse
+connected and VNC-ing is too much of a bother.</p>
+<p>Try it and report <img src="RaspberryPITVHDMI_archivos/slightly_smiling.png" title=":slightly_smiling:" class="emoji" alt=":slightly_smiling:"></p></div><section class="post-menu-area clearfix"><nav class="post-controls clearfix"><div class="actions"><div class="double-button"><button class="widget-button btn-flat button-count like-count highlight-action regular-likes btn-text" aria-label="3 people liked this post" title="3 people liked this post">3</button><button class="widget-button btn-flat toggle-like like no-text btn-icon" aria-label="like this post" title="like this post"><svg class="fa d-icon d-icon-d-unliked svg-icon svg-node" aria-hidden="true"><use xlink:href="#far-heart"></use></svg></button></div><button class="widget-button btn-flat share no-text btn-icon" aria-label="share a link to this post" title="share a link to this post" data-share-url="/t/controlling-raspberry-pi-with-tv-remote-using-hdmi-cec/4250" data-post-number="1"><svg class="fa d-icon d-icon-link svg-icon svg-node" aria-hidden="true"><use xlink:href="#link"></use></svg></button></div></nav></section></div><section class="post-actions">
+ </section><div class="post-links-container"><ul class="post-links"><li><a class="track-link inbound" href="https://ubuntu-mate.community/t/tips-tutorials-and-guides-index/14519/6"><svg class="fa d-icon d-icon-link svg-icon svg-node" aria-hidden="true"><use xlink:href="#link"></use></svg><span>Tips, Tutorials and Guides Index</span></a></li></ul></div><div class="topic-map"><section class="map map-collapsed"><nav class="buttons"><button class="widget-button btn btn no-text btn-icon" aria-label="toggle topic details" title="toggle topic details"><svg class="fa d-icon d-icon-chevron-down svg-icon svg-node" aria-hidden="true"><use xlink:href="#chevron-down"></use></svg></button></nav><ul class="clearfix"><li><h4 role="presentation">created</h4><div class="topic-map-post created-at"><a class="trigger-user-card " data-user-card="GizmoXomziG"><img alt="" src="RaspberryPITVHDMI_archivos/2566_2_003.jpg" title="Simon Murgelj" class="avatar" width="20" height="20"></a><span title="10 Mar 2016 05:44" data-time="1457604881253" data-format="tiny" class="relative-date">Mar '16</span></div></li><li><a href="https://ubuntu-mate.community/t/controlling-raspberry-pi-with-tv-remote-using-hdmi-cec/4250/4"><h4 role="presentation">last reply</h4><div class="topic-map-post last-reply"><a class="trigger-user-card " data-user-card="AJCandover"><img alt="" src="RaspberryPITVHDMI_archivos/20.png" title="Audric" class="avatar" width="20" height="20"></a><span title="25 Apr 2018 12:59" data-time="1524675595323" data-format="tiny" class="relative-date">Apr '18</span></div></a></li><li><span class="number">3</span><h4 role="presentation">replies</h4></li><li class="secondary"><span class="number heatmap-high" title="16718">16.7k</span><h4 role="presentation">views</h4></li><li class="secondary"><span class="number">4</span><h4 role="presentation">users</h4>