Skip to content
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

Multiple monitors on each PC #3

Open
shantur opened this issue Dec 27, 2023 · 43 comments
Open

Multiple monitors on each PC #3

shantur opened this issue Dec 27, 2023 · 43 comments
Labels
enhancement New feature or request

Comments

@shantur
Copy link

shantur commented Dec 27, 2023

Hi,

Excellent idea and implementation.
As of now, does it support multiple monitors with different resolutions connected on each PC ?

Thanks

@hrvach
Copy link
Owner

hrvach commented Dec 27, 2023

Resolutions should not be a problem, but I never tried it on a multi-monitor setup. I'll try and report back :)

@fayfay78
Copy link

fayfay78 commented Jan 8, 2024

hi there, any news about multiple screens?

@hrvach
Copy link
Owner

hrvach commented Jan 8, 2024

hi there, any news about multiple screens?

I believe it should work, provided that the orientation/layout is correct, but I'm traveling and have no way to test yet.

My assumption is that if you have 2 machines with 2 FHD screens each, let's call them A and B, setting them up like:

---------------------------------------
| B left | B right | A left | A right |
---------------------------------------

would be identical as having e.g. 3840 x 1080 screen on the left and a similar one on the right. However, there are 3 major OSes to try on, as well as mismatched resolution scenario (one "left" monitor UHD and "right" monitor FHD). Unless somebody beats me to it, I'll try to see what happens in a couple of days :)

@jcassan
Copy link

jcassan commented Jan 9, 2024

Hi,
Thank you for providing such an amazing project.
I just tried what you mentionned :

---------------------------------------
| B left | B right | A left | A right |
---------------------------------------

My mouse is switching well from B right to A left but other screens do not work.

I have a "logical barrier" at borders of the main screen on both pc. I also tried a setup with vertical stack resulting in the same behavior. If I use my trackpad to get out of the barrier and then re-use the mouse connected to the pico, cursor is being teleported to the main screen.

All screens are FHD and pcs are running windows 10.

My soldering skills are pretty bad so let me know if any bad solder could make the picos behave like this.
I also should mention the keyboard does not work on pc connected to board B but this might be a soldering issue somewhere.

@hrvach
Copy link
Owner

hrvach commented Jan 10, 2024

I've tested the multiple screen scenario and it works for me with no issues [tm] (as suggested above).

I don't know what a logical barrier is in this context, please be so kind to explain (I have nothing similar configured, just a plain ubuntu with two monitor output on one side and the mouse just skips screens as expected).

if your mouse works on PC connected to A but keyboard doesn't work on board connected to B, check solder/contacts on pins 7 and 2 of the ADuM1201 chip. Also check if you soldered pin 16 on pico A (marked GP12 on solder mask) and pin 22 on pico B (marked GP17 on solder mask).

@jcassan
Copy link

jcassan commented Jan 10, 2024

Sorry for not being precise on my explanation, I will try again.

From B right to A left, everything works just fine.
When I try to move the mouse from B right to B left, the mouse is blocked at the left border of B right. I am not able to move the cursor to B left. (Same behavior for A device)

I am using two laptops for my tests. I can use my trackpad to move the mouse to my second screen (eg B right to B left). When I do so and use the mouse back, cursor is being teleported back to B right.

Anyway, I think solders are not clean enough to learn much from my tests. I will try to assemble a second unit this week end as I bought enough component to do so. I will let you know how it turns out.

@hrvach
Copy link
Owner

hrvach commented Jan 10, 2024

Now I understand, sorry for being slow :) It seems Microsoft KB5003637 update to Win 10 brok^H^H^H^H changed the HID system behavior. I have no idea if it's going to be reverted at some point. In theory this could be worked around with a horrible hack by having a relative mode mouse just for screen hopping, or perhaps easier - activate accessibility mode to control mouse with numpad and then patch the firmware to send a numpad right/left when you reach internal screen border.

Thank you for finding this and sharing,, I had no idea Windows behaved this way!

@jcassan
Copy link

jcassan commented Jan 11, 2024

