-
Notifications
You must be signed in to change notification settings - Fork 12
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
Windows support/Multiple Displays #2
Comments
I believe he hasn't tested with windows. |
That error is for PyUSB not being able to find an interface to communicate with the OS's (Windows's) USB subsystem. I booted into my Windows installation and these steps were sufficient to make it work:
Now the libusb backend needs to be installed.
I did make a minor code update to control.py to make it Windows compatible so you'll need to update the copy you have. I don't own two of these monitors, would be interested in seeing how it works for you. |
Wow! Thank you very much - I indeed didn't realize that pyusb had further dependencies not installed by pip. I did install libusb and updated the the code. I can confirm that it now does work on windows! However, it does only work on one monitor. Unfortunately I never did anything in python the script would probably either need to provide a selection which "dev" object should be used or apply everything to all "dev" objects found. In my opinion that should depend on if you plan to implement options to sync the screen/set colors in the future. Especially video sync only really makes sense on one display. (Did you ever figure out how to realize that? I checked if it would be able to grab the screen content at all at from python at a fast enough pace, but the trick seems to be to just take a screenshot and scale it down: https://github.com/digital-concrete/light-sync) On the other hand selectable displays would add more complexity to running the script non-interactively (which I would really love to see - because that would make it possible to integrate the lights into my smarthome setup), since at least two arguments would have to be parsed... Like I said I am not really familiar with python, but if I can help debugging, etc. I am all in for it! |
I added multimonitor support. Obviously I can't test it, but it should work. See the readme for information. For video sync, see issue #1. I don't know how the protocol encodes the color information, and it seems nontrivial to figure that out. |
Thanks again for your work! Unfortunately that seems to have broken something: File "control.py", line 52, in If I comment out the part causing the error it says that two monitors are detected - so that part seems to work |
Does everything else (e.g. actually controlling the lighting) work properly with line 52 commented out? |
No, it gives the same error on "cfg = dev.get_active_configuration() # TODO: is this necessary? cfg is unused." It only starts when I completely disable lines 51-53 - but that doesn't get me very far: C:\AutoHotkey>python control.py Edit: It's turnOn, not TurnOn - However, that results in: Found 2 monitors During handling of the above exception, another exception occurred: Traceback (most recent call last): |
I've pushed an update which prints some debug info. If you could paste the output from that into something like pastebin.com and share the URL, that would be helpful. |
Of course! https://pastebin.com/j6B8TGJj |
It seems that libusb is unable to read the properties of or communicate with the second monitor. For example, the information printed for the first monitor has:
And for the second monitor it has:
At this point there are two things that I have left to suggest. 1:
Then you can run control.py again and hopefully it'll work. If not, you can double click the device in Device Manager, go to the Driver tab and Roll Back the drivers, which will undo the modifications from Zadig and allow the LG control center to work again. Or, the very final thing I can suggest, is that you could also try using the libusb-win32 backend instead of the libusb1 backend which you currently have. Roll back the drivers, then from For me with one monitor it works in all three configurations (the existing libusb1 backend, the Zadig WinUSB drivers, and with the libusb-win32 backend). But unfortunately I don't really know why this is happening, and if none of that fixes it then I don't know where to go from there. Good luck! |
Big thanks! Replacing the drivers did work! I am now able to use every function currently implemented! Btw: LG control is also still working - I suspect that most functions work over DDC instead of USB. I spend a few hours the other day trying to trick the Ultragear software into recognizing only one display with DDC manipulation - until I realized it just refuses to work in any multi display configuration - regardless if both of them are LG... Btw: Did you see my reply to #1? I bet it's just a prefix and a color code for every individual LED... |
Awesome! So you can control both or individual monitors? And did you have to use the Zadig/WinUSB drivers or the libusb-win32 drivers? I can update the documentation with that information. |
Yes - I can control them both or individually - everything works as intented. |
Thanks. I wrote up a Windows setup guide (here) and linked it from the readme. Hopefully that'll help other people in the future. It's kind of sad that (aside from video sync) this is already ahead of what LG's official lighting software does. I also deleted a line from control.py that I believe is completely unnecessary, and has no effect on the functionality or operation of the program. But it was related to the part of the code causing some of the issues you were having, so let me know if the latest version causes any issues and I'll add it back in. Aside from that, this issue seems to be fully resolved. Feel free to give a ping back here if you release any software/code for this monitor for your smart home control project. |
Still working :) One interesting find though: Running LG OnScreen Control seems to block access to the USB devices - but only sometimes. It was working fine earlier, after returning to the office (and powercycling the monitors inbetween) I got: C:\AutoHotkey>python control.py turnOn After closing the LG software everything runs fine again - just in case anyone is asking! Thank you for your help today! There will probably no code released for my smarthome project, since it is not "real" software development work but more hacking everything together with IOTLink (software for windows remote control), MQTT, Node-red and OpenHab. Once setting the colors/synchronization works, I can use it to integrate the monitors into my normal light scenes... |
Hi!
Thanks for (potentially) saving us all from having to rely in LG's software department!
I am trying to run control.py on Windows. However, I do get an error message:
raceback (most recent call last): File "control.py", line 35, in <module> dev = usb.core.find(idVendor=0x043e, idProduct = 0x9a8a) File "C:\Users\koshi\AppData\Local\Programs\Python\Python38\lib\site-packages\usb\core.py", line 1299, in find raise NoBackendError('No backend available') usb.core.NoBackendError: No backend available
Which is not correct - In fact there are even two backends available, since I am running two LG27GN950 ;)
I am not really sure if the script is supposed to be running on Windows at all - but if it did and if it were to support multiple monitors, it could do more than LGs software, which is refusing any kind of control at all when running in a multiple monitor setup...
The text was updated successfully, but these errors were encountered: