Open-source project
marcelhoffs/input-switcher avatar
marcelhoffs/input-switcher

input-switcher: moving a Logitech keyboard and mouse between two machines

Switch inputs with hidapitester (Windows & Linux)

579 stars45 forksShellLicense varies

At a glance

What is it?
input-switcher is a set of Windows batch files, Linux shell scripts and a Mac setup that switch Logitech Easy-Switch keyboards and mice between two computers with one keypress, by sending a raw HID report to the receiver with the hidapitester tool. It suits someone working across a desktop and a laptop with shared peripherals, and it needs the receiver's USB IDs worked out by hand.
Who is it for?
input-switcher is worth setting up if you use one Logitech keyboard and mouse across two machines and the Easy-Switch button is in the wrong place, because the whole solution is a short HID report sent by a bundled tool, and the Windows, Linux and Mac paths are each a handful of files. It is the wrong tool if your peripherals do not have Easy-Switch, and the wrong tool if you want a general keyboard remapper.
Can I use it commercially?
Not without permission. GitHub finds no licence file in the repository, and without a licence all rights are reserved by default: you may read the code but not reuse it. Check the README, or ask the authors, before using it.
Is it still maintained?
Activity is slowing. The repository last received commits 6 months ago.
What is it written in?
Mainly Shell, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on October 22, 2026, and from our analysis. They are not legal advice.

Editorial analysis

The problem is one misplaced Easy-Switch button

The scripts in this repository let you switch your Logitech keyboard and mouse with one click of a button to another channel. The repository contains scripts as well as the hidapitester tool for both Windows and Linux, and it points out that if you prefer the most current version of hidapitester you can download it from its own repository, todbot/hidapitester.

The hardware requirement is specific. You need multiple Logitech devices with Easy-Switch, typically a keyboard and a mouse, connected to two different machines, either directly via bluetooth or via Logitech Unifying or Bolt receivers. All devices should connect to machine A when set to channel 1 and to machine B when set to channel 2.

The setup is then symmetric, and it is worth spelling out because the symmetry is the trick. On machine A you set up a script that causes all devices to switch to channel 2, and you bind that script to a key. On machine B you set up a script that causes all devices to switch to channel 1, and you bind it to the same key. Pressing that key moves your keyboard and mouse back and forth between the machines.

The tutorial assumes machine A is Windows and machine B is Linux, though other setups are possible provided you modify the names and target channel of the scripts accordingly. There is also a Mac README in the mac/ directory for the Mac case.

The primary language recorded for the repository is Shell, and the tree is small: a README.md, a commands.txt, an images/ directory, and the linux/, mac/ and windows/ folders holding the actual scripts.

Windows: a batch file, a VBS wrapper, and a hidapitester binary

The windows folder contains three files, and each solves a specific problem.

switch_to_2.bat is the simple batch script that switches your devices to channel 2. hidapitester.exe is the hidapitester tool for Windows, included so you do not have to download it manually. And switch_to_2.vbs is a Visual Basic script that is just a wrapper around switch_to_2.bat.

That wrapper exists for a reason worth understanding. If you executed switch_to_2.bat directly you would get a command prompt window that pops up every time, and the switch_to_2.vbs script prevents this. So if you bind this script to a key on your keyboard you can switch to another channel without the window popping up. On Linux there is no equivalent wrapper, because a shell script run from a desktop shortcut does not open a terminal window in the same way.

The setup steps are the same shape on both platforms. On Windows, create the folder C:\Program Files\InputSwitcher and copy the 3 files into it. Execute switch_to_2.bat manually to see if it is already working out of the box, and if not, the documentation says to refer to section 6 to tweak the script for your setup. Then use Logitech Options to assign a custom application to the Menu key and have it execute C:\Program Files\InputSwitcher\switch_to_2.vbs.

The step that is not optional is the manual test. The documentation's phrasing is that you should try it out of the box first, because the script is written for one specific receiver and one specific set of parameters, and a script that sends a HID report to the wrong device does nothing visible at all.

Linux: raw HID access is the thing you have to solve

The linux folder holds switch_to_1.sh, the hidapitester tool for Linux, and 42-logitech-unify.rules, and the third of those exists for a reason that is the whole Linux section.