Wow, well spotted ! Let me know if you want to build a new custom firmware someday to correct this. I would be happy to test it if needed.

@hrvach
Copy link
Owner

hrvach commented Jan 11, 2024

Wow, well spotted ! Let me know if you want to build a new custom firmware someday to correct this. I would be happy to test it if needed.

I'm focusing on basic functionality first, to cover most users and most hardware. Then we tackle the edge cases, like specific OS multi-desktop handling. I think it should be doable :)

@hrvach
Copy link
Owner

hrvach commented Jan 13, 2024

As of now, it works on Linux, Windows 10 might have issues after KB5003637 and so might macOS.

Added to the list of feature requests/ideas, as this requires some workarounds to support.

#27

@Trekky12
Copy link

I noticed the problem on both of my machines and I think your proposed solution to add a driver which reports the MOUSE_VIRTUAL_DESKTOP flag is the best solution.
Apparently no full driver but a filter is enough, like described in the forum post: https://community.osr.com/discussion/74220/absolute-mouse-data-on-multi-monitors#Comment_74225

You don't have to replace mouhid to get this to work either. Just
insert a device upper filter on mouhid so that it sits in between mouhid
and mouclass.

And apparently this is what Adder did to solve this: https://support.adder.com/tiki/tiki-read_article.php?articleId=103
Maybe we could test this approach.

@hrvach
Copy link
Owner

hrvach commented Jan 18, 2024

@Trekky12 this is a great find, thank you. There is very little actual info on this anywhere.

I have some ideas how to address that potentially, and avoiding any software would be great (because very often you can't install drivers, and for good reason).

This brings up the complexity, as you have to model multiple screens on multiple outputs, but it's doable. Definitely in the roadmap :)

@hrvach hrvach added the enhancement New feature or request label Jan 18, 2024
@Trekky12
Copy link

I totally agree with you that it's best done without needing to install any software (especially on work devices where this is often not possible).

Great to hear that this is on the roadmap 👍

@forrestguest
Copy link

Would it be possible to have a mode where the mouse isn't used for hopping? I am mostly interested in the fast switching and removing the need to restart an electrical connection with each USB device when switching desktops. I don't really need the cursor based hopping. Happy to open another issue if needed.

@hrvach
Copy link
Owner

hrvach commented Jan 23, 2024

Would it be possible to have a mode where the mouse isn't used for hopping? I am mostly interested in the fast switching and removing the need to restart an electrical connection with each USB device when switching desktops. I don't really need the cursor based hopping. Happy to open another issue if needed.

You can do this by hitting Right CTRL + L to "lock" the mouse to the current screen and not have it hop. Would this be something along the lines of what you're after?

@forrestguest
Copy link

That may work, I meant more along the lines of suppressing the absolute positioning and just passing along the mouse inputs. But thinking it through, you'd still have to be able to pass something through the pico, so I probably just need to be patient and wait for MS to roll back that KB

@infosecconsultant
Copy link

infosecconsultant commented Feb 16, 2024

I've got what's probably an odd setup with multiple monitors/displays.

Currently I've got | Windows-1 | MacOS-1 | Windows-2 |
And underneath MacOS-1 is | MacOS-2 |

Currently, I can't seem to 'reach' MacOS-2 (the inbuilt MacOS display) from MacOS-1 or any other display.

Also, it's swapped Win1 and MacOS-1's positions. Not sure how to swap that back either.

I use a custom mechanical keyboard and I don't actually have a Right CTRL key, I went to https://usevia.app/ to modify that, but the keyboard isn't detected (Which makes sense and I can plug it in and do that, but just thought I'd point that out as well)

Is there anything I can configure to allow this or is the solution gonna be Win1|Win2|Mac1|Mac2?

(Great project btw, and if anyone needs a spare board, I got a couple dozen made to gift to friends and I've still got spares)

Edit: I thought I'd add a couple of other things that might help others.
Using a logitech wireless reciever, works no worries (only for mouse).
Mouse feels a little sluggish in MacOS, feels fine in Windows.
I have macropads on my keyboard, they work fine (although I can't customise them using the useVIA app mentioned above unless I plug the board in direct).
I have two knobs on my keyboard, one for page scrolling (works great) and one for audio (doesn't work at all).
Works fine in/out of my virtual machines.

@hrvach
Copy link
Owner

hrvach commented Feb 16, 2024

I feel almost embarrassed how basic my two-monitor setup is compared to some of you folks! :) I'm sorry but I simply have to ask out of curiosity - can you can share a picture of your setup? :)))

Currently, switching is only supported in the X direction, mostly because I have to figure out how to mount my screen vertically. To swap positions, simplest way is to swap micro usb cables. Adding a software solution to set this up isn't terribly complicated but work was super-busy lately and left zero energy to work on personal stuff.

You can change mouse speed per-output in the config, try changing that. It could also be that you got used to mouse acceleration feature in OS X and that is missing?

Via won't work by design (I use it too and love it, it's brilliant), but even a minuscule chance of computer A exploiting some vulnerability there and using it as a vector to attack computer B is too high. The premise is - no inbound data, ever (except the LED).

Not sure about Mac, but Win has a Microsoft KB5003637 issue which removed support for multi screens in absolute mode. This is something I plan to address with a silly workaround of adding relative coords as well in the descriptor and use a 1px movement to jump screens, but also need to define the concept of screen jumps that don't switch outputs, address different behavior with different OS, not make a terrible mess with configuring this etc.

There will probably be better multi-monitor support, but interleaved outputs will probably not work because you can't directly jump to screen 2 with that MS restriction.

@infosecconsultant
Copy link

I feel almost embarrassed how basic my two-monitor setup is compared to some of you folks! :) I'm sorry but I simply have to ask out of curiosity - can you can share a picture of your setup? :)))

Sure, I've kinda redacted a bit of stuff out of it though. The mount is custom built from aluminium extrusions for my 3x 27" monitors.

image

work was super-busy lately and left zero energy to work on personal stuff.

No worries. I realise this is a pet project of yours. If you ever open up a link for donations though, please let me know. This is a game-changer of a device for me :)

This isn't even my ideal setup, I'd actually like to chain a couple of other laptops and a raspi which is what I used to use Synergy for but a hardware based solution (with a focus on security like you seem to have) is way more desirable. That said, the config files for synergy defining the layout was very handy and an a suggestion, perhaps that's a way to go about things (define resolution and position in a text file on the boards?).

I realise i'm probably the minority by a long shot here but I'll be following developments closely. If there's anything I can test please let me know!

I also should have mentioned in my original port Windows-1/Mac-1 can't reach Windows-2 either. So I'm confined to Windows 1 and Mac 1 (middle and left screens in that picture).

Thanks!

@hrvach
Copy link
Owner

hrvach commented Feb 17, 2024

@infosecconsultant this setup is just ... wow. I feel like a caveman now! Actually there is something you could test for me. Please test windows and mac like this: try plugging in another mouse and when you reach the right edge of screen 1 using deskhop, move the "other" mouse to the right a bit to hop on screen 2. Then continue moving the normal mouse connected through deskhop. What happens? Are you now stuck on screen 2 or returned back to screen 1? Screen 1 and screen 2 here mean multiple screens on the same output/os.

This would be valuable info to determine how to try addressing this multiple monitors issue.

Thanks in advance!

@infosecconsultant
Copy link

Ahhh thanks lol. It took a while to find what worked great for me and honestly, there was a lot of building my own solution for things because there is no commercial alternative 🥲 Some people regularly use upwards of 6 monitors (stock traders, security guards, people in the matrix) and some people are happy with just one, whatever works 🤷

Yeah so if I use a second mouse on windows, it lets me scroll around on that screen no worries, but as soon as I touch the deskhop mouse it snaps back to the first monitor.

MacOS on the other hand lets me switch between screens with the trackpad and I end up 'stuck' on that screen with the deskhop mouse. (it doesn't switch me back to the first monitor although it does reset the position of the cursor on the new screen to the last known position of the original screen).

@hrvach
Copy link
Owner

hrvach commented Feb 19, 2024

That's great information, thanks - so macos could benefit from that hypothetic workaround but windows would still remain broken. Oh well, it's either installing a driver for windows or going back to relative mode there.

There seem to be no elegant solutions here :(

@infosecconsultant
Copy link

Well, a work around for Mac would definitely be better than nothing.

A driver is less than ideal. Is there any chance there could be some client side agent on windows? Also not ideal but getting FOSS drivers to work on Windows is not fun. It seems KB5003637 addressed some HID specific vulnerabilities so I'm not really in a position to roll it back either. Are there any other potential solutions?

@hrvach
Copy link
Owner

hrvach commented Feb 19, 2024

Yes, but not a single one is nice or simple. You could switch to relative mouse motions for screens above 1 in windows and mac but that's less precise, requires additional configuration (screen resolution, os/screen layout), etc.

I have a simple idea how to maybe work around all of this for both operating systems, but not having a gazillion-screen setup reduces my options to experiment.

@infosecconsultant
Copy link

I can potentially send you some additional monitors if that would help? Your setup would have to support that though.

@hrvach
Copy link
Owner

hrvach commented Feb 19, 2024

I can potentially send you some additional monitors if that would help? Your setup would have to support that though.

Nah, I couldn't take your monitors. I'd have nowhere to put them! I need to find something tiny that could fit on my desk, or use 1-2 cheap usb hdmi capture devices from Amazon. Those seem to be the most promising approach, as they don't take any additional space and you can fake 2 more screens easily.

@infosecconsultant
Copy link

Well, alternatively, it is possible to buy ~5-8 inch HDMI LCD's for fairly cheap (usually used with Raspberry Pi's but would work with any other OS as well).

@galooph
Copy link

galooph commented Feb 19, 2024

Looks like commercial projects are struggling with this, too, see https://forum.level1techs.com/t/usb-roaming-mouse-km-switch-monitor-question/203273.

@hrvach
Copy link
Owner

hrvach commented Feb 22, 2024

Yep, it's not an easy problem to solve, especially when your premise is not installing any drivers. I have a few ideas to try, maybe one of them will work OK.

@AJolly
Copy link

AJolly commented Mar 13, 2024

IMG20240313151506
@infosecconsultant keyboard twins! I created a magnetic suspension for mine + tpu keys. Also used to be an infosec guy.

Came here because I want a kvm solution that doesnt lag, which input director, synergy, barrier, etc all do. (mouse movement latency, not switching latency).
But I obviously need multimon support. Input director has the most flexible multimon positioning of anything I've found.

I'm ok with a hybrid hw + software solution though, I'm thinking about essentially

  1. Software to detect when at edge of screen.
  2. Find a software controllable KVM - maybe trigger it via a hotkey via a pi or something, or ill have to check if theres a way to get bidirectional comms via QMK or VIA.
  3. some software script to sync up the mouse position for that transfer, then let the rest of the movement be handled via direct USB hid input.

@hrvach
Copy link
Owner

hrvach commented Mar 18, 2024

This looks ... I have no words, probably Space Shuttle is what comes to mind. Man! :)

@infosecconsultant since you were the one asking about the Mac, you might be interested to learn I've finally managed to find some time to do a bit of coding and managed to get a Mac workaround to function. Windows one will be a bit uglier once it's done, but might work to a certain degree.

Would you be interested to do some testing?

@jalmeroth
Copy link
Contributor

Would you be interested to do some testing?

@hrvach I would be willing to do multiple screen-testing on MacOS too (my setup is here: #56), if it's of any help.

@lvntbkdmr
Copy link

lvntbkdmr commented Mar 21, 2024

is there any software solution (workaround, patch etc.) for windows 10 as it currently disables the second monitor when deskhop is connected

@hrvach
Copy link
Owner

hrvach commented Mar 21, 2024

is there any software solution (workaround, patch etc.) for windows 10 as it currently disables the second monitor when deskhop is connected

No software solutions are planned - the point of this is to do it in hardware as a self-contained thing. Windows workaround will basically be: for desktop 2 and beyond switch to relative mouse mode. Switching back from win screen 2 to screen 1 will not be very accurate but that's why it's a workaround. Work is crazy these days, so progress is slow... thank you for your patience.

@lvntbkdmr
Copy link

is there any software solution (workaround, patch etc.) for windows 10 as it currently disables the second monitor when deskhop is connected

No software solutions are planned - the point of this is to do it in hardware as a self-contained thing. Windows workaround will basically be: for desktop 2 and beyond switch to relative mouse mode. Switching back from win screen 2 to screen 1 will not be very accurate but that's why it's a workaround. Work is crazy these days, so progress is slow... thank you for your patience.

Ok, so is it possible to disable the instant switch when mouse movement is detected on the monitor edges and instead rely on only shortcut (some keyboard keypresses) and make the switch, but also be able to use 2 monitors on a windows pc? I do not know whether it is related with edge detection or not, but maybe at least we can use deskhop as a regular USB switch with a shortcut instead of an external hardware switch to trigger switching ?

@Trekky12
Copy link

Trekky12 commented Mar 27, 2024

Thank you very much for the experimental code for multiple monitors @hrvach!

I have two secondary screens on each of my Windows-PCs and would like to give some feedback:
In general it is working very well 🥳

Sometimes when moving the mouse from the secondary to the primary screen the mouse jumps back to the border where the secondary and the primary screen meet. It seems to occur after a specific time and not on a specific position, so when the mouse is already on the middle of the primary screen it is more obvious than when the mouse is still near the border.

It seems that this behaviour is almost every time on the "right PC" (A) and not so often on the "left PC" (B) but it occurs on both.

Sometimes it is not possible to move windows from the primary to the secondary screen. Moving windows from the secondary to the primary screen is always possible. It seems there is a link betweent his two behaviours because "after" the mouse jumping to the border the window movement is never possible but when no jump happened the window movement is possible.

Is there anything I can help to debug this and improve the multiple monitor feature?

@hrvach
Copy link
Owner

hrvach commented Mar 27, 2024

One thing you can try is turning off the mouse acceleration in windows if possible. Also, if you keep moving the pointer past the screen edge on the secondary windows screen, it will accumulate positioning error which then demonstrates as "mouse jumps back to the border" since the box can't know you're pushing the mouse beyond the screen edge in relative mode. What would potentially help is defining screen resolution and capping the movements past that point. One could make Windows use relative mode on all screens but that would make the experience of jumping FROM windows to another computer a bit worse. I can try that too :)

@Trekky12
Copy link

Unfortunately turning mouse acceleration off changes nothing. It would be great if you could try your suggested solution :-)

@hrvach
Copy link
Owner

hrvach commented Mar 27, 2024

I'll see what can be done! There will probably be no magic fix that makes Windows behave like Linux, it will be a workaround but it can surely be improved at least a bit. Good thing is at least the initial plan somewhat works, so the effort was not pointless :)

@spanzetta
Copy link

spanzetta commented Apr 8, 2024

Dear @hrvach
I did update one of my 2 deskhop device to latest 0.51 FW (which if I understood well should add workaround for multiple desktop) but it doesn't work..

Maybe I am doing something wrong.. but on my setup it behaves like previous FW

My setup is: 1 Win10 Laptop (A) with internal + external monitor (which is above the Laptop, but I tried also to reconifgure it to be on the right side on main monitor) and 1 Tizen Smart Monitor (B)

On A the mouse remains always on main internal screen..

Should I do something manually to enable the support of the 2nd screen on A?

Thanks in advance

@spanzetta
Copy link

ops.. I missed the instructions at https://github.com/hrvach/deskhop?tab=readme-ov-file#multiple-screens-per-output
Will test it soon..
Sorry

@spanzetta
Copy link

You are magic!!
It works..
Well done

@hrvach
Copy link
Owner

hrvach commented Apr 8, 2024

There is still room for improvement, hopefully I get it to a usable state...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests