-
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
More settings can be changed #1
base: main
Are you sure you want to change the base?
Conversation
Added contrast, sharpness, blue light reduction, black equalizer and osd timeout. Also wasted some time making a silly data class `Property` so that you can do transitions without needing to duplicate lots of code.
@P403n1x87 by the way, which file did you disassemble to work out how things work and what the codes are? There are a load of DLLs and I haven't looked through them yet. |
Also, thanks for this tool. I thought I would have to reverse engineer to get software KVM switch on Linux, but I saw you've already done it! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🙌 @bcaller this is awesome, thanks a lot! I've left just a couple of comments.
As for the decompiled binaries, I have used dotPeek to decompile the OSD Sidekick application and I found the magic values by poking around the classes. E.g. KVMWindow (as well as other classes, have GetOSD
and SetOSD
methods).
if current != target: | ||
self.set_property(property, target) | ||
|
||
def set_brightness(self, brightness: int): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With this new abstraction perhaps we could leverage __getattr__
to avoid implementing all these methods, e.g.
def __getattr__(self, name):
action, _, property_name = name.partition("_")
property_obj = getattr(MonitorControl, property_name.upper())
if action == "get":
return lambda: self.get_property(property_obj)
elif action == "set":
return lambda v: self.set_property(property_obj, v)
raise AttributeError()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll look at doing this when I get a chance.
@dataclass | ||
class BasicProperty: | ||
minimum: int | ||
maximum: int | ||
message_a: int | ||
message_b: int = 0 | ||
|
||
def clamp(self, v: int): | ||
return max(self.minimum, min(self.maximum, v)) | ||
|
||
|
||
@dataclass | ||
class EnumProperty: | ||
allowed: t.List[int] | ||
message_a: int | ||
message_b: int = 0 | ||
|
||
def clamp(self, v: int): | ||
if v not in self.allowed: | ||
raise Exception(f"Only allowed values: {self.allowed}") | ||
return v |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we could have an abstract base property class with the common attributes plus a method that returns the list expected by set_osd
.
Thanks for recommending dotPeek. I found you can really control everything, even emulate pressing the joystick (up down left right centre) in the OSD. |
FYI for brightness and input switching etc. just use the ddc protocol (e.g. ddcutil), for anything not available there (like the kvm switching) the python script is still useful |
@ghostface oh cool I didn't know about |
I am not sure if ddcutil works if the only thing you have attached to your pc is usb-c tho, so it might still have a use case. |
Add requirements.txt Enhance the MonitorControl class based on changes suggested in P403n1x87#1 Signed-off-by: mithwick93 <mithwick93@gmail.com>
Added contrast, sharpness, blue light reduction, black equalizer and osd
timeout.
Also wasted some time making a silly data class
Property
so that youcan do transitions without needing to duplicate lots of code.