-
Notifications
You must be signed in to change notification settings - Fork 427
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multi-Device support switching between computers (feature CHANGE_HOST) #806
Comments
This should be possible, and someone was trying to get it to work, but I can't find the issue right now. The problem is that Solaar tries to remember the last value for settings, so that if you use this setting to switch to the other host then Solaar will keep on restoring the setting, which will switch to the other host. |
This should be possible but what kind of interface are you expecting? |
I don't have a device that has this feature, but I believe that 1814 is the feature to work with. I don't have documentation on the feature but I do remember that someone was trying to implement a change host functionality. |
Could someone please point me to some documentation on how to start working on this 1814 feature? I have never had any experience with HID interface and I have no idea how to start. You guys probably can name at least few tools and give some examples on how to start hacking on this. My understanding is that solaar can list this feature but doesn't support any operations on it. |
Getting documentation is a hit or miss effort. You could open an issue at https://github.com/Logitech/cpg-docs |
@mkkot Solaar doesn't provide any API, the most we can do is add a CLI command. |
@FFY00 If you have time and will to implement it, then CLI is fine with me. I would happily use it in my bash script. If I can help in any way, just tell me what's needed. I was actually browsing the repo myself today but it's a lot to take. For starters I would like to know which files I need to open in IDLE and which function I can use and how to send some values to a certain registry. |
@mkkot Woudn't that https://github.com/debauchee/barrier serve your use case? |
It's an interesting project, but I don't think it works in the way I want. Especially, I don't want to have both OS-es opened at 2 different monitors at the same time. Also, it generates some overhead, I guess that barrier must be installed on both systems and communicate with each other. I would prefer to have simple solution instead. But thanks for the suggestion anyway :) |
Understandable, wouldn't your idea only work with Linuxes though? AFAIK neither under Windows nor macOS is it possible to switch it programmatically. It's one of the most common request on Logitech's forums too. |
Yes, that's true. Since I can't really rely on what kind of secondary system/laptop is connected to my monitor, I decided that I will control switching from my primary PC (which runs Linux). It's true that for switching from secondary system back to my primary PC requires switching keyboard manually first to my primary PC. But since I need to press keys on it to trigger my script anyway, then I decided it's not such a big deal. The script would switch mouse (which normally requires 2 presses) and monitor (at least 3 presses on very uncomfortable buttons). |
The usefulness of that is quite limited, I can see another use case of implementing "change host" though, switching keyboard and mouse together. |
Actually it's up to the user to decide what he/she needs and up to the system to have the feature :) For me it's useful, for you maybe not, but that's fine. Also, switching mouse and keyboard at the same time is so obvious that you would expect it to work this way by default. |
You can use WireShark for USB packet sniffing. |
Sniffed a bit, unsurprisingly, keyboard doesn't send anything to the host on switch, it's internal, only when coming back it sends some info, I'm guessing with the host/button associations since L_Options have them on display. |
@saue0 Can you comment here on what you did for switching? |
This is what gets sent on host switch when screen edge is touched. Left edge, from host 3 to 2. flow.zip [ just mouse ] It starts around first HID++ packet, rest is just mouse movement. |
@saue0 There is documentation for this feature in https://drive.google.com/drive/folders/0BxbRzx7vEV7eWmgwazJ3NUFfQ28 |
@saue0 I'll try to see what it would take to add a timeout when looking for a reply. |
@saue0 The code that waits for a reply is lib/logitech_receiver/base.py function request. The information there is contradictory. There is a comment that the function waits indefinitely, but the read has a timeout. I guess that the way to see what is really going on is to add debugging statements inside the loop. Can you do that? (If not, I can create a PR with some extra debugging code.) |
@saeu0 I see that you used range for the setting. I think choices might be better (even though it is a range of sorts). |
@pfps Seeing both I'd prefer yours. Truth be told, personally I don't care as I'm going to use only command line part of it. I have two Linux machines which I've set to switch when touching right top corner on one and left-top on another, it's great. |
I'm using only the command line as well. So it does'nt mather. @pfps will you add "change_host" in your release ? |
@saue0 I'm not quite sure what you are asking for. If you think that your code is ready the thing to do is to put in a PR for it. However, that's going to require some work on your part as FFY00 just recently added code style checks, with the result that no old changes will rebase sucessfully. So you'll have to download the current version of Solaar and do some editing. |
I've taken the code by @saue0 (thanks for the ideas, particularly turning off persisters) and put together a setting for change host. It's not quite ready for testing yet because it depends on the changes for MULTIPLATFORM and this hasn't been completely debugged yet. |
Just discovered this package and it indeed works great for switching both keyboard and mouse using the keyboard from the Linux host running solaar to my other system (thanks a lot for this feature). rules.yaml:
Unfortunately that other system is running Windows (company laptop, so running something like barrier won't work since it's network activity is restricted by VPN). Alternatively, since Solaar is python code, it should potentially run on Windows. I expect the main issue would be the interaction with the device. Would it work if the receiver driver would be switch to a libusb version using something like https://zadig.akeo.ie/ Edit: |
The main part of Solaar depends on two aspects of Linux: Diverting of keys is done via the Reprogrammable Keys feature of the Logitech HID++ protocol. There is documentation of this feature in the Logitech Google Drive repository at https://drive.google.com/drive/folders/0BxbRzx7vEV7eWmgwazJ3NUFfQ28?resourcekey=0-dQ-Lx1FORQl0KAdOHQaE1A (Edited to include the correct URLs for the documents.) |
Thanks a lot for the support. In the end I decided to undo the reprogramming, to still use those keys to switch the keyboard independently and instead use the gesture button of the mouse to trigger the switch. In particular since I could also remap this button using Logitech Options to trigger a script that uses hidapitester binary to send the change-host commands. For others interested; rules.yaml:
Switch script (Using https://github.com/todbot/hidapitester):
|
For anyone who wants to also use this method of switching on Windows, be warned that the exact commands depend on the device model. |
More like a question: is it possible to change device controlled by logitech mouse or keyboard (keys 1, 2, 3) programmatically?
Solar shows HID++ feature:
9: CHANGE HOST {1814}
But I don't know how to use it or if it's what I'm looking for.
Why?
I have a laptop and normal PC and I switch between them often. I have already prepared input source switch for monitor and now I would like to automate switching mouse and keyboard.
The text was updated successfully, but these errors were encountered: