Coder Social home page Coder Social logo

input-switcher's Introduction

Logitech MX - Input Switcher

1 - Introduction

The application and scripts provided in this repository let you switch your Logitech keyboard and mouse with one click of a button to another channel. This respository contains scritps for both Windows and Linux. You can use this repository to create your own specific setup. The repository contains the hidapitester tool for both Windows and Linux. If you prefer to use the most current version you can download this here: https://github.com/todbot/hidapitester

What you need is 2 Logitech Unifying/Bolt receivers or bluetooth connection. One for your Windows machine and one for your Linux machine. Then take one receiver and first connect the keyboard to it and then the mouse. Make sure that both are connected on channel 1. Take the second receiver and first connect the keyborad to it and then the mouse. Make sure that both are connected on channel 2. The first receiver connects to the Windows machine, the second to the Linux machine.

So if your keyboard and mouse are on channel 1, they control the Windows machine. If they are on channel 2, they control the Linux machine.

2 - Windows

The windows folder contains the following files:

  • switch_to_2.bat
  • switch_to_2.vbs
  • hidapitester.exe

Create the following folder c:\Program Files\InputSwitcher and copy the 3 files into this folder. Now use Logitech Options to assign a custom application to the "Menu" key and have it execute the program: C:\Program Files\InputSwitcher\switch_to_2.vbs.

2.1 - switch_to_2.bat

This simple batch script switches the input to channel 2.

2.2 - switch_to_2.vbs

This is a Visual Basic script that is just a wrapper around switch_to_2.bat. If you would execute switch_to_2.bat you would get a command prompt window that pops up every time. 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 windows popping up.

3 - Linux

From the Linux folder, copy both files (switch_to_1.sh & hidapitester) to: /usr/bin

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

If you have Solaar installed copying the 42-logitech-unify.rules file is not needed. If you don't have Solaar installed you will probably notice that hidapitester does not work without root permissions (e.g. via sudo). This is because non-root users do not have raw access to the hid devices by default. So the 42-logitech-unify.rules file is a udev rule that allows raw access to the Logitech Unify receiver for non-root users. You might have to unplug your receiver and plug it in again.

Now in your desktop environment of choice, define a custom shortcut. In my case I have used the "Menu" key on my keyboard and assigned it to execute /usr/bin/switch_to_1.sh.

3.1 - switch_to_1.sh

This is a simple shell script for Linux to switch the input to channel 1.

3.2 - 42-logitech-unify.rules

As explained earlier, this is a udev rule to allow non-root users raw access to the Unify receiver. As in write commands to it.

4 - Mac

To get this working on a Mac refer to the Mac README

5 - Bind the scripts to a key

Personally I use this key to bind the scripts to in both Windows and Linux. Keyboard

5.1 - Windows key binding

In Windows you can use Logitech Options to bind the key to the switch_to_2.vbs script.

5.2 - Linux key binding

In Linux it depends on the desktop environment you use. In Gnome you can do it via: Settings > Keyboard > View and Customize Shortcuts > Custom Shortcuts Gnome

6 - Modify the scripts

Now you know how to set it up, but it probably does not work yet. This is 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.

Take the command for Windows for example:
.\hidapitester.exe --vidpid 046D:C52B --usage 0x0001 --usagePage 0xFF00 --open --length 7 --send-output 0x10,0x01,0x09,0x1e,0x01,0x00,0x00

--vidpid 046D:C52B
This is the ID of the Logitech Unifying receiver that is plugged in to the Windows machine. Normally this ID is the same for all receivers. In Linux you can easily find this by running the lsusb commmand in a terminal. In Windows you can find the ID via Devices and Printers. Find the Logitech Unifying Receiver and check the Hardware ID of the USB Composite Device. Devices

--usage 0x0001
--usagePage 0xFF00
--open
--length 7
All these options are just defaults, you can ignore those

--send-output 0x10,0x01,0x09,0x1e,0x01,0x00,0x00
This is the important part, because this command tells which device to do what.

Let's take this command: 0x10,0x01,0x09,0x1e,0x01,0x00,0x00
And rewrite it as: A,B,C,D,E,F,G

A = always 0x10, although Solaar seems to use 0x11.
B = This is the number of the device that is linked to the Unifying receiver: 0x01 for the first device (the keyboard), 0x02 for the second device (the mouse). 0x00 Is supposed to be the Bluetooth device, but I haven't tested that.
C = ?
D = ?
E = This is the channel to switch to: 0x00 for channel 1, 0x01 for channel 2 (and I guess 0x02 for channel 3)
F = always 0x00.
G = always 0x00.

So value of C and D are unknown... how to figure that out? Well to do that, we will use the Solaar application on Linux. Install Solaar on Linux and make sure that your keyboard and mouse are connected to channel 2, the Linux machine. Now open a terminal and execute the following command. This instructs Solaar to switch the device with the name "MX Keys" (the keyboard) to channel 1. So basically you command it to switch the keyboard back to Windows:

solaar -ddd config "MX Keys" change-host 1

You should see your keyboard switch to channel 1 and it is connected to Windows again. At the end of the log you will see something like this:

logitech_receiver.base: (18) <= w[11 01 091E 00000000000000000000000000000000]

This is the command that was sent, by Solaar, to your keyboard to switch to channel 1. You can also write this as:

11 01 09 1E 00 00 00

or

0x11 0x01 0x09 0x1E 0x00 0x00 0x00

If you repeat this test multiple times you will see that C will never change, it stays 09. Though D will change almost every time. Sometimes it is 1E, sometimes 1B... etc. Just pick one. So finally our set of data, for the keyboard, then is:

A = 0x10
B = 0x01
C = 0x09
D = 0x1E
E = 0x00 to switch to Windows (channel 1), 0x01 to switch to Linux (channel 2)
F = always 0x00
G = always 0x00

Now repeat this for the mouse and you will get this:

A = 0x10
B = 0x01
C = 0x0A
D = 0x1B
E = 0x00 to switch to Windows (channel 1), 0x01 to switch to Linux (channel 2)
F = always 0x00
G = always 0x00

So C is specific to the device. In my case 09 is for the MX Keys keyboard and 0A for the MX Anywhere 3 mouse. This will probably be different in your case.

โš ๏ธ If you are having issues getting commands to work on one Windows computer that you extracted from Solaar on another computer, the device number (B) may be different on the different receivers, especially if you have reused a receiver from a different device set. Physically swap the receivers to each computer during testing to verify the numbering.

So in conclusion this is what you have to put in your bat (on Windows) and shell script (on Linux):

On Windows
Keyboard to channel 2 : 0x10,0x01,0x09,0x1e,0x01,0x00,0x00
Mouse to channel 2 : 0x10,0x02,0x0a,0x1b,0x01,0x00,0x00

On Linux
Keyboard to channel 1 : 0x10,0x01,0x09,0x1e,0x00,0x00,0x00
Mouse to channel 1 : 0x10,0x02,0x0a,0x1b,0x00,0x00,0x00

If you want use bluetooch connection you need to find proper device by using:

.\hidapitester.exe --list-detail

then you need to use 11 bytes long message (HID++)

.\hidapitester.exe --vidpid 046D:B367 --usage 0x0202 --usagePage 0xff43 --open --length 11 --send-output 0x11,0x00,0x09,0x1E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00

Keyboard to channel 2: 0x11,0x00,0x09,0x1E,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 Mouse (MX Master 3S) to channel 2: 0x11,0x00,0x0A,0x1E,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00

input-switcher's People

Contributors

galusz avatar marcelhoffs avatar pliablepixels avatar rloutrel avatar shbatm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

input-switcher's Issues

Question: Use with another keyboard than Logitechs MX

Hi,

I just tried that with the Logitech Mouse and seems to be working fine in Windows, but I'm wondering if this is possible to use with another keyboard, for example with a Keychron K8 to change between the 3 BT channels.

Alternative to Solaar for windows 10

Do you have an alternative to Solaar for generating the commands on windows?

My setup is two Windows 10 PC where I connect my Logitech devices (MX keys and MX Master 3) with unifying dongles. The input-switcher works out of the box with the keyboard but not with the mouse.

Working setup For Mechanical MX Keyboard and MX Master 3S for business on windows and linux

