<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Logitech on Mozabre As Idle Moments</title><link>https://mitz17.com/en/tags/logitech/</link><description>Recent content in Logitech on Mozabre As Idle Moments</description><generator>Hugo -- gohugo.io</generator><language>en-US</language><lastBuildDate>Wed, 15 Jul 2026 20:00:00 +0900</lastBuildDate><atom:link href="https://mitz17.com/en/tags/logitech/index.xml" rel="self" type="application/rss+xml"/><item><title>Switching an Easy-Switch Mouse Between Ubuntu and Windows: Fixing Bluetooth Auto-Reconnect Lag</title><link>https://mitz17.com/en/blog/mx-ergo-s-ubuntu-windows-bluetooth/</link><pubDate>Wed, 15 Jul 2026 20:00:00 +0900</pubDate><guid>https://mitz17.com/en/blog/mx-ergo-s-ubuntu-windows-bluetooth/</guid><description>&lt;h2 id="what-this-post-covers"&gt;What This Post Covers
&lt;/h2&gt;&lt;p&gt;I share an Easy-Switch Logitech mouse (an &lt;code&gt;MX ERGO S&lt;/code&gt;, in my case) between a Windows machine and an Ubuntu machine, moving between them with the button on the underside of the mouse.
Windows connects through a Logi Bolt receiver; Ubuntu connects over Bluetooth.
The goal was simple: &lt;strong&gt;press the button, and the mouse just works, with no lag.&lt;/strong&gt;
Ubuntu was the problem. After switching, it would take around five seconds to reconnect — or it would never reconnect at all. This post covers what caused that and how I worked around it.&lt;/p&gt;
&lt;p&gt;None of this is specific to the MX ERGO S. If you use Easy-Switch to move a mouse or keyboard between multiple PCs, the symptoms may look familiar.&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;ve kept the dead ends in as well, partly as notes to my future self.&lt;/p&gt;
&lt;h2 id="just-want-the-fix"&gt;Just Want the Fix?
&lt;/h2&gt;&lt;p&gt;Jump to &amp;ldquo;&lt;a class="link" href="#the-fix" &gt;The Fix&lt;/a&gt;&amp;rdquo;.&lt;/p&gt;
&lt;h2 id="contents"&gt;Contents
&lt;/h2&gt;&lt;ul&gt;
&lt;li&gt;&lt;a class="link" href="#what-i-wanted" &gt;What I Wanted&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="link" href="#environment" &gt;Environment&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="link" href="#why-bluetooth-on-ubuntu" &gt;Why Bluetooth on Ubuntu?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="link" href="#the-symptoms" &gt;The Symptoms&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="link" href="#narrowing-down-the-cause" &gt;Narrowing Down the Cause&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="link" href="#what-didnt-work" &gt;What Didn&amp;rsquo;t Work&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="link" href="#the-fix" &gt;The Fix&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="link" href="#closing-thoughts" &gt;Closing Thoughts&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="what-i-wanted"&gt;What I Wanted
&lt;/h2&gt;&lt;p&gt;Here&amp;rsquo;s what I was aiming for:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Windows connects over a Logi Bolt receiver&lt;/li&gt;
&lt;li&gt;Ubuntu connects over Bluetooth&lt;/li&gt;
&lt;li&gt;The Easy-Switch button moves the mouse between the two machines&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Ubuntu reconnects instantly, with no perceptible lag&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;No buying a second Logi Bolt receiver — make it work with what I already have&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="environment"&gt;Environment
&lt;/h2&gt;&lt;table&gt;
 &lt;thead&gt;
 &lt;tr&gt;
 &lt;th&gt;Item&lt;/th&gt;
 &lt;th&gt;Details&lt;/th&gt;
 &lt;/tr&gt;
 &lt;/thead&gt;
 &lt;tbody&gt;
 &lt;tr&gt;
 &lt;td&gt;OS&lt;/td&gt;
 &lt;td&gt;Ubuntu 24.04, Windows 11 Pro&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;Bluetooth stack&lt;/td&gt;
 &lt;td&gt;BlueZ&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;Mouse&lt;/td&gt;
 &lt;td&gt;Logitech MX ERGO S&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;Ubuntu connection&lt;/td&gt;
 &lt;td&gt;Bluetooth&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;Windows connection&lt;/td&gt;
 &lt;td&gt;Logi Bolt&lt;/td&gt;
 &lt;/tr&gt;
 &lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;Pairing itself completed without any trouble.&lt;/p&gt;
&lt;h2 id="why-bluetooth-on-ubuntu"&gt;Why Bluetooth on Ubuntu?
&lt;/h2&gt;&lt;p&gt;Windows uses a Logi Bolt receiver. If I simply plugged a second Logi Bolt receiver into the Ubuntu box, none of what follows would be necessary.&lt;/p&gt;
&lt;p&gt;The problem is that I only own one of them.&lt;/p&gt;
&lt;p&gt;Logitech has two generations of wireless receiver: &lt;code&gt;Unifying&lt;/code&gt;, the older standard, and &lt;code&gt;Logi Bolt&lt;/code&gt;, its successor. The two are not compatible. A Unifying device won&amp;rsquo;t pair with a Logi Bolt receiver, and vice versa. Logitech&amp;rsquo;s newer mice and keyboards have been moving to Logi Bolt.
So while I have Unifying receivers coming out of my ears, not one of them is any use here.
That leaves Bluetooth as the option on the Ubuntu side.&lt;/p&gt;
&lt;p&gt;For reference, Logi Bolt receivers are sold separately for around 1,200 yen (checked June 2026). Prices move, so check the listing for the current figure.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Model numbers: &lt;code&gt;LBUSB1&lt;/code&gt; (USB-A) / &lt;code&gt;LBUSBC&lt;/code&gt; (USB-C)&lt;/li&gt;
&lt;li&gt;Amazon.co.jp product page: &lt;a class="link" href="https://www.amazon.co.jp/dp/B09HSZKXNY" target="_blank" rel="noopener"
 &gt;https://www.amazon.co.jp/dp/B09HSZKXNY&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If 1,200 yen doesn&amp;rsquo;t sound like real money to you, I&amp;rsquo;d genuinely recommend just buying the second receiver and skipping this entire post.&lt;/p&gt;
&lt;h2 id="the-symptoms"&gt;The Symptoms
&lt;/h2&gt;&lt;p&gt;Switching from Windows to Ubuntu with Easy-Switch gave inconsistent results:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Ubuntu often wouldn&amp;rsquo;t pick the mouse up at all&lt;/li&gt;
&lt;li&gt;Connecting manually always worked&lt;/li&gt;
&lt;li&gt;Sometimes it reconnected right away&lt;/li&gt;
&lt;li&gt;Running &lt;code&gt;bluetoothctl scan on&lt;/code&gt; would sometimes make it connect&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Running &lt;code&gt;bluetoothctl connect&lt;/code&gt; repeatedly also produced this:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Failed to connect: org.bluez.Error.Failed
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Operation already in progress
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id="narrowing-down-the-cause"&gt;Narrowing Down the Cause
&lt;/h2&gt;&lt;p&gt;To work out whether the hardware was at fault or Ubuntu was, I went through the obvious checks in order.&lt;/p&gt;
&lt;h3 id="bluez-was-already-up-to-date"&gt;BlueZ Was Already Up to Date
&lt;/h3&gt;&lt;p&gt;My first guess was a stale package.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;apt policy bluez
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Installed: 5.72-0ubuntu5.5
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Candidate: 5.72-0ubuntu5.5
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;That&amp;rsquo;s the current version on Ubuntu 24.04, so this wasn&amp;rsquo;t a missing update.&lt;/p&gt;
&lt;h3 id="the-pairing-was-fine"&gt;The Pairing Was Fine
&lt;/h3&gt;&lt;p&gt;Next, the device info.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;bluetoothctl info XX:XX:XX:XX:XX:3A
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Paired: yes
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Bonded: yes
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Trusted: yes
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Connected: no
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Nothing wrong with the pairing or the trust flag. The device is simply sitting there at &lt;code&gt;Connected: no&lt;/code&gt;.&lt;/p&gt;
&lt;h3 id="manual-connection-always-worked"&gt;Manual Connection Always Worked
&lt;/h3&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;bluetoothctl connect XX:XX:XX:XX:XX:3A
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This never failed. So the mouse isn&amp;rsquo;t broken and the pairing isn&amp;rsquo;t corrupt — the problem is in &lt;strong&gt;Ubuntu&amp;rsquo;s automatic reconnect path&lt;/strong&gt;.&lt;/p&gt;
&lt;h3 id="scanning-makes-it-connect"&gt;Scanning Makes It Connect
&lt;/h3&gt;&lt;p&gt;Starting a scan from inside &lt;code&gt;bluetoothctl&lt;/code&gt; caused an immediate connection.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;power on
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;scan on
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Connected: yes
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;ServicesResolved: yes
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;So when Ubuntu &lt;strong&gt;does&lt;/strong&gt; see the MX ERGO S, it connects to it correctly. Which suggested a hypothesis: without something to trigger discovery, the mouse just sits there unconnected.&lt;/p&gt;
&lt;p&gt;One note — you may see this during scanning, but it only means a scan is already running. It isn&amp;rsquo;t an error worth chasing.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Failed to start discovery: org.bluez.Error.InProgress
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id="scanning-continuously-still-wasnt-enough"&gt;Scanning Continuously Still Wasn&amp;rsquo;t Enough
&lt;/h3&gt;&lt;p&gt;If the hypothesis held, keeping a scan running permanently should remove the problem entirely: discovery never stops, so the mouse never gets stranded. So I left a scan running.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;exec bluetoothctl --timeout &lt;span style="color:#ae81ff"&gt;0&lt;/span&gt; scan on
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;It didn&amp;rsquo;t work out that way. &lt;strong&gt;The mouse was being detected and still wasn&amp;rsquo;t being connected&lt;/strong&gt;, more often than not. Tuning the scan interval didn&amp;rsquo;t help either.&lt;/p&gt;
&lt;p&gt;So &amp;ldquo;nothing triggers discovery&amp;rdquo; isn&amp;rsquo;t the whole story. Something in the path between &lt;em&gt;detecting&lt;/em&gt; the device and &lt;em&gt;connecting&lt;/em&gt; to it is also failing. Scanning alone doesn&amp;rsquo;t fix this.&lt;/p&gt;
&lt;h2 id="what-didnt-work"&gt;What Didn&amp;rsquo;t Work
&lt;/h2&gt;&lt;p&gt;For the record, here&amp;rsquo;s everything that fell short on its own.&lt;/p&gt;
&lt;table&gt;
 &lt;thead&gt;
 &lt;tr&gt;
 &lt;th&gt;Attempt&lt;/th&gt;
 &lt;th&gt;Result&lt;/th&gt;
 &lt;/tr&gt;
 &lt;/thead&gt;
 &lt;tbody&gt;
 &lt;tr&gt;
 &lt;td&gt;Updating BlueZ&lt;/td&gt;
 &lt;td&gt;Already current; no change&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;Shortening &lt;code&gt;ScanIntervalAutoConnect&lt;/code&gt;&lt;/td&gt;
 &lt;td&gt;Somewhat better, but reconnects stayed inconsistent and sometimes never happened&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;Continuous &lt;code&gt;scan on&lt;/code&gt; alone&lt;/td&gt;
 &lt;td&gt;Device detected, frequently still not connected&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;Repeated &lt;code&gt;connect&lt;/code&gt; calls&lt;/td&gt;
 &lt;td&gt;&lt;code&gt;Operation already in progress&lt;/code&gt;&lt;/td&gt;
 &lt;/tr&gt;
 &lt;/tbody&gt;