If you have Solaar installed this file is not needed. If you do not have Solaar installed you will probably notice that hidapitester does not work without root permissions, for example via sudo. This is because non-root users do not have raw access to the hid devices by default. The 42-logitech-unify.rules file is a udev rule that allows raw access to the Logitech Unify receiver for non-root users, and the documentation warns that you might have to unplug your receiver and plug it in again for the rule to take effect.

The setup copies the files into place:

bash
  cd linux
  sudo cp hidapitester /usr/bin
  sudo cp switch_to_1.sh /usr/bin
  sudo cp 42-logitech-unify.rules /usr/lib/udev/rules.d
  chmod +x /usr/bin/hidapitester
  chmod +x /usr/bin/switch_to_1.sh

Then you execute switch_to_1.sh manually to see whether it already works, referring to section 6 to tweak the script if not. Finally, in your desktop environment of choice, define a custom shortcut. The author's own choice is the Menu key on the keyboard, assigned to execute /usr/bin/switch_to_1.sh.

The udev detail is the part that catches people out. Without Solaar, without the rule, or with root invoked through sudo every time, the script either fails silently or asks for a password each time, and a keypress that pops a sudo prompt is worse than no keypress at all.

The command is a raw HID report, and the parameters are yours to find

Section 6 of the documentation is the part that makes this repository usable rather than merely runnable, and it opens by saying you now know how to set it up, but it probably does not work yet, because the delivered script files are geared toward a specific setup. You will have to figure out what the correct command is that you have to send to your devices for them to switch.

The delivered command on Windows looks like this:

bash
.\hidapitester.exe --vidpid 046D:C52B --usagePage 0xFF00 --usage 0x0001 --open --length 7 --send-output 0x10,0x01,0x09,0x1e,0x01,0x00,0x00

And the generic form of the command is:

bash
.\hidapitester.exe --vidpid <vidpid> --usagePage <usagePage> --usage <usage> --open --length <length> --send-output <payload>

Wait, the generic form in the documentation is:

bash
.\hidapitester.exe --vidpid <vidpid> --usagePage <usagePage> --usage <usage> --open --length <length> --send-output <payload>

That is the whole mechanism in one line. The tool opens a raw HID device, identified by vendor and product ID, a usage page and a usage, and writes a payload of a given length. The payload is the Easy-Switch report that tells the receiver to move the devices to the other channel.

The VID and PID together uniquely identify a human interface device. Logitech's Vendor ID is 046D, so the value will always be of the form 046D:<PID>, which is a useful shortcut because only the product half varies. To find the values for your connected devices, the documentation says to use the --list option on each platform, and to look for Logitech devices with VID 046D in the results. For a Unifying or Bolt receiver you can just use the value listed below in the documentation, and for bluetooth devices the documentation gives a specific filter command:

bash
.\hidapitester.exe --usagePage 0xFF43 --usage 0x0202 --list

So the setup work for most people is: run --list, find your receiver, copy the numbers into the script, and test.

Binding the key, and the GNOME case where it does not work

The key binding is the last step, and it differs by platform in a way that is worth knowing before you start.

On Windows, Logitech Options can bind the key to the switch_to_2.vbs script. The author uses the same key on both machines, and the images/ directory holds a photograph of the keyboard showing which one.

On Linux it depends on the desktop environment. In Gnome you do it through Settings, then Keyboard, then View and Customize Shortcuts, then Custom Shortcuts. In other environments the mechanism is whatever the desktop provides, which is the same reason the project cannot give you one instruction.

There is also a worked fallback for the case where the key you want to map is not recognized in a Gnome environment, and the project points at the Input Remapper tool, which allows you to detect your Logitech devices and more. The sequence it gives is: run the tool and click on the device, for example the Logitech MX Keys, to land in the Presets tab; create a new Preset and double click it to land in the editor; in the bottom left, click the add button below Input, press Record and press the button you want to remap; in output, create a new Macro, target the keyboard and press your combination of choice, which becomes the combination that triggers the key binding in Gnome. The author's own combination is Control_L plus Alt_L plus Super_L plus period, chosen specifically because it is one he will never press by accident. Then you name the preset, press apply, and specify the script in Gnome's custom shortcut editor.

The documentation adds a security aside at the end of that list, and it deserves attention. It says to remember to make sure that the script you created is executable and that hidapitester can run as root, that you have multiple choices, which have a number of security implications, and lists a suid shell script and sudo nopasswd for hidapitester as examples, then tells you to make an informed decision.

Where input-switcher is the wrong tool

The first limit is that it only works with Logitech Easy-Switch hardware, and not much else. There is no generic version here: the payload is a Logitech vendor report, the usage page and usage values are Logitech's, and the device list is filtered on Logitech's vendor ID. Someone with a different multi-machine keyboard has nothing to reuse here.

The second is the raw HID access requirement on Linux. The tool talks to the HID device directly, which is why non-root users normally cannot, and why a udev rule has to grant the access. That is a real privilege grant on a machine, and the documentation's own list of options, suid shell script, sudo nopasswd, and its instruction to make an informed decision, is a reminder that this is a small convenience with a small but real security cost. Solaar is the better answer for Linux users who want device management, and the documentation says so.

The third is the manual work. Out of the box the scripts are geared toward a specific setup, and the expectation is that you will have to determine the right vidpid, usagePage, usage, length and payload yourself, using --list, and possibly per receiver model. That is a one-time job for someone comfortable with HID reports and a frustrating one for someone who is not.

The fourth is that this is not a remapper. It switches channels and does nothing else. A team that wants to change a key mapping, move a key to another machine or reassign a layout is looking for a remapping tool, and the project even points at Input Remapper for the case where the key you want is not recognised, which is a different tool solving a different problem.

The fifth is the release history. There is one tag, v0.1 from 2022-10-10, the licence is recorded as unknown, and the last push to the repository was on 2026-04-24. So the scripts have not been touched in a while, the repository has no licence file to point at, and the one release is not a versioned series you can pin and upgrade. The hidapitester binary is bundled, which is convenient, but it also means you are running a binary copied into your repository rather than one you fetched and checked yourself, and the project does suggest downloading the current version from todbot/hidapitester if you prefer it.

Editorial conclusion

input-switcher is worth setting up if you use one Logitech keyboard and mouse across two machines and the Easy-Switch button is in the wrong place, because the whole solution is a short HID report sent by a bundled tool, and the Windows, Linux and Mac paths are each a handful of files. It is the wrong tool if your peripherals do not have Easy-Switch, and the wrong tool if you want a general keyboard remapper. Before you rely on it, check the three things the documentation makes you do yourself: that you have multiple Logitech devices with Easy-Switch connected to two different machines, directly over bluetooth or through a Unifying or Bolt receiver, and all set to channel 1 on machine A and channel 2 on machine B; that you work out the correct vidpid, usagePage, usage, length and payload for your own receiver, because the delivered scripts are geared toward a specific setup and the guide says to expect to modify them; and that on Linux you read the udev rule note, since hidapitester needs raw HID access and the supplied 42-logitech-unify.rules exists to grant that to non-root users, and if Solaar is installed you do not need the file at all.

Frequently asked questions

What hardware do I need for the input-switcher scripts?

Multiple Logitech devices with Easy-Switch, typically a keyboard and a mouse, connected to two different machines, either directly via bluetooth or through Logitech Unifying or Bolt receivers. All devices connect to machine A on channel 1 and machine B on channel 2, and the two scripts are bound to the same key on each machine.

How do I find the right HID parameters for my Logitech receiver?

Use the list option of hidapitester on your platform and look for Logitech devices with vendor ID 046D, then copy the values into the script. The command takes the form of a vidpid of 046D:<PID>, a usagePage, a usage, a length and a payload. For bluetooth devices the documentation suggests filtering with the usagePage 0xFF43 and usage 0x0202 list arguments.

Why does hidapitester need root on Linux?

Non-root users do not have raw access to the hid devices by default, so the repository includes a udev rule called 42-logitech-unify.rules that grants raw access to the Logitech Unify receiver for non-root users, which may require unplugging and replugging the receiver. If Solaar is already installed the rule is not needed.

Official sources

  1. Issues
  2. marcelhoffs/input-switcher on GitHub
  3. README
  4. Releases
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/marcelhoffs-input-switcher.svg)](https://hysenlabs.com/projects/marcelhoffs-input-switcher)