Make sure your Mechanical MX Keyboard and MX Master 3S are both paired to Linux and Windows via Log Bolt

On Windows side:

  1. Create C:\Program Files\InputSwitcher Folder.
  2. Download the files listed below and save them in the folder created in step 1
  1. In the folder created in step 1 create a new file named switch_to_b_2.bat then fill it with the code below and click save
 rem Switch Mechanical MX Master and MX Master 3S to channel 2 from windows to linux respectively
.\hidapitester.exe --vidpid 046D:C548 --usage 0x0001 --usagePage 0xFF00 --open --length 7 --send-output 0x10,0x01,0x09,0x1b,0x01,0x00,0x00
.\hidapitester.exe --vidpid 046D:C548 --usage 0x0001 --usagePage 0xFF00 --open --length 7 --send-output 0x10,0x02,0x0a,0x1b,0x01,0x00,0x00

4 . Download and Install logitech option plus
5. Click on the Mouse Gesture button and assign it to open C:\Program Files\InputSwitcher\switch_to_2.bat.
image.
6. Press on the Mouse Gesture button on your mouse to switch your mouse and keyboard to linux.

On linux side:

  1. Download the the file below then save it in /usr/bin/ directory
    hidapitester
  2. In the /usr/bin directory create a new file and name it switch_to_1.sh with the content below then save
#!/bin/bash

#Switch Mechanical MX Master and MX Master 3S to channel 2 from windows to linux respectively
/usr/bin/hidapitester --vidpid 046D:C548 --usage 0x0001 --usagePage 0xFF00 --open --length 7 --send-output 0x10,0x02,0x09,0x1b,0x00,0x00,0x00
/usr/bin/hidapitester --vidpid 046D:C548 --usage 0x0001 --usagePage 0xFF00 --open --length 7 --send-output 0x10,0x01,0x0a,0x1b,0x00,0x00,0x00

thumbnail_image
Note: you should have two files in /usr/bin
thumbnail_image (3)
3. Go to your synaptic manager or software distribution and install solaar-gnome
thumbnail_image (4)
4. Open solar and left click on your paired MX Master 3S mouse to activate the edit rules button in the bottom right corner and click on it
thumbnail_image (2)
5. Add user defined rule as shown in the screenshot below with the same order
thumbnail_image (1) then click on save button
6. Click on your Gesture mouse button to shift your mouse and keyabord to windows

Works for the mouse on MacOS but not the keyboard

Hi! Could anyone please help correcting my script? I would really appreciate that, I've been frustrated by this for hours. It works for my mouse but not the keyboard:

# Switch MX Keys Mini to Channel 1
hidapitester --vidpid 046D:B369 --usage 0x0202 --usagePage 0xFF43 --open --length 20 --send-output 0x11,0x00,0x09,0x1E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00

# Switch MX Master 3 to Channel 1
hidapitester --vidpid 046D:B034 --usage 0x0202 --usagePage 0xFF43 --open --length 20 --send-output 0x11,0xFF,0x0a,0x1b,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00

This is what hidapitester --list-detail returns for the devices:

046D/B369: Logitech - MVM Logi Keyboard
  vendorId:      0x046D
  productId:     0xB369
  usagePage:     0x0001
  usage:         0x0006
  serial_number: 4B3A6C46 
  interface:     -1 
  path: DevSrvsID:4295067684

046D/B369: Logitech - MVM Logi Keyboard
  vendorId:      0x046D
  productId:     0xB369
  usagePage:     0x000C
  usage:         0x0001
  serial_number: 4B3A6C46 
  interface:     -1 
  path: DevSrvsID:4295067684

046D/B369: Logitech - MVM Logi Keyboard
  vendorId:      0x046D
  productId:     0xB369
  usagePage:     0xFF43
  usage:         0x0202
  serial_number: 4B3A6C46 
  interface:     -1 
  path: DevSrvsID:4295067684

046D/B034: Logitech - MVM Logi Mouse
  vendorId:      0x046D
  productId:     0xB034
  usagePage:     0x0001
  usage:         0x0002
  serial_number: 3BB22717 
  interface:     -1 
  path: DevSrvsID:4295067952

046D/B034: Logitech - MVM Logi Mouse
  vendorId:      0x046D
  productId:     0xB034
  usagePage:     0x0001
  usage:         0x0001
  serial_number: 3BB22717 
  interface:     -1 
  path: DevSrvsID:4295067952

046D/B034: Logitech - MVM Logi Mouse
  vendorId:      0x046D
  productId:     0xB034
  usagePage:     0xFF43
  usage:         0x0202
  serial_number: 3BB22717 
  interface:     -1 
  path: DevSrvsID:4295067952

I can't get my MX Mechanical Working.

Here is the script on my Windows box:

            @echo off
            
            rem Switch MX Master 3S to channel 2
            .\hidapitester.exe --vidpid 046D:C548 --usage 0x0001 --usagePage 0xFF00 --open --length 7 --send-output 0x10,0x01,0x0a,0x1b,0x01,0x00,0x00
            
            rem Switch MX Mechanical to channel 2
            .\hidapitester.exe --vidpid 046D:C548 --usage 0x0001 --usagePage 0xFF00 --open --length 7 --send-output 0x10,0x02,0x09,0x1e,0x01,0x00,0x00

My MX Master 3S switches fine but my MX Mechanical doesn't switch. I have tried channels 0-9 and I still get this output:

          C:\Program Files\InputSwitcher>switch_to_2.bat
          Opening device, vid/pid:0x046D/0xC548, usagePage/usage: FF00/1
          Device opened
          Writing output report of 7-bytes...wrote 7 bytes:
           10 02 0A 1B 01 00 00
          Closing device
          Opening device, vid/pid:0x046D/0xC548, usagePage/usage: FF00/2
          Device opened
          Writing output report of 7-bytes...wrote -1 bytes:
           10 01 09 1E 01 00 00
          Closing device

Please advise.

Version-Sensitive Solaar Log Not Mentioned by README

Finally get this working after an afternoon's work ... The result is great. Now I can switch both keyboard and mouse between a windows 11 laptop and an Ubuntu 20.04 desktop computer instantly.

Main Hindrance

When I found that switch_to_2.bat does not work, turned to 6 - Modify the scripts in README, and tested in Ubuntu with solaar -dd config "MX Keys" change-host 1, there is nothing like this:

logitech_receiver.base: (18) <= w[11 01 091E 00000000000000000000000000000000]

Reason

The version of Solaar I used for testing is 1.1.8, which is too new for w[11 01 091E ... to output. The debug output of Solaar has been frequently modified in recent versions (modifications found in 1.1.6, 1.1.4, 1.1.2). I tried Solaar 1.1.1 and obtained the desired output.
image

Few things to note:

  1. To use Solaar 1.1.1, download here and run bin/solaar -dd config "MX Keys" change-host 1 in its root directory. If error like Solaar: missing required package 'python-pyudev' is witnessed, you can consult this.
  2. If you want to test switch_to_2.bat in win11, double-click it in C:\Program Files\InputSwitcher instead of in other directory. And also don't use run as an administrator. Running in other directory or as an administrator won't work in my experience.

REAME Update

In conclusion, the README might be updated to inform the requirement of Solaar 1.1.1 to output the command we need.

i can't open the keyboard device on macOS Sonoma

This is the information on the keyboard

# hidapitester --list-detail

046D/B367: Logitech - MX MCHNCL M
  vendorId:      0x046D
  productId:     0xB367
  usagePage:     0x0001
  usage:         0x0006


046D/B367: Logitech - MX MCHNCL M
  vendorId:      0x046D
  productId:     0xB367
  usagePage:     0x000C
  usage:         0x0001


046D/B367: Logitech - MX MCHNCL M
  vendorId:      0x046D
  productId:     0xB367
  usagePage:     0xFF43
  usage:         0x0202

but the error appears that the device cannot be opened

# hidapitester --vidpid 046D:B367 --usage 0x0202 --usagePage 0xFF43 --timeout 2000 --open --read-input-forever --length 11 --read-feature 1

Opening device, vid/pid:0x046D/0xB367, usagePage/usage: FF43/202
Error: could not open device
Error on read: no device opened.
Error on read: no device opened.

it works fine on Windows

Help using and installing this

I'm a very new user of github repos and I have no idea how to install or use this program. I tried using the README file but I have no clue. I really need the inputswitcher to work for my mouse and keyboard. Please assist.

Command code for increasing keyboard backlight

Would it be possible to send a similar code as the one to change channel (e.g. 0x10,0x02,0x0a,0x1b,0x01,0x00,0x00) but to increase the backlight for the MX Keys instead? If so, could someone with access to Solaar please inform me what said code might be?

Kind regards,
Hani

Can't switch to channel 2.

I'm trying to connect MX Keys and MX Master 2S with two laptops. First connection over dongle on channel 1, second over Bluetooth on channel 2, and both are using Win 10. So far, I can't even make devices switch to channel 2, so I would like to know which step I'm missing? After default values from readme didn't work, this is what I've tried.

While on channel 1 .\hidapitester.exe --vidpid 046D:C52B --list-detail gives a list of 8 elements, like these:

046D/C52B: Logitech - USB Receiver
  vendorId:      0x046D
  productId:     0xC52B
  usagePage:     0xFF00
  usage:         0x0001
  serial_number: (null)
  interface:     2
  path: \\?\hid#vid_046d&pid_c52b&mi_02&col01...

046D/C52B: Logitech - USB Receiver
  vendorId:      0x046D
  productId:     0xC52B
  usagePage:     0xFF00
  usage:         0x0002
  serial_number: (null)
  interface:     2
  path: \\?\hid#vid_046d&pid_c52b&mi_02&col02...

046D/C52B: Logitech - USB Receiver
  vendorId:      0x046D
  productId:     0xC52B
  usagePage:     0xFF00
  usage:         0x0004
  serial_number: (null)
  interface:     2
  path: \\?\hid#vid_046d&pid_c52b&mi_02&col03...
...

Sniffing with .\hidapitester.exe --vidpid 046D:C52B --usage 0x0001 --usagePage 0xFF00 --timeout 2000 --open --read-input-forever --length 7 --read-feature 1 registers only switch device buttons (both on keyboard and mouse) and nothing else, with an output:

Opening device, vid/pid:0x046D/0xC52B, usagePage/usage: FF00/1
Device opened
Reading 64-byte input report 0, 2000 msec timeout...read 0 bytes:
Reading 64-byte input report 0, 2000 msec timeout...read 7 bytes:
 10 06 41 04 71 8A 40 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 //pressed channel 2 on mx keys
 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Reading 64-byte input report 0, 2000 msec timeout...read 0 bytes:
Reading 64-byte input report 0, 2000 msec timeout...read 0 bytes:
Reading 64-byte input report 0, 2000 msec timeout...read 7 bytes:
 10 06 41 04 B1 8A 40 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 //pressed channel 1 on mx keys
 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Reading 64-byte input report 0, 2000 msec timeout...

I tried both versions

//Value from above
C:\Program Files\InputSwitcher>.\hidapitester.exe --vidpid 046D:C52B --usage 0x0001 --usagePage 0xFF00 --open --length 7 --send-output 0x10,0x06,0x41,0x04,0x71,0x8A,0x40
Opening device, vid/pid:0x046D/0xC52B, usagePage/usage: FF00/1
Device opened
Writing output report of 7-bytes...wrote 7 bytes:
 10 06 41 04 71 8A 40
Closing device
//Default value
C:\Program Files\InputSwitcher>.\hidapitester.exe --vidpid 046D:C52B --usage 0x0001 --usagePage 0xFF00 --open --length 7 --send-output 0x10,0x01,0x09,0x1e,0x01,0x00,0x00
Opening device, vid/pid:0x046D/0xC52B, usagePage/usage: FF00/1
Device opened
Writing output report of 7-bytes...wrote 7 bytes:
 10 01 09 1E 01 00 00
Closing device

but neither command switches to channel 2. I tried to sniff the next entry, which I got with --list-detail by changing usage and usagePage, and it registers pressing channel 2 button, but for channel 1 it enters in some form of loop and shows 30+ entries. Regardless, trying the value I've got from sniffing, as well as the default value, gives wrote -1 bytes

C:\Program Files\InputSwitcher>.\hidapitester.exe --vidpid 046D:C52B --usage 0x000**2** --usagePage 0xFF00 --open --length 7 --send-output 0x10,0x06,0x08,0x20,0x00,0xD2,0x01
Opening device, vid/pid:0x046D/0xC52B, usagePage/usage: FF00/2
Device opened
Writing output report of 7-bytes...wrote -1 bytes:
 10 06 08 20 00 D2 01
Closing device

C:\Program Files\InputSwitcher>.\hidapitester.exe --vidpid 046D:C52B --usage 0x000**2** --usagePage 0xFF00 --open --length 7 --send-output 0x10,0x01,0x09,0x1e,0x01,0x00,0x00
Opening device, vid/pid:0x046D/0xC52B, usagePage/usage: FF00/2
Device opened
Writing output report of 7-bytes...wrote -1 bytes:
 10 01 09 1E 01 00 00
Closing device

so I assume this is not the correct usage and usagePage to use? After this entry, every other one either doesn't register keypresses while sniffing or it shows wrong values like for example 40 00 00 00 00 00 00. With that being said, what am I doing wrong?

not working via Bluetooth MX keys Mini & MX Anywhere 3

Hi,
I'm trying to set it up with my mouse and keyboard.

I got Windows as first device and Macbook as second via Bluetooth.

First I don't know if i'm setting this corectly:
.\hidapitester.exe --vidpid 046D:B367 --usage 0x0202 --usagePage 0xff43 --open --length 11 --send-output 0x11,0x00,0x09,0x1E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
in this command I'm changing:

  • vidpid
  • usage
  • usagePage

with every output line of command .\hidapitester.exe --list-detail but it do nothing.
For example result: 046D/B369: - vendorId: 0x046D productId: 0xB369 usagePage: 0x0001 usage: 0x0006 [...]
I write .\hidapitester.exe --vidpid 046D:B369 --usage 0x0006 --usagePage 0x0001 --open --length 11 --send-output 0x11,0x00,0x09,[...]

in this situation I don't know should I change Bytes C and D? I guess yes, but how to get this values on Windows or Mac?
and should I change anything else if i'm having slighty diffrent mouse and keyboard:

  • MX keys Mini
  • MX Anywhere 3

Problem with Logi Bolt MX mouse and keybord

I have a problem on one of my computers with sending the switch command, both running windows 10.
Computer number one switches from channel 1 to 2 no problems.
On the other computer the HW id is the same, but it just won't switch channel.
Running the command in CMD gets the same output on both computers.

The only difference I can find is logi bolt computer one is REV_0503 and the other is REV_0501

CMD output

Opening device, vid/pid:0x046D/0xC548, usagePage/usage: FF00/1
Device opened
Writing output report of 7-bytes...wrote 7 bytes:
10 02 0A 1B 00 00 00
Closing device

Config
rem Switch MX Mechanical to channel 1
.\hidapitester.exe --vidpid 046D:C548 --usage 0x0001 --usagePage 0xFF00 --open --length 7 --send-output 0x10,0x01,0x09,0x1e,0x00,0x00,0x00

rem Switch MX Master 3S to channel 1
.\hidapitester.exe --vidpid 046D:C548 --usage 0x0001 --usagePage 0xFF00 --open --length 7 --send-output 0x10,0x02,0x0a,0x1b,0x00,0x00,0x00

Logitech K780 and script to find the right command for your device

Hi guys, inspired by this post, I created a batch script to discover what is the command line to switch not documented Logitech devices.

Using the script I could find the command for Logitech K780 as below:
hidapitester --vidpid 046D:C52B --usage 0x0001 --usagePage 0xFF00 --open --length 7 --send-output 0x10,0x01,0x08,0x10,0x01,0x00,0x00

How to use:

  1. Copy both files to the same folder where input-switcher is located. Usually: C:\Program Files\InputSwitcher
  2. Open a Command prompt window and run BruteForceDiscover.bat
  3. Grab a beer and wait until your device is switched to channel 2.
  4. Having found the right pair of values, just update the original script file switch_to_2.bat with the ones from step 3.

Come considerations. Although simple, the process is heavily manual as I didn't spend much time on this, all I wanted was to make my own setup work. So, feel free to improve as needed.

DecToHex.bat
BruteForceDiscover.bat

Logitech Vertical Mouse

First up, I love the work done on this. I read the other thread with everyone really focused on solving this and I'm really amazed. Thanks!!!

I'm pretty sure the C & D are just about the same for the device as my MX Keys matched yours perfectly. Only thing I had to adjust was the B as it was my second device on the Unifying Receiver.

Since I couldn't find anybody mentioning the Logitech Vertical Mouse, I had a hard time finding the C for it. Brute forced a batch loop and it wasn't any numbers, but it turned out to be 0X0c. D was 0X1c. Just thought I'd post this in case anyone else was looking.

REQUEST: Android compatibility (and/or ARM)

Would it in some way be possible to make this work for Android?
I saw that hidapitester has an aarch64-binary, but I can't get it to run in an adb shell and I don't know if it is actually a permission problem (as the stderr prompts) or if there are actually external dependencies.

Switching but then switching back immediately

Hi! In my case I get the mouse and keyboard to switch to the selected channel (flashes once), but then switches back again to the previous channel immediately. Why and how do I fix that? Help, or even a discussion, would be very welcomed.

I'm running the code on a Windows machine, with a Unifiying Receiver and a MX Master 3/Keys.

POST:
hidapitester.exe --vidpid 046D:C52B --usage 0x0001 --usagePage 0xff00 --open --length 7 --send-output 0x10,0x02,0x0A,0x1f,0x02,0x00,0x00

RESULT:
Opening device, vid/pid:0x046D/0xC52B, usagePage/usage: FF00/1
Device opened
Writing output report of 7-bytes...wrote 7 bytes:
10 02 0A 1F 02 00 00
Closing device

Kind regards,
Hani

Can't switch back to channel 1

I can switch to channel 2 without any problems, but is unable to switch back to channel 1.
Channel 1 is a windows 11 pc and channel 2 is a windows 10 pc.

I've modified the .bat file, but i'm not sure if its correct.

rem Switch MX Keys to channel 1
.\hidapitester.exe --vidpid 046D:C52B --usage 0x0001 --usagePage 0xFF00 --open --length 7 --send-output 0x10,0x01,0x09,0x1e,0x01,0x00,0x00

rem Switch MX Anywhere 3 to channel 1
.\hidapitester.exe --vidpid 046D:C52B --usage 0x0001 --usagePage 0xFF00 --open --length 7 --send-output 0x10,0x02,0x0a,0x1b,0x01,0x00,0x00

Not Working

Is not working, maybe because Im in the latest version and is not valid anymore.
nothing happens.
with solaar works: solaar -dd config 2 change-host 1

nut with hidapitester doesn't

Opening device, vid/pid:0x046D/0xC52B, usagePage/usage: FF00/1
Device opened
Writing output report of 7-bytes...wrote 7 bytes:
 10 01 09 1A 01 00 00
Closing device
Opening device, vid/pid:0x046D/0xC52B, usagePage/usage: FF00/1
Device opened
Writing output report of 7-bytes...wrote 7 bytes:
 10 02 08 1A 00 00 00
Closing device

How to find value C for specific system?

The script works for the mouse, but not for the keyboard.
Either the ID is wrong, but I've tested everything from 00-99, og the C value is wrong, but I can't figure out how to verify it.

Any assistance would be very welcome :)

I'm on Windows.

Should same "command" work on Mac and Windows (except for different channel)?

I'm trying to set up a switcher between a windows machine (channel 1) and two macbook pro m1 (channel 2, 3).

I've got an MX Master 3 and an MX Mechanical. I'm using bluetooth for everything.

I've got the switcher batch jobs working on the windows box. I can switch to 2 and 3, no problem.

However, I'm running into issues running it on the macs - i can't switch to any other machines. I'm using the same "command" except for changing the the channel (E). I get a similar response on both the windows and mac, but the change doesn't seem to take hold.

Windows:

.\hidapitester.exe --vidpid 046D:B366 --usage 0x0202 --usagePage 0xff43 --open --length 11 --send-output 0x11,0x00,0x09,0x1E,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
Opening device, vid/pid:0x046D/0xB366, usagePage/usage: FF43/202
Device opened
Writing output report of 11-bytes...wrote 20 bytes:
 11 00 09 1E 01 00 00 00 00 00 00
Closing device

.\hidapitester.exe --vidpid 046D:B034 --usage 0x0202 --usagePage 0xff43 --open --length 11 --send-output 0x11,0x00,0x0A,0x1E,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
Opening device, vid/pid:0x046D/0xB034, usagePage/usage: FF43/202
Device opened
Writing output report of 11-bytes...wrote 20 bytes:
 11 00 0A 1E 01 00 00 00 00 00 00