&lt;/table&gt;
&lt;h2 id="the-fix"&gt;The Fix
&lt;/h2&gt;&lt;p&gt;The approach: keep a scan running so discovery has a trigger, and — separately — explicitly call &lt;code&gt;connect&lt;/code&gt; whenever the mouse isn&amp;rsquo;t connected. Then run that as a systemd user service so it stays alive for the whole login session.&lt;/p&gt;
&lt;h3 id="1-write-the-connect-script"&gt;1. Write the Connect Script
&lt;/h3&gt;&lt;p&gt;Save the following as &lt;code&gt;~/.local/bin/mx-ergo-connect.sh&lt;/code&gt;. The same idea works for any other mouse; just swap the address.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;#!/bin/bash
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;DEVICE&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;XX:XX:XX:XX:XX:3A&amp;#34;&lt;/span&gt; &lt;span style="color:#75715e"&gt;# replace with your device&amp;#39;s Bluetooth address&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;bluetoothctl power on &amp;gt;/dev/null 2&amp;gt;&amp;amp;&lt;span style="color:#ae81ff"&gt;1&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;bluetoothctl scan on &amp;gt;/dev/null 2&amp;gt;&amp;amp;&lt;span style="color:#ae81ff"&gt;1&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;while&lt;/span&gt; true; &lt;span style="color:#66d9ef"&gt;do&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;if&lt;/span&gt; ! bluetoothctl info &lt;span style="color:#e6db74"&gt;&amp;#34;&lt;/span&gt;$DEVICE&lt;span style="color:#e6db74"&gt;&amp;#34;&lt;/span&gt; 2&amp;gt;/dev/null | grep -q &lt;span style="color:#e6db74"&gt;&amp;#34;Connected: yes&amp;#34;&lt;/span&gt;; &lt;span style="color:#66d9ef"&gt;then&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; timeout &lt;span style="color:#ae81ff"&gt;5&lt;/span&gt; bluetoothctl connect &lt;span style="color:#e6db74"&gt;&amp;#34;&lt;/span&gt;$DEVICE&lt;span style="color:#e6db74"&gt;&amp;#34;&lt;/span&gt; &amp;gt;/dev/null 2&amp;gt;&amp;amp;&lt;span style="color:#ae81ff"&gt;1&lt;/span&gt; &lt;span style="color:#f92672"&gt;||&lt;/span&gt; true
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;fi&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; sleep &lt;span style="color:#ae81ff"&gt;1&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;done&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Make it executable.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;chmod +x ~/.local/bin/mx-ergo-connect.sh
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;What the script does, in five steps:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Turns Bluetooth on and starts scanning&lt;/li&gt;
&lt;li&gt;Checks the connection state of the MX ERGO S once per second&lt;/li&gt;
&lt;li&gt;Explicitly calls &lt;code&gt;bluetoothctl connect&lt;/code&gt; if it isn&amp;rsquo;t connected&lt;/li&gt;
&lt;li&gt;Gives up after five seconds if the connect attempt hangs&lt;/li&gt;
&lt;li&gt;Tries again&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id="2-register-it-as-a-user-service"&gt;2. Register It as a User Service
&lt;/h3&gt;&lt;p&gt;Create &lt;code&gt;~/.config/systemd/user/mx-ergo-scan.service&lt;/code&gt;.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-ini" data-lang="ini"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;[Unit]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#a6e22e"&gt;Description&lt;/span&gt;&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;MX ERGO S auto-connect&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#a6e22e"&gt;After&lt;/span&gt;&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;bluetooth.target&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;[Service]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#a6e22e"&gt;ExecStart&lt;/span&gt;&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;%h/.local/bin/mx-ergo-connect.sh&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#a6e22e"&gt;Restart&lt;/span&gt;&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;always&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;[Install]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#a6e22e"&gt;WantedBy&lt;/span&gt;&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;default.target&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Then enable it.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;systemctl --user daemon-reload
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;systemctl --user enable --now mx-ergo-scan.service
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Check that it came up.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;systemctl --user status mx-ergo-scan.service
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Active: active (running)
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id="how-it-behaves"&gt;How It Behaves
&lt;/h3&gt;&lt;p&gt;The loop running on the Ubuntu side looks like this:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Keep scanning
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; ↓
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Check connection state every second
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; ↓
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Call bluetoothctl connect if disconnected
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; ↓
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Abort after 5 seconds if it hangs
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; ↓
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Retry
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Instead of waiting on BlueZ&amp;rsquo;s unreliable auto-reconnect, this keeps pushing explicit connection requests at the mouse.
Since setting this up, switching from Windows back to Ubuntu reconnects near-instantly — close enough to &amp;ldquo;it connects the moment I press the button.&amp;rdquo;&lt;/p&gt;
&lt;p&gt;To be precise, this is a one-second polling loop, so the lag isn&amp;rsquo;t literally zero. But it&amp;rsquo;s well below what you&amp;rsquo;d notice in practice, and a big improvement on &amp;ldquo;five seconds&amp;rdquo; or &amp;ldquo;never.&amp;rdquo; You could shorten the polling interval further, but you&amp;rsquo;d be trading CPU time for it. One second is a reasonable starting point.&lt;/p&gt;
&lt;h3 id="the-trade-offs"&gt;The Trade-offs
&lt;/h3&gt;&lt;p&gt;This treats the symptom, not the cause, and it costs you something. Know what you&amp;rsquo;re signing up for.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;It clutters the airwaves.&lt;/strong&gt;
Scanning continuously means broadcasting probes across the 2.4 GHz band without pause.
That interferes with Wi-Fi and with other Bluetooth devices. If you use Bluetooth earbuds or a headset alongside this, expect audio dropouts or added latency to be the first thing you notice.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;It costs power.&lt;/strong&gt;
The Bluetooth adapter never gets to idle, so battery life on a laptop can take a visible hit.
On a desktop it&amp;rsquo;s negligible; on the move, it isn&amp;rsquo;t.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;It fights with other Bluetooth operations.&lt;/strong&gt;
Because it holds discovery open, you&amp;rsquo;ll hit &lt;code&gt;org.bluez.Error.InProgress&lt;/code&gt; or &lt;code&gt;Operation already in progress&lt;/code&gt; when pairing a new device or opening the GNOME settings panel.
Stop the service before doing any pairing work.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;You can&amp;rsquo;t disconnect on purpose.&lt;/strong&gt;
The loop reconnects anything it finds disconnected, so a deliberate disconnect gets undone immediately.
The MX ERGO S can switch to another host, but Ubuntu will keep trying to grab it back the whole time you&amp;rsquo;re using it elsewhere.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Even so, this is what was left after exhausting what BlueZ&amp;rsquo;s own settings could do.
If the trade-offs aren&amp;rsquo;t acceptable, buy the Logi Bolt receiver and connect over USB instead. That&amp;rsquo;s the reliable answer.&lt;/p&gt;
&lt;h2 id="closing-thoughts"&gt;Closing Thoughts
&lt;/h2&gt;&lt;p&gt;May your QOESL improve.&lt;/p&gt;
&lt;h2 id="related-posts"&gt;Related Posts
&lt;/h2&gt;&lt;ul&gt;
&lt;li&gt;&lt;a class="link" href="https://mitz17.com/blog/dev-pc-build-ryzen7600-rtx4070s/" &gt;A Ryzen 5 7600 + RTX 4070 Super Build: A 163,000-Yen Machine for Development and AI Experiments&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description></item></channel></rss>