Closing device

Mac:

sudo ./hidapitester --vidpid 046D:B366 --usage 0x0202 --usagePage 0xff43 --open --length 11 --send-output 0x11,0x00,0x09,0x1E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
Opening device, vid/pid:0x046D/0xB366, usagePage/usage: FF43/202
Device opened
Writing output report of 11-bytes...wrote 11 bytes:
 11 00 09 1E 00 00 00 00 00 00 00
Closing device

sudo ./hidapitester --vidpid 046D:B034 --usage 0x0202 --usagePage 0xff43 --open --length 11 --send-output 0x11,0x00,0x0A,0x1E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
Opening device, vid/pid:0x046D/0xB034, usagePage/usage: FF43/202
Device opened
Writing output report of 11-bytes...wrote 11 bytes:
 11 00 0A 1E 00 00 00 00 00 00 00
Closing device

Any ideas what might be going on? What might I be missing?

Problems switching from computer using Bluetooth instead of dongle

Has anybody been able to get this working FROM a computer where the devices are connected via Bluetooth? I have no problems executing from the computer using the dongle switching to the Bluetooth computer, but can't get it to work the other way. I'm thinking I'm finding the device correctly (vidpid for my machine 046D:B034) as when I try running hidapitester --read-input-forever I can see my other button presses register. When i press the button for changing devices i naturally lose connection without any input being read.

Any ideas?

How to get C and D values (from chapter 6) from Windows ?

Hi,

Thank you very much for this awesome tool.

How to get C and D values (from chapter 6) without any access to Solaar on linux ?

I am able to switch MX Master 3 from channel 1 to 2 because I'm lucky to get the same values as you got.

But can't find my MX Key values.

All my systems are running Windows xx.


image


Not exactly an issue

but the script sends control to RECEIVER_1 if it's already on RECEIVER_2, but let's say the keyboard has control from RECEIVER_2 and mouse has control from RECEIVER_1 and I want to run the script to take control from RECEIVER_1, it doesn't work

Windows 11 not working.

I have these on a Windows 10 and on my Mac. Works like a charm, but on my Windows 11 i seem not to get it working?
Have anyone else seen some issues with Windows 11?

It says -1 bytes written.
.\hidapitester.exe --vidpid 046D:C52B --usage 0x0001 --usagePage 0xFF00 --open --length 7 --send-output 0x10,0x01,0x09,0x1e,0x01,0x00,0x00
.\hidapitester.exe --vidpid 046D:C52B --usage 0x0001 --usagePage 0xFF00 --open --length 7 --send-output 0x10,0x02,0x0a,0x1b,0x01,0x00,0x00

// Erik

Support for Logitech Bolt Receiver (MX Master 3S & MX Keys Mini)?

First off, thank you for the development so far. As you may know, Logitech is moving with the Bolt receiver for current/future products. I tried to make the input switcher work for my devices, however, it did not seem to compute anything. I mapped the correct Hardware ID as mentioned in the steps but still no avail. My conclusion is that perhaps that there is a discrepancy in how the script will respond between a unifying receiver and a bolt one. So as my question suggests, is there support for the bolt receiver and/or is there a working example for one or both of the devices listed using a bolt receiver (MX Master 3S, MX Keys Mini)? Thank you.

Switch from Mac to Windows

I'm using MX MASTER 3S.

channel2 : mac(blutooth)
channel3 : windows(blutooth)

On Windows, I used this command with success.

hidapitester.exe --vidpid 046D:B034 --usage 0x0202 --usagePage 0xFF43 --open --length 11 --send-output 0x11,0x00,0x0A,0x1b,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00

But I don't know how to do it on a Mac.